Skip to content

Commit

Permalink
cherry pick 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
winston0410 committed Jul 18, 2024
1 parent e0a9d03 commit 6e4778c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/controllers/wireguard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,7 @@ func (r *WireguardReconciler) serviceForWireguard(m *v1alpha1.Wireguard, service
Labels: labels,
},
Spec: corev1.ServiceSpec{
LoadBalancerIP: m.Spec.Address,
Selector: labels,
Selector: labels,
Ports: []corev1.ServicePort{{
Protocol: corev1.ProtocolUDP,
NodePort: m.Spec.NodePort,
Expand All @@ -636,6 +635,10 @@ func (r *WireguardReconciler) serviceForWireguard(m *v1alpha1.Wireguard, service
},
}

if dep.Spec.Type == corev1.ServiceTypeLoadBalancer {
dep.Spec.LoadBalancerIP = m.Spec.Address
}

ctrl.SetControllerReference(m, dep, r.Scheme)
return dep
}
Expand Down

0 comments on commit 6e4778c

Please sign in to comment.