Enable external auth e2e tests

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-11-12 19:36:48 -03:00
parent 8b99f49d2d
commit 8a218687e3
2 changed files with 49 additions and 18 deletions

View file

@ -88,9 +88,7 @@ func (f *Framework) NewEchoDeploymentWithNameAndReplicas(name string, replicas i
// NewSlowEchoDeployment creates a new deployment of the slow echo server image in a particular namespace.
func (f *Framework) NewSlowEchoDeployment() {
data := map[string]string{}
data["nginx.conf"] = `#
cfg := `#
events {
worker_connections 1024;
multi_accept on;
@ -123,20 +121,29 @@ http {
`
f.NGINXWithConfigDeployment(SlowEchoService, cfg)
}
// NGINXWithConfigDeployment creates an NGINX deployment using a configmap containing the nginx.conf configuration
func (f *Framework) NGINXWithConfigDeployment(name string, cfg string) {
cfgMap := map[string]string{
"nginx.conf": cfg,
}
_, err := f.KubeClientSet.CoreV1().ConfigMaps(f.Namespace).Create(context.TODO(), &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: SlowEchoService,
Name: name,
Namespace: f.Namespace,
},
Data: data,
Data: cfgMap,
}, metav1.CreateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "creating configmap")
deployment := newDeployment(SlowEchoService, f.Namespace, "k8s.gcr.io/ingress-nginx/nginx:v20201028-g2c1279cd8@sha256:bd22e4f9bbf88aee527a86692be4442d03fa1ef2df94356312c9db8bec1f7ea3", 80, 1,
deployment := newDeployment(name, f.Namespace, "k8s.gcr.io/ingress-nginx/nginx:v20201028-g2c1279cd8@sha256:bd22e4f9bbf88aee527a86692be4442d03fa1ef2df94356312c9db8bec1f7ea3", 80, 1,
nil,
[]corev1.VolumeMount{
{
Name: SlowEchoService,
Name: name,
MountPath: "/etc/nginx/nginx.conf",
SubPath: "nginx.conf",
ReadOnly: true,
@ -144,11 +151,11 @@ http {
},
[]corev1.Volume{
{
Name: SlowEchoService,
Name: name,
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: SlowEchoService,
Name: name,
},
},
},
@ -160,7 +167,7 @@ http {
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: SlowEchoService,
Name: name,
Namespace: f.Namespace,
},
Spec: corev1.ServiceSpec{
@ -173,14 +180,14 @@ http {
},
},
Selector: map[string]string{
"app": SlowEchoService,
"app": name,
},
},
}
f.EnsureService(service)
err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, SlowEchoService, f.Namespace, 1)
err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.Namespace, 1)
assert.Nil(ginkgo.GinkgoT(), err, "waiting for endpoints to become ready")
}