mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #55047 from nikhiljindal/ingressTest
Automatic merge from submit-queue (batch tested with PRs 55093, 54966, 55047, 54971, 54786). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Adding an e2e test for gce multi cluster ingress Basic test that verifies that multi cluster ingress gets the instance groups annotation. Ref https://github.com/kubernetes/ingress-gce/issues/71 cc @csbell @G-Harmon @nicksardo @bowei ```release-note NONE```
This commit is contained in:
commit
743d11fbd5
@ -62,7 +62,12 @@ const (
|
||||
validFor = 365 * 24 * time.Hour
|
||||
|
||||
// Ingress class annotation defined in ingress repository.
|
||||
ingressClass = "kubernetes.io/ingress.class"
|
||||
// TODO: All these annotations should be reused from
|
||||
// ingress-gce/pkg/annotations instead of duplicating them here.
|
||||
IngressClass = "kubernetes.io/ingress.class"
|
||||
|
||||
// Ingress class annotation value for multi cluster ingress.
|
||||
MulticlusterIngressClassValue = "gce-multi-cluster"
|
||||
|
||||
// all cloud resources created by the ingress controller start with this
|
||||
// prefix.
|
||||
@ -937,7 +942,7 @@ func (j *IngressTestJig) CreateIngress(manifestPath, ns string, ingAnnotations m
|
||||
j.Ingress, err = manifest.IngressFromManifest(filepath.Join(manifestPath, "ing.yaml"))
|
||||
ExpectNoError(err)
|
||||
j.Ingress.Namespace = ns
|
||||
j.Ingress.Annotations = map[string]string{ingressClass: j.Class}
|
||||
j.Ingress.Annotations = map[string]string{IngressClass: j.Class}
|
||||
for k, v := range ingAnnotations {
|
||||
j.Ingress.Annotations[k] = v
|
||||
}
|
||||
|
@ -33,8 +33,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
NEGAnnotation = "alpha.cloud.google.com/load-balancer-neg"
|
||||
NEGUpdateTimeout = 2 * time.Minute
|
||||
NEGAnnotation = "alpha.cloud.google.com/load-balancer-neg"
|
||||
NEGUpdateTimeout = 2 * time.Minute
|
||||
instanceGroupAnnotation = "ingress.gcp.kubernetes.io/instance-groups"
|
||||
)
|
||||
|
||||
var _ = SIGDescribe("Loadbalancing: L7", func() {
|
||||
@ -153,6 +154,29 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
|
||||
// framework.ExpectNoError(jig.verifyURL(fmt.Sprintf("https://%v/", ip), "", 30, 1*time.Second, httpClient))
|
||||
})
|
||||
|
||||
It("multicluster ingress should get instance group annotation", func() {
|
||||
name := "echomap"
|
||||
jig.CreateIngress(filepath.Join(framework.IngressManifestPath, "http"), ns, map[string]string{
|
||||
framework.IngressClass: framework.MulticlusterIngressClassValue,
|
||||
}, map[string]string{})
|
||||
|
||||
By(fmt.Sprintf("waiting for Ingress %s to come up", name))
|
||||
pollErr := wait.Poll(2*time.Second, framework.LoadBalancerPollTimeout, func() (bool, error) {
|
||||
ing, err := f.ClientSet.ExtensionsV1beta1().Ingresses(ns).Get(name, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
annotations := ing.Annotations
|
||||
if annotations == nil || annotations[instanceGroupAnnotation] == "" {
|
||||
framework.Logf("Waiting for ingress to get %s annotation. Found annotations: %v", instanceGroupAnnotation, annotations)
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
if pollErr != nil {
|
||||
framework.ExpectNoError(fmt.Errorf("Timed out waiting for ingress %s to get %s annotation", name, instanceGroupAnnotation))
|
||||
}
|
||||
// TODO(nikhiljindal): Check the instance group annotation value and verify with a multizone cluster.
|
||||
})
|
||||
|
||||
// TODO: Implement a multizone e2e that verifies traffic reaches each
|
||||
// zone based on pod labels.
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user