Migration e2e installation to helm (#5086)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-16 11:58:37 -03:00 committed by GitHub
parent 4b5c39e97b
commit 37c24b0df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 321 additions and 725 deletions

View file

@ -51,7 +51,7 @@ func (f *Framework) NewEchoDeploymentWithReplicas(replicas int) {
// replicas is configurable and
// name is configurable
func (f *Framework) NewEchoDeploymentWithNameAndReplicas(name string, replicas int) {
deployment := newDeployment(name, f.Namespace, "ingress-controller/echo:dev", 80, int32(replicas),
deployment := newDeployment(name, f.Namespace, "ingress-controller/echo:1.0.0-dev", 80, int32(replicas),
[]string{
"openresty",
},
@ -329,7 +329,7 @@ func newDeployment(name, namespace, image string, port int32, replicas int32, co
// NewHttpbinDeployment creates a new single replica deployment of the httpbin image in a particular namespace.
func (f *Framework) NewHttpbinDeployment() {
f.NewDeployment(HTTPBinService, "ingress-controller/httpbin:dev", 80, 1)
f.NewDeployment(HTTPBinService, "ingress-controller/httpbin:1.0.0-dev", 80, 1)
}
// NewDeployment creates a new deployment in a particular namespace.

View file

@ -58,7 +58,7 @@ func (f *Framework) NewNewFastCGIHelloServerDeploymentWithReplicas(replicas int3
Containers: []corev1.Container{
{
Name: "fastcgi-helloserver",
Image: "ingress-controller/fastcgi-helloserver:dev",
Image: "ingress-controller/fastcgi-helloserver:1.0.0-dev",
Env: []corev1.EnvVar{},
Ports: []corev1.ContainerPort{
{

View file

@ -145,7 +145,7 @@ func (f *Framework) AfterEach() {
// IngressNginxDescribe wrapper function for ginkgo describe. Adds namespacing.
func IngressNginxDescribe(text string, body func()) bool {
return ginkgo.Describe("[ingress-nginx] "+text, body)
return ginkgo.Describe(text, body)
}
// MemoryLeakIt is wrapper function for ginkgo It. Adds "[MemoryLeak]" tag and makes static analysis easier.
@ -158,7 +158,7 @@ func (f *Framework) GetNginxIP() string {
s, err := f.KubeClientSet.
CoreV1().
Services(f.Namespace).
Get("ingress-nginx", metav1.GetOptions{})
Get("nginx-ingress-controller", metav1.GetOptions{})
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "unexpected error obtaining NGINX IP address")
return s.Spec.ClusterIP
}
@ -168,7 +168,7 @@ func (f *Framework) GetNginxPodIP() []string {
e, err := f.KubeClientSet.
CoreV1().
Endpoints(f.Namespace).
Get("ingress-nginx", metav1.GetOptions{})
Get("nginx-ingress-controller", metav1.GetOptions{})
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "unexpected error obtaining NGINX IP address")
eips := make([]string, 0)
for _, s := range e.Subsets {
@ -262,7 +262,7 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b
}
func (f *Framework) getNginxConfigMap() (*v1.ConfigMap, error) {
return f.getConfigMap("nginx-configuration")
return f.getConfigMap("nginx-ingress-controller")
}
func (f *Framework) getConfigMap(name string) (*v1.ConfigMap, error) {
@ -281,36 +281,19 @@ func (f *Framework) getConfigMap(name string) (*v1.ConfigMap, error) {
return config, err
}
// GetNginxConfigMapData gets ingress-nginx's nginx-configuration map's data
func (f *Framework) GetNginxConfigMapData() (map[string]string, error) {
config, err := f.getNginxConfigMap()
if err != nil {
return nil, err
}
if config.Data == nil {
config.Data = map[string]string{}
}
return config.Data, err
}
// SetNginxConfigMapData sets ingress-nginx's nginx-configuration configMap data
// SetNginxConfigMapData sets ingress-nginx's nginx-ingress-controller configMap data
func (f *Framework) SetNginxConfigMapData(cmData map[string]string) {
f.SetConfigMapData("nginx-configuration", cmData)
}
func (f *Framework) SetConfigMapData(name string, cmData map[string]string) {
config, err := f.getConfigMap(name)
cfgMap, err := f.getConfigMap("nginx-ingress-controller")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(config).NotTo(gomega.BeNil(), "expected a configmap but none returned")
gomega.Expect(cfgMap).NotTo(gomega.BeNil(), "expected a configmap but none returned")
config.Data = cmData
cfgMap.Data = cmData
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(config)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Update(cfgMap)
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "unexpected error updating configuration configmap")
time.Sleep(5 * time.Second)
}
@ -326,15 +309,20 @@ func (f *Framework) CreateConfigMap(name string, data map[string]string) {
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "failed to create configMap")
}
// UpdateNginxConfigMapData updates single field in ingress-nginx's nginx-configuration map data
// UpdateNginxConfigMapData updates single field in ingress-nginx's nginx-ingress-controller map data
func (f *Framework) UpdateNginxConfigMapData(key string, value string) {
config, err := f.GetNginxConfigMapData()
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "unexpected error reading configmap")
config, err := f.getConfigMap("nginx-ingress-controller")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(config).NotTo(gomega.BeNil(), "expected a configmap but none returned")
config[key] = value
config.Data[key] = value
f.SetNginxConfigMapData(config)
time.Sleep(1 * time.Second)
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(config)
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "unexpected error updating configuration configmap")
time.Sleep(5 * time.Second)
}
// DeleteNGINXPod deletes the currently running pod. It waits for the replacement pod to be up.

View file

@ -36,10 +36,10 @@ import (
const (
// Poll how often to poll for conditions
Poll = 3 * time.Second
Poll = 2 * time.Second
// DefaultTimeout time to wait for operations to complete
DefaultTimeout = 3 * time.Minute
DefaultTimeout = 2 * time.Minute
)
func nowStamp() string {