mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
address comments
This commit is contained in:
parent
9982edb395
commit
18ebfb64c8
@ -39,20 +39,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
MaxRetriesOnFederatedApiserver = 3
|
||||||
FederatedIngressTimeout = 60 * time.Second
|
FederatedIngressTimeout = 60 * time.Second
|
||||||
FederatedIngressName = "federated-ingress"
|
FederatedIngressName = "federated-ingress"
|
||||||
FederatedIngressServiceName = "federated-ingress-service"
|
FederatedIngressServiceName = "federated-ingress-service"
|
||||||
FederatedIngressServicePodName = "federated-ingress-service-test-pod"
|
FederatedIngressServicePodName = "federated-ingress-service-test-pod"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func() {
|
var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func() {
|
||||||
f := framework.NewDefaultFederatedFramework("federated-ingress")
|
f := framework.NewDefaultFederatedFramework("federated-ingress")
|
||||||
|
|
||||||
// Create/delete ingress api objects
|
// Create/delete ingress api objects
|
||||||
// Validate federation apiserver, does not rely on underlying clusters or federation ingress controller.
|
// Validate federation apiserver, does not rely on underlying clusters or federation ingress controller.
|
||||||
Describe("Ingress objects", func() {
|
Describe("Ingress objects", func() {
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
framework.SkipUnlessFederated(f.Client)
|
|
||||||
|
|
||||||
nsName := f.FederationNamespace.Name
|
nsName := f.FederationNamespace.Name
|
||||||
// Delete registered ingresses.
|
// Delete registered ingresses.
|
||||||
@ -102,7 +102,6 @@ var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should create and update matching ingresses in underlying clusters", func() {
|
It("should create and update matching ingresses in underlying clusters", func() {
|
||||||
framework.SkipUnlessFederated(f.Client)
|
|
||||||
ingress := createIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name)
|
ingress := createIngressOrFail(f.FederationClientset_1_4, f.Namespace.Name)
|
||||||
defer func() { // Cleanup
|
defer func() { // Cleanup
|
||||||
By(fmt.Sprintf("Deleting ingress %q in namespace %q", ingress.Name, f.Namespace.Name))
|
By(fmt.Sprintf("Deleting ingress %q in namespace %q", ingress.Name, f.Namespace.Name))
|
||||||
@ -136,7 +135,6 @@ var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func
|
|||||||
})
|
})
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
framework.SkipUnlessFederated(f.Client)
|
|
||||||
deleteBackendPodsOrFail(clusters, f.Namespace.Name)
|
deleteBackendPodsOrFail(clusters, f.Namespace.Name)
|
||||||
if service != nil {
|
if service != nil {
|
||||||
deleteServiceOrFail(f.FederationClientset_1_4, f.Namespace.Name, service.Name)
|
deleteServiceOrFail(f.FederationClientset_1_4, f.Namespace.Name, service.Name)
|
||||||
@ -153,7 +151,6 @@ var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func
|
|||||||
})
|
})
|
||||||
|
|
||||||
PIt("should be able to discover a federated ingress service", func() {
|
PIt("should be able to discover a federated ingress service", func() {
|
||||||
framework.SkipUnlessFederated(f.Client)
|
|
||||||
// we are about the ingress name
|
// we are about the ingress name
|
||||||
svcDNSNames := []string{
|
svcDNSNames := []string{
|
||||||
fmt.Sprintf("%s.%s", FederatedIngressServiceName, f.Namespace.Name),
|
fmt.Sprintf("%s.%s", FederatedIngressServiceName, f.Namespace.Name),
|
||||||
@ -177,8 +174,7 @@ var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func
|
|||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
equivalent returns true if the two ingresss are equivalent. Fields which are expected to differ between
|
equivalent returns true if the two ingress spec are equivalent.
|
||||||
federated ingresss and the underlying cluster ingresss (e.g. ClusterIP, LoadBalancerIP etc) are ignored.
|
|
||||||
*/
|
*/
|
||||||
func equivalentIngress(federatedIngress, clusterIngress v1beta1.Ingress) bool {
|
func equivalentIngress(federatedIngress, clusterIngress v1beta1.Ingress) bool {
|
||||||
return reflect.DeepEqual(clusterIngress.Spec, federatedIngress.Spec)
|
return reflect.DeepEqual(clusterIngress.Spec, federatedIngress.Spec)
|
||||||
@ -222,7 +218,7 @@ func waitForIngressShardsOrFail(namespace string, ingress *v1beta1.Ingress, clus
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
waitForIngressShardsOrFail waits for the ingress to appear in all clusters
|
waitForIngressShardsUpdatedOrFail waits for the ingress to be updated in all clusters
|
||||||
*/
|
*/
|
||||||
func waitForIngressShardsUpdatedOrFail(namespace string, ingress *v1beta1.Ingress, clusters map[string]*cluster) {
|
func waitForIngressShardsUpdatedOrFail(namespace string, ingress *v1beta1.Ingress, clusters map[string]*cluster) {
|
||||||
framework.Logf("Waiting for ingress %q in %d clusters", ingress.Name, len(clusters))
|
framework.Logf("Waiting for ingress %q in %d clusters", ingress.Name, len(clusters))
|
||||||
@ -232,8 +228,8 @@ func waitForIngressShardsUpdatedOrFail(namespace string, ingress *v1beta1.Ingres
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
waitForIngressOrFail waits until a ingress is either present or absent in the cluster specified by clientset.
|
waitForIngressUpdateOrFail waits until a ingress is updated in the specified cluster with same spec of federated ingress.
|
||||||
If the condition is not met within timout, it fails the calling test.
|
If the condition is not met within timeout, it fails the calling test.
|
||||||
*/
|
*/
|
||||||
func waitForIngressUpdateOrFail(clientset *release_1_3.Clientset, namespace string, ingress *v1beta1.Ingress, timeout time.Duration) {
|
func waitForIngressUpdateOrFail(clientset *release_1_3.Clientset, namespace string, ingress *v1beta1.Ingress, timeout time.Duration) {
|
||||||
By(fmt.Sprintf("Fetching a federated ingress shard of ingress %q in namespace %q from cluster", ingress.Name, namespace))
|
By(fmt.Sprintf("Fetching a federated ingress shard of ingress %q in namespace %q from cluster", ingress.Name, namespace))
|
||||||
@ -312,7 +308,7 @@ func updateIngressOrFail(clientset *federation_release_1_4.Clientset, namespace
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < 3; i++ {
|
for MaxRetriesOnFederatedApiserver := 0; MaxRetriesOnFederatedApiserver < 3; MaxRetriesOnFederatedApiserver++ {
|
||||||
_, err = clientset.Extensions().Ingresses(namespace).Get(FederatedIngressName)
|
_, err = clientset.Extensions().Ingresses(namespace).Get(FederatedIngressName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("failed to get ingress %q: %v", FederatedIngressName, err)
|
framework.Failf("failed to get ingress %q: %v", FederatedIngressName, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user