-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2E: use ServiceDiscovery CR to determine if clusterset IP is enabled #1653
Conversation
🤖 Created branch: z_pr1653/vthapar/clustersetip-e2e-fix |
test/e2e/framework/framework.go
Outdated
names.ServiceDiscoveryComponent, metav1.GetOptions{}) | ||
for _, submClient := range SubmarinerClients { | ||
framework.AwaitUntil("Get clustersetIP enabled Configuration", func() (interface{}, error) { | ||
unstructuredSubmarinerConfig, err := submClient.Get(context.TODO(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only SD is installed than the Submariner
CR isn't created so I think we should look for the ServiceDiscovery
CR. Of course if SD isn't installed then that CR won't exist. So we can either Get the ServiceDiscovery
CR without using use AwaitUntil
and set ClusterSetIPEnabled = if ServiceDiscovery found && ServiceDiscovery.Spec.ClusterSetIPEnabled
OR, preferably, lazily do this check from BeforeEach
:
var clusterSetIPEnabled = atomic.Pointer[bool]{}
...
func IsClusterSetIPEnabled() bool {
enabledPtr := clusterSetIPEnabled.Load()
if enabledPtr != nil {
return *enabledPtr
}
gvr, _ := schema.ParseResourceArg("servicediscoveries.v1alpha1.submariner.io")
sdClient := framework.DynClients[0].Resource(*gvr).Namespace(framework.TestContext.SubmarinerNamespace)
framework.AwaitUntil("find service-discovery resource", func() (interface{}, error) {
return sdClient.Get(context.TODO(), "service-discovery", metav1.GetOptions{})
}, func(result interface{}) (bool, string, error) {
enabled, _, err := unstructured.NestedBool(result.(*unstructured.Unstructured).Object, "spec", "clustersetIPEnabled")
if err != nil {
return false, "", err
}
clusterSetIPEnabled.Store(ptr.To(enabled))
return true, "", nil
})
return *clusterSetIPEnabled.Load()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set
ClusterSetIPEnabled = if ServiceDiscovery found && ServiceDiscovery.Spec.ClusterSetIPEnabled
This works better.
885c95b
to
afb5211
Compare
...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 <tompantelis@gmail.com>
afb5211
to
43f5ee3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but I can't approve the review.
🤖 Closed branches: [z_pr1653/vthapar/clustersetip-e2e-fix] |
...in E2E tests coz lighthouse agent may not be present if service-discovery is disabled.