|
|
@@ -37,15 +37,26 @@ func GetNGINXIngressServiceIP(clientset kubernetes.Interface) (string, bool, err
|
|
|
if err != nil {
|
|
|
return "", false, err
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- for _, svc := range svcList.Items {
|
|
|
- // check that helm chart annotation is correct exists
|
|
|
- if chartAnn, found := svc.ObjectMeta.Labels["helm.sh/chart"]; found {
|
|
|
- if (strings.Contains(chartAnn, "ingress-nginx") || strings.Contains(chartAnn, "nginx-ingress")) && svc.Spec.Type == v1.ServiceTypeLoadBalancer {
|
|
|
- nginxSvc = &svc
|
|
|
- exists = true
|
|
|
- break
|
|
|
+ if len(svcList.Items) > 0 {
|
|
|
+ for _, svc := range svcList.Items {
|
|
|
+ // check that the service is type load balancer
|
|
|
+ if svc.Spec.Type == v1.ServiceTypeLoadBalancer {
|
|
|
+ nginxSvc = &svc
|
|
|
+ exists = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for _, svc := range svcList.Items {
|
|
|
+ // check that helm chart annotation is correct exists
|
|
|
+ if chartAnn, found := svc.ObjectMeta.Labels["helm.sh/chart"]; found {
|
|
|
+ if (strings.Contains(chartAnn, "ingress-nginx") || strings.Contains(chartAnn, "nginx-ingress")) && svc.Spec.Type == v1.ServiceTypeLoadBalancer {
|
|
|
+ nginxSvc = &svc
|
|
|
+ exists = true
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|