From afb5211c7ada15bec69a54072ae9a5bed9fec038 Mon Sep 17 00:00:00 2001 From: Vishal Thapar <5137689+vthapar@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:38:38 +0530 Subject: [PATCH] E2E: use ServiceDiscovery CR to determine if clusterset IP is enabled ...in E2E tests coz lighthouse agent may not be present if service-discovery is disabled. Signed-off-by: Vishal Thapar <5137689+vthapar@users.noreply.github.com> Signed-off-by: Tom Pantelis --- test/e2e/framework/framework.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 57bc55fc..0196cfb8 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -22,12 +22,10 @@ import ( "context" "encoding/json" "fmt" - "strconv" "strings" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/submariner-io/admiral/pkg/names" "github.com/submariner-io/admiral/pkg/resource" "github.com/submariner-io/admiral/pkg/slices" "github.com/submariner-io/lighthouse/pkg/constants" @@ -102,17 +100,20 @@ func beforeSuite() { framework.DetectGlobalnet() - for _, k8sClient := range framework.KubeClients { - framework.AwaitUntil("find lighthouse agent deployment", func() (interface{}, error) { - return k8sClient.AppsV1().Deployments(framework.TestContext.SubmarinerNamespace).Get(context.TODO(), - names.ServiceDiscoveryComponent, metav1.GetOptions{}) + for _, submClient := range SubmarinerClients { + framework.AwaitUntil("Get clustersetIP enabled Configuration", func() (interface{}, error) { + unstructuredSubmarinerConfig, err := submClient.Get(context.TODO(), + "submariner", metav1.GetOptions{}) + return unstructuredSubmarinerConfig, err }, func(result interface{}) (bool, string, error) { - d := result.(*appsv1.Deployment) - for i := range d.Spec.Template.Spec.Containers[0].Env { - if d.Spec.Template.Spec.Containers[0].Env[i].Name == "SUBMARINER_CLUSTERSET_IP_ENABLED" && - d.Spec.Template.Spec.Containers[0].Env[i].Value == strconv.FormatBool(true) { - ClusterSetIPEnabled = true - } + unstructuredSubmarinerConfig := result.(*unstructured.Unstructured) + + var err error + + ClusterSetIPEnabled, _, err = unstructured.NestedBool(unstructuredSubmarinerConfig.Object, + "spec", "clustersetIPEnabled") + if err != nil { + return false, "", err } return true, "", nil