Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuee committed Oct 23, 2023
1 parent 5fdff4d commit fd225fa
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions charts/yurt-manager/crds/raven.openyurt.io_gateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ spec:
type: string
privateIP:
type: string
publicIP:
description: 'Node PublicIP: satellite nodes need to build vxlan connctions using their public IPs;'
type: string
subnets:
items:
type: string
Expand Down
2 changes: 1 addition & 1 deletion charts/yurt-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ image:
registry: openyurt
repository: yurt-manager
tag: v1.3.4
pullPolicy: always
pullPolicy: Always

ports:
metrics: 10271
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/raven/v1alpha1/gateway_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (src *Gateway) ConvertTo(dstRaw conversion.Hub) error {
NodeName: node.NodeName,
PrivateIP: node.PrivateIP,
Subnets: node.Subnets,
PublicIP: node.PublicIP,
})
}
if src.Status.ActiveEndpoint != nil {
Expand Down Expand Up @@ -102,6 +103,7 @@ func (dst *Gateway) ConvertFrom(srcRaw conversion.Hub) error {
NodeName: node.NodeName,
PrivateIP: node.PrivateIP,
Subnets: node.Subnets,
PublicIP: node.PublicIP,
})
}
if src.Status.ActiveEndpoints == nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/raven/v1alpha1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ type NodeInfo struct {
NodeName string `json:"nodeName"`
PrivateIP string `json:"privateIP"`
Subnets []string `json:"subnets"`
// Node PublicIP: satellite nodes need to build vxlan connctions
// using their public IPs;
PublicIP string `json:"publicIP,omitempty"`
}

// GatewayStatus defines the observed state of Gateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (r *ReconcileGateway) Reconcile(ctx context.Context, req reconcile.Request)
return reconcile.Result{}, err
}
publicIP := ""
publicIP, err = utils.GetEdgeeNodePublicIP(v)
publicIP, err = utils.GetEdgeNodePublicIP(&v)
if err != nil {
klog.InfoS("unable to get node public IP, expecting nodes to communicate via private IPs: " + err.Error())
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/yurtmanager/controller/raven/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
WorkingNamespace = "kube-system"
RavenGlobalConfig = "raven-cfg"
LabelCurrentGatewayEndpoints = "raven.openyurt.io/endpoints-name"
LabelLeptonSatellitePublicIP = "raven.openyurt.io/provider-public-ip"
LabelNodeProviderPublicIP = "raven.openyurt.io/provider-public-ip"
GatewayProxyInternalService = "x-raven-proxy-internal-svc"
GatewayProxyServiceNamePrefix = "x-raven-proxy-svc"
GatewayTunnelServiceNamePrefix = "x-raven-tunnel-svc"
Expand Down Expand Up @@ -70,13 +70,13 @@ func GetNodeInternalIP(node corev1.Node) string {
return ip
}

func GetEdgeeNodePublicIP(node corev1.Node) (string, error) {
ip, ok := node.Labels[LabelLeptonSatellitePublicIP]
func GetEdgeNodePublicIP(node *corev1.Node) (string, error) {
ip, ok := node.Labels[LabelNodeProviderPublicIP]
if !ok {
return "", fmt.Errorf("failed to get public ip, no label %s on node %s", LabelLeptonSatellitePublicIP, node.Name)
return "", fmt.Errorf("failed to get public ip, no label %s on node %s", LabelNodeProviderPublicIP, node.Name)
}
if net.ParseIP(ip) == nil {
return "", fmt.Errorf("failed to get public ip, invalid public IP label %s, %s on node %s", LabelLeptonSatellitePublicIP, ip, node.Name)
return "", fmt.Errorf("failed to get public ip, invalid public IP label %s, %s on node %s", LabelNodeProviderPublicIP, ip, node.Name)
}
return ip, nil
}
Expand Down

0 comments on commit fd225fa

Please sign in to comment.