Skip to content

Commit 95e2de6

Browse files
authored
[occm] Fix panic when setting fake proxy protocol LB hostname (kubernetes#2005)
With kubernetes#1968 the execution order changed such that `status.Ingress` is `nil` leading to a panic. Instead, `addr` can be used directly.
1 parent c5569c1 commit 95e2de6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/openstack/loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ func (lbaas *LbaasV2) createLoadBalancerStatus(service *corev1.Service, svcConf
19511951
// https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/1860-kube-proxy-IP-node-binding
19521952
// is implemented (maybe in v1.22).
19531953
if svcConf.enableProxyProtocol && lbaas.opts.EnableIngressHostname {
1954-
fakeHostname := fmt.Sprintf("%s.%s", status.Ingress[0].IP, lbaas.opts.IngressHostnameSuffix)
1954+
fakeHostname := fmt.Sprintf("%s.%s", addr, lbaas.opts.IngressHostnameSuffix)
19551955
status.Ingress = []corev1.LoadBalancerIngress{{Hostname: fakeHostname}}
19561956
return status
19571957
}

0 commit comments

Comments
 (0)