// AcquireExternalURLFromService gets external url from Service Object.
AcquireExternalURLFromService gets external url from Service Object.
// AcquireExternalURLFromService gets external url from Service Object .
func (m *AppManager) AcquireExternalURLFromService(svc *apiv1.Service) string {
	if svc.Status.LoadBalancer.Ingress != nil && len(svc.Status.LoadBalancer.Ingress) > 0 && len(svc.Spec.Ports) > 0 {
		address := ""
		if svc.Status.LoadBalancer.Ingress[0].Hostname != "" {
			address = svc.Status.LoadBalancer.Ingress[0].Hostname
		} else {
			address = svc.Status.LoadBalancer.Ingress[0].IP
		}
		return fmt.Sprintf("%s:%d", address, svc.Spec.Ports[0].Port)
	}
	if minikubeExternalIP := m.minikubeNodeIP(); minikubeExternalIP != "" {
		if len(svc.Spec.Ports) > 0 {
			return fmt.Sprintf("%s:%d", minikubeExternalIP, svc.Spec.Ports[0].NodePort)
		}
	}
	return ""
}
func ( m * AppManager ) AcquireExternalURLFromService ( svc * apiv1 . Service ) string { if svc . Status . LoadBalancer . Ingress != nil && len ( svc . Status . LoadBalancer . Ingress ) > 0 && len ( svc . Spec . Ports ) > 0 { address := " " if svc . Status . LoadBalancer . Ingress [ 0 ] . Hostname != " " { address = svc . Status . LoadBalancer . Ingress [ 0 ] . Hostname } else { address = svc . Status . LoadBalancer . Ingress [ 0 ] . IP } return fmt . Sprintf ( " " , address , svc . Spec . Ports [ 0 ] . Port ) } if minikubeExternalIP := m . minikubeNodeIP ( ) ; minikubeExternalIP != " " { if len ( svc . Spec . Ports ) > 0 { return fmt . Sprintf ( " " , minikubeExternalIP , svc . Spec . Ports [ 0 ] . NodePort ) } } return " " }
AcquireExternalURLFromService gets external url from Service Object.
AcquireExternalURLFromService gets external url from Service Object .
// TODO: Support the other local k8s clusters // if test cluster is minikube, external ip address is minikube node address