Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
cheina97 committed Oct 18, 2024
1 parent 78b0e98 commit 89476dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ func getWireGuardSecret(ctx context.Context, cl client.Client, wgObj metav1.Obje
}
}

func checkServiceOverrides(service *corev1.Service, addresses *[]string, port *int32) error {
func checkServiceOverrides(service *corev1.Service, address *string, port *int32) error {
if service == nil {
return nil
}

if addresses == nil || port == nil {
if address == nil || port == nil {
return fmt.Errorf("addresses and port must be non-nil")
}

if service.Annotations != nil {
if v, ok := service.Annotations[consts.OverrideAddressAnnotation]; ok {
*addresses = []string{v}
*address = v
}
if v, ok := service.Annotations[consts.OverridePortAnnotation]; ok {
p, err := strconv.ParseInt(v, 10, 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,6 @@ func (r *WgGatewayServerReconciler) forgeEndpointStatusNodePort(ctx context.Cont
port := service.Spec.Ports[0].NodePort
protocol := &service.Spec.Ports[0].Protocol

// Every node IP is a valid endpoint. For convenience, we get the IP of all nodes hosting replicas of the deployment
// (i.e., WireGuard gateway servers).
var addresses []string
var internalAddress string
var nodeName string
podsSelector := client.MatchingLabelsSelector{Selector: labels.SelectorFromSet(gateway.ForgeActiveGatewayPodLabels())}
var podList corev1.PodList
if err := r.List(ctx, &podList, client.InNamespace(dep.Namespace), podsSelector); err != nil {
Expand All @@ -336,7 +331,7 @@ func (r *WgGatewayServerReconciler) forgeEndpointStatusNodePort(ctx context.Cont

pod := &podList.Items[0]

internalAddress = pod.Status.PodIP
internalAddress := pod.Status.PodIP
if internalAddress == "" {
err := fmt.Errorf("pod %s/%s has no IP", pod.Namespace, pod.Name)
klog.Error(err)
Expand Down

0 comments on commit 89476dc

Please sign in to comment.