Skip to content

Commit

Permalink
Use Submariner CR for clustersetip flag
Browse files Browse the repository at this point in the history
...in E2E tests coz lighthouse agent may not be present if
service-discovery is disabled.

Signed-off-by: Vishal Thapar <[email protected]>
  • Loading branch information
vthapar committed Oct 1, 2024
1 parent 3136b91 commit 885c95b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 885c95b

Please sign in to comment.