Skip to content
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

Use federated namespace instead of the bootstrap cluster's namespace in Ingress e2e tests. #32105

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 20 additions & 21 deletions test/e2e/federated-ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func(
// Validate federation apiserver, does not rely on underlying clusters or federation ingress controller.
Describe("Ingress objects", func() {
AfterEach(func() {

nsName := f.FederationNamespace.Name
// Delete registered ingresses.
ingressList, err := f.FederationClientset_1_4.Extensions().Ingresses(nsName).List(api.ListOptions{})
Expand Down Expand Up @@ -94,24 +93,24 @@ var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func(
jig = newFederationTestJig(f.FederationClientset_1_4)
clusters = map[string]*cluster{}
primaryClusterName = registerClusters(clusters, UserAgentName, federationName, f)
ns = f.Namespace.Name
ns = f.FederationNamespace.Name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: At other places in this test, we use nsName. Should be consistent.

})

AfterEach(func() {
unregisterClusters(clusters, f)
})

It("should create and update matching ingresses in underlying clusters", func() {
ingress := createIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name)
ingress := createIngressOrFail(f.FederationClientset_1_4, ns)
defer func() { // Cleanup
By(fmt.Sprintf("Deleting ingress %q in namespace %q", ingress.Name, f.Namespace.Name))
err := f.FederationClientset_1_4.Ingresses(f.Namespace.Name).Delete(ingress.Name, &api.DeleteOptions{})
framework.ExpectNoError(err, "Error deleting ingress %q in namespace %q", ingress.Name, f.Namespace.Name)
By(fmt.Sprintf("Deleting ingress %q in namespace %q", ingress.Name, ns))
err := f.FederationClientset_1_4.Ingresses(ns).Delete(ingress.Name, &api.DeleteOptions{})
framework.ExpectNoError(err, "Error deleting ingress %q in namespace %q", ingress.Name, ns)
}()
// wait for ingress shards being created
waitForIngressShardsOrFail(f.Namespace.Name, ingress, clusters)
ingress = updateIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name)
waitForIngressShardsUpdatedOrFail(f.Namespace.Name, ingress, clusters)
waitForIngressShardsOrFail(ns, ingress, clusters)
ingress = updateIngressOrFail(f.FederationClientset_1_4, ns)
waitForIngressShardsUpdatedOrFail(ns, ingress, clusters)
})

var _ = Describe("Ingress connectivity and DNS", func() {
Expand All @@ -123,27 +122,27 @@ var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func(
BeforeEach(func() {
framework.SkipUnlessFederated(f.Client)
// create backend pod
createBackendPodsOrFail(clusters, f.Namespace.Name, FederatedIngressServicePodName)
createBackendPodsOrFail(clusters, ns, FederatedIngressServicePodName)
// create backend service
service = createServiceOrFail(f.FederationClientset_1_4, f.Namespace.Name, FederatedIngressServiceName)
service = createServiceOrFail(f.FederationClientset_1_4, ns, FederatedIngressServiceName)
// create ingress object
jig.ing = createIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name)
jig.ing = createIngressOrFail(f.FederationClientset_1_4, ns)
// wait for services objects sync
waitForServiceShardsOrFail(f.Namespace.Name, service, clusters)
waitForServiceShardsOrFail(ns, service, clusters)
// wait for ingress objects sync
waitForIngressShardsOrFail(f.Namespace.Name, jig.ing, clusters)
waitForIngressShardsOrFail(ns, jig.ing, clusters)
})

AfterEach(func() {
deleteBackendPodsOrFail(clusters, f.Namespace.Name)
deleteBackendPodsOrFail(clusters, ns)
if service != nil {
deleteServiceOrFail(f.FederationClientset_1_4, f.Namespace.Name, service.Name)
deleteServiceOrFail(f.FederationClientset_1_4, ns, service.Name)
service = nil
} else {
By("No service to delete. Service is nil")
}
if jig.ing != nil {
deleteIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name, jig.ing.Name)
deleteIngressOrFail(f.FederationClientset_1_4, ns, jig.ing.Name)
jig.ing = nil
} else {
By("No ingress to delete. Ingress is nil")
Expand All @@ -153,11 +152,11 @@ var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func(
PIt("should be able to discover a federated ingress service", func() {
// we are about the ingress name
svcDNSNames := []string{
fmt.Sprintf("%s.%s", FederatedIngressServiceName, f.Namespace.Name),
fmt.Sprintf("%s.%s.svc.cluster.local.", FederatedIngressServiceName, f.Namespace.Name),
fmt.Sprintf("%s.%s", FederatedIngressServiceName, ns),
fmt.Sprintf("%s.%s.svc.cluster.local.", FederatedIngressServiceName, ns),
// TODO these two entries are not set yet
//fmt.Sprintf("%s.%s.%s", FederatedIngressServiceName, f.Namespace.Name, federationName),
//fmt.Sprintf("%s.%s.%s.svc.cluster.local.", FederatedIngressServiceName, f.Namespace.Name, federationName),
//fmt.Sprintf("%s.%s.%s", FederatedIngressServiceName, ns, federationName),
//fmt.Sprintf("%s.%s.%s.svc.cluster.local.", FederatedIngressServiceName, ns, federationName),
}
// check dns records in underlying cluster
for i, DNSName := range svcDNSNames {
Expand Down