From 75f3faaa8cd3b73ddd6049db2a16b68d5966143e Mon Sep 17 00:00:00 2001 From: Francisco de Paz Galan Date: Thu, 23 Mar 2023 12:27:13 +0100 Subject: [PATCH] [bitnami/contour-operator] Skip Ginkgo execution when using private registries (#15701) Signed-off-by: FraPazGal --- .../ginkgo/contour_operator_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.vib/contour-operator/ginkgo/contour_operator_test.go b/.vib/contour-operator/ginkgo/contour_operator_test.go index 3066ae775f..36aa8f699d 100644 --- a/.vib/contour-operator/ginkgo/contour_operator_test.go +++ b/.vib/contour-operator/ginkgo/contour_operator_test.go @@ -8,9 +8,11 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" + appscv1 "k8s.io/client-go/kubernetes/typed/apps/v1" cv1 "k8s.io/client-go/kubernetes/typed/core/v1" netcv1 "k8s.io/client-go/kubernetes/typed/networking/v1" @@ -22,7 +24,9 @@ var _ = Describe("Contour Operator:", func() { Context("When both operator and testing resources are deployed", Ordered, func() { var netclient netcv1.NetworkingV1Interface var coreclient cv1.CoreV1Interface + var appsclient appscv1.AppsV1Interface var dynamicClient dynamic.Interface + var contourOperatorDeploy *appsv1.Deployment var envoySvc *v1.Service var ctx context.Context var err error @@ -34,11 +38,22 @@ var _ = Describe("Contour Operator:", func() { var ingressHost string var hasIP, isReady bool + appsclient = appscv1.NewForConfigOrDie(clusterConfigOrDie()) netclient = netcv1.NewForConfigOrDie(clusterConfigOrDie()) coreclient = cv1.NewForConfigOrDie(clusterConfigOrDie()) dynamicClient = dynamic.NewForConfigOrDie(clusterConfigOrDie()) ctx = context.Background() + contourOperatorDeploy, err = appsclient.Deployments(*namespace).Get(ctx, "contour-operator", metav1.GetOptions{}) + if err != nil { + panic(fmt.Sprintf("There was an error retrieving the Contour Operator deployment: %q", err)) + } + usesPrivateRegistries := len(contourOperatorDeploy.Spec.Template.Spec.ImagePullSecrets) != 0 + + if usesPrivateRegistries { + Skip("Contour operator does not support the use of private registries. Skipping tests") + } + // The tests evaluate the Operator by deploying both Contour and Ingress resources. // Their creation takes some time, so they will be deployed once and reused across the different checks. createContourResourceOrDie(ctx, dynamicClient, contourName) @@ -85,6 +100,7 @@ var _ = Describe("Contour Operator:", func() { if err != nil { panic(fmt.Sprintf("There was an error retrieving the %q Ingress resource: %q", ingressName, err)) } + Expect(returnValidHost(testingIngress.Status.LoadBalancer.Ingress[0])).To(Equal(returnValidHost(envoySvc.Status.LoadBalancer.Ingress[0]))) })