Skip to content

Commit

Permalink
Merge pull request openshift#1632 from sjenning/wait-for-lb
Browse files Browse the repository at this point in the history
Wait for LB even when hostname is specified
  • Loading branch information
openshift-merge-robot authored Jul 30, 2022
2 parents a78f398 + a77b81c commit 586b0aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ func ReconcileService(svc *corev1.Service, strategy *hyperv1.ServicePublishingSt
func ReconcileServiceStatus(svc *corev1.Service, strategy *hyperv1.ServicePublishingStrategy, apiServerPort int, messageCollector events.MessageCollector) (host string, port int32, message string, err error) {
switch strategy.Type {
case hyperv1.LoadBalancer:
if strategy.LoadBalancer != nil && strategy.LoadBalancer.Hostname != "" {
host = strategy.LoadBalancer.Hostname
port = int32(apiServerPort)
return
}
if len(svc.Status.LoadBalancer.Ingress) == 0 {
message = fmt.Sprintf("Kubernetes APIServer load balancer is not provisioned; %v since creation.", duration.ShortHumanDuration(time.Since(svc.ObjectMeta.CreationTimestamp.Time)))
var eventMessages []string
Expand All @@ -86,13 +81,14 @@ func ReconcileServiceStatus(svc *corev1.Service, strategy *hyperv1.ServicePublis
}
return
}
port = int32(apiServerPort)
switch {
case strategy.LoadBalancer != nil && strategy.LoadBalancer.Hostname != "":
host = strategy.LoadBalancer.Hostname
case svc.Status.LoadBalancer.Ingress[0].Hostname != "":
host = svc.Status.LoadBalancer.Ingress[0].Hostname
port = int32(apiServerPort)
case svc.Status.LoadBalancer.Ingress[0].IP != "":
host = svc.Status.LoadBalancer.Ingress[0].IP
port = int32(apiServerPort)
}
case hyperv1.NodePort:
if strategy.NodePort == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ func ReconcileServerServiceStatus(svc *corev1.Service, route *routev1.Route, str

switch strategy.Type {
case hyperv1.LoadBalancer:
if strategy.LoadBalancer != nil && strategy.LoadBalancer.Hostname != "" {
host = strategy.LoadBalancer.Hostname
port = int32(KonnectivityServerPort)
return
}
if len(svc.Status.LoadBalancer.Ingress) == 0 {
message = fmt.Sprintf("Konnectivity load balancer is not provisioned; %v since creation", duration.ShortHumanDuration(time.Since(svc.ObjectMeta.CreationTimestamp.Time)))
var messages []string
Expand All @@ -275,13 +270,14 @@ func ReconcileServerServiceStatus(svc *corev1.Service, route *routev1.Route, str
}
return
}
port = int32(KonnectivityServerPort)
switch {
case strategy.LoadBalancer != nil && strategy.LoadBalancer.Hostname != "":
host = strategy.LoadBalancer.Hostname
case svc.Status.LoadBalancer.Ingress[0].Hostname != "":
host = svc.Status.LoadBalancer.Ingress[0].Hostname
port = int32(KonnectivityServerPort)
case svc.Status.LoadBalancer.Ingress[0].IP != "":
host = svc.Status.LoadBalancer.Ingress[0].IP
port = int32(KonnectivityServerPort)
}
case hyperv1.NodePort:
if strategy.NodePort == nil {
Expand Down

0 comments on commit 586b0aa

Please sign in to comment.