Skip to content

Commit

Permalink
fix(load-balancer): do not break existing behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmetzner committed Dec 20, 2024
1 parent 7f4ab61 commit ee57640
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions internal/hcops/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,17 +845,6 @@ func (l *LoadBalancerOps) ReconcileHCLBServices(
return false, fmt.Errorf("%s: %v", op, err)
}

for _, port := range svc.Spec.Ports {
if port.Protocol != "" && port.Protocol != corev1.ProtocolTCP {
err := fmt.Errorf(
"configured unsupported Hetzner Cloud load balancer protocol %s for service with name %s",
port.Protocol,
svc.Name,
)
return false, err
}
}

hclbListenPorts := make(map[int]bool, len(lb.Services))
for _, hclbService := range lb.Services {
hclbListenPorts[hclbService.ListenPort] = true
Expand All @@ -877,6 +866,21 @@ func (l *LoadBalancerOps) ReconcileHCLBServices(
portExists := hclbListenPorts[portNo]
delete(hclbListenPorts, portNo)

if port.Protocol != "" && port.Protocol != corev1.ProtocolTCP {
warnMsg := fmt.Sprintf(
"configured unsupported Hetzner Cloud load balancer protocol %s for service with name %s",
port.Protocol,
svc.Name,
)
l.Recorder.Event(
svc,
corev1.EventTypeWarning,
"UnsupportedProtocolConfigured",
warnMsg,
)
klog.Warning(warnMsg)
}

b := &hclbServiceOptsBuilder{Port: port, Service: svc, CertOps: l.CertOps}
if portExists {
klog.InfoS("update service", "op", op, "port", portNo, "loadBalancerID", lb.ID)
Expand Down

0 comments on commit ee57640

Please sign in to comment.