Skip to content

Commit

Permalink
add cert annotation test to featuretests
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo RUTH <contact@pablo-ruth.fr>
  • Loading branch information
pablo-ruth committed Jan 19, 2022
1 parent 5c515a6 commit 73612c3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions internal/featuretests/v3/tlscertificatedelegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/projectcontour/contour/internal/featuretests"
"github.com/projectcontour/contour/internal/fixture"
v1 "k8s.io/api/core/v1"
networking_v1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -261,4 +262,57 @@ func TestTLSCertificateDelegation(t *testing.T) {
),
TypeUrl: listenerType,
})

rh.OnDelete(hp1)

c.Request(listenerType).Equals(&envoy_discovery_v3.DiscoveryResponse{
Resources: resources(t,
statsListener(),
),
TypeUrl: listenerType,
})

// add an ingress in a different namespace mentioning secret wildcard from namespace secret via annotation.
i1 := &networking_v1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "simple",
Namespace: s1.Namespace,
Annotations: map[string]string{
"projectcontour.io/tls-cert-namespace": sec1.Namespace,
},
},
Spec: networking_v1.IngressSpec{
TLS: []networking_v1.IngressTLS{{
Hosts: []string{"example.com"},
SecretName: sec1.Name,
}},
Rules: []networking_v1.IngressRule{{
Host: "example.com",
IngressRuleValue: networking_v1.IngressRuleValue{
HTTP: &networking_v1.HTTPIngressRuleValue{
Paths: []networking_v1.HTTPIngressPath{{
Backend: networking_v1.IngressBackend{
Service: &networking_v1.IngressServiceBackend{
Name: s1.Name,
Port: networking_v1.ServiceBackendPort{
Number: 8080,
},
},
},
}},
},
},
}},
},
}
rh.OnAdd(i1)

c.Request(listenerType).Equals(&envoy_discovery_v3.DiscoveryResponse{
Resources: resources(t,
defaultHTTPListener(),
ingressHTTPS,
statsListener(),
),
TypeUrl: listenerType,
})
}

0 comments on commit 73612c3

Please sign in to comment.