Skip to content

Commit

Permalink
Change loadbalancer type for HCP deployments
Browse files Browse the repository at this point in the history
The Kubevirt(HCP) clusters do not have their loadbalancer installedand rely
on the host loadblancer( like netallb) when a loadbalancer is created.So when
the Submariner exposes the submariner-gateway loadbalancer service with
ServiceExternalTrafficPolicy locally does not work, as the traffic from
the remotecluster first lands on the host cluster. Hence the traffic policy
is updated to clusterin these deployments.

Signed-off-by: Aswin Suryanarayanan <[email protected]>
  • Loading branch information
aswinsuryan committed Dec 19, 2024
1 parent 5fbba06 commit e49114e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/controllers/submariner/loadbalancer_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func (r *Reconciler) getOCPPlatformType(ctx context.Context) (string, error) {
}

func newLoadBalancerService(instance *v1alpha1.Submariner, platformTypeOCP string) *corev1.Service {
externalTrafficPolicy := corev1.ServiceExternalTrafficPolicyTypeLocal

var svcAnnotations map[string]string

switch platformTypeOCP {
Expand All @@ -104,6 +106,8 @@ func newLoadBalancerService(instance *v1alpha1.Submariner, platformTypeOCP strin
"service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type": "public",
"service.kubernetes.io/ibm-load-balancer-cloud-provider-vpc-health-check-protocol": "http",
}
case string(configv1.KubevirtPlatformType):
externalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeCluster
default:
svcAnnotations = map[string]string{}
}
Expand All @@ -115,7 +119,7 @@ func newLoadBalancerService(instance *v1alpha1.Submariner, platformTypeOCP strin
Annotations: svcAnnotations,
},
Spec: corev1.ServiceSpec{
ExternalTrafficPolicy: corev1.ServiceExternalTrafficPolicyTypeLocal,
ExternalTrafficPolicy: externalTrafficPolicy,
Type: corev1.ServiceTypeLoadBalancer,
Selector: map[string]string{
// Traffic is directed to the active gateway
Expand Down

0 comments on commit e49114e

Please sign in to comment.