github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/pkg/kiali.go (about)

     1  // Copyright (c) 2022, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package pkg
     5  
     6  import (
     7  	"context"
     8  	"fmt"
     9  	"github.com/onsi/gomega"
    10  	"github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/kiali"
    11  	networking "k8s.io/api/networking/v1"
    12  	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    13  	"k8s.io/client-go/kubernetes"
    14  )
    15  
    16  const (
    17  	KialiName = "vmi-system-kiali"
    18  )
    19  
    20  func EventuallyGetKialiHost(cs *kubernetes.Clientset) string {
    21  	var ingress *networking.Ingress
    22  	gomega.Eventually(func() (*networking.Ingress, error) {
    23  		var err error
    24  		ingress, err = cs.NetworkingV1().Ingresses(kiali.ComponentNamespace).Get(context.TODO(), KialiName, v1.GetOptions{})
    25  		return ingress, err
    26  	}, waitTimeout, pollingInterval).ShouldNot(gomega.BeNil())
    27  	rules := ingress.Spec.Rules
    28  	gomega.Expect(len(rules)).To(gomega.Equal(1))
    29  	gomega.Expect(rules[0].Host).To(gomega.ContainSubstring("kiali.vmi.system"))
    30  	return fmt.Sprintf("https://%s", ingress.Spec.Rules[0].Host)
    31  }