Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev to kube-1.14 #2387

Merged
merged 8 commits into from
Aug 1, 2019
1 change: 1 addition & 0 deletions cluster/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ Resources:
- 'kms:*'
- 'logs:*'
- 'machinelearning:*'
- 'kafka:*'
- 'rds:*'
- 'redshift:*'
- 'rekognition:*'
Expand Down
2 changes: 1 addition & 1 deletion cluster/manifests/kube-metrics-adapter/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
serviceAccountName: custom-metrics-apiserver
containers:
- name: kube-metrics-adapter
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter:master-31
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter:v0.0.2
{{ if eq .ConfigItems.kube_aws_iam_controller_kube_system_enable "true"}}
env:
# must be set for the AWS SDK/AWS CLI to find the credentials file.
Expand Down
114 changes: 28 additions & 86 deletions test/e2e/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package e2e

import (
"fmt"
"log"
"net/http"
"time"

Expand Down Expand Up @@ -192,9 +191,7 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
Expect(err).NotTo(HaveOccurred())
s, err := getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Start actual ingress tests
// Test ingress Predicates with Method("GET")
Expand All @@ -215,14 +212,10 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
By(fmt.Sprintf("Waiting for ingress %s/%s we wait to get a 200 with the right content for the next request", ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get status code expected status code 200: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Test ingress Predicates with Method("PUT")
path = "/"
Expand All @@ -242,9 +235,7 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
By(fmt.Sprintf("Waiting for ingress %s/%s we wait to get a 404 for the next request", ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusNotFound)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusNotFound {
log.Fatalf("Failed to get the right the right status code 404, got: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusNotFound))

// Test ingress Filters
path = "/"
Expand All @@ -267,17 +258,11 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
time.Sleep(10 * time.Second) // wait for routing change propagation
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get the right the right status code 200, got: %d", resp.StatusCode)
}
if got := resp.Header.Get(headerKey); got != headerVal {
log.Fatalf("Failed to get Header, got: %s, want: %s", got, headerVal)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(resp.Header.Get(headerKey)).To(Equal(headerVal))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Test additional hostname
additionalHostname := fmt.Sprintf("foo-%d.%s", time.Now().UTC().Unix(), E2EHostedZone())
Expand All @@ -290,28 +275,20 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
By(fmt.Sprintf("Testing the old hostname %s for ingress %s/%s we make sure old routes are working", hostName, ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get the right the right status code 200, got: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))
By(fmt.Sprintf("Testing the new hostname %s for ingress %s/%s we make sure old routes are working", additionalHostname, ingressUpdate.Namespace, ingressUpdate.Name))
url = "https://" + additionalHostname + "/"
req, err = http.NewRequest("GET", url, nil)
Expect(err).NotTo(HaveOccurred())
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get the right the right status code 200, got: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Test changed path
newPath := "/foo"
Expand All @@ -322,24 +299,17 @@ var __ = framework.KubeDescribe("Ingress tests simple", func() {
By(fmt.Sprintf("Waiting for ingress %s/%s we wait to get a 404 for the old request, because of the path route", ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusNotFound)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusNotFound {
log.Fatalf("Failed to get the right the right status code 404, got: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusNotFound))
pathURL := "https://" + hostName + newPath
pathReq, err := http.NewRequest("GET", pathURL, nil)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Waiting for ingress %s/%s we wait to get a 200 for a new request to the path route", ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, pathReq, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get the right the right for %s status code 200, got: %d", newPath, resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content from %s after update got: %s, expected: %s", newPath, s, backendContent)
}

Expect(s).To(Equal(backendContent))
})
})

Expand Down Expand Up @@ -446,9 +416,7 @@ var ___ = framework.KubeDescribe("Ingress tests paths", func() {
Expect(err).NotTo(HaveOccurred())
s, err := getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Start actual ingress tests
// Test ingress with 1 path
Expand All @@ -468,23 +436,17 @@ var ___ = framework.KubeDescribe("Ingress tests paths", func() {
By(fmt.Sprintf("Testing for ingress %s/%s we want to get a 404 for path /", ingressUpdate.Namespace, ingressUpdate.Name))
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusNotFound)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusNotFound {
log.Fatalf("Failed to get status code expected status code 404: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusNotFound))

By(fmt.Sprintf("Testing for ingress %s/%s we want to get a 200 for path %s", ingressUpdate.Namespace, ingressUpdate.Name, bepath))
beurl := "https://" + hostName + bepath
bereq, err := http.NewRequest("GET", beurl, nil)
resp, err = getAndWaitResponse(rt, bereq, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get status code expected status code 200: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Test ingress with 2 paths
bepath2 := "/bar"
Expand All @@ -493,9 +455,7 @@ var ___ = framework.KubeDescribe("Ingress tests paths", func() {
By(fmt.Sprintf("Testing for ingress %s/%s we want to get a 404 for path %s", ingressUpdate.Namespace, ingressUpdate.Name, bepath2))
resp, err = getAndWaitResponse(rt, bereq2, 10*time.Second, http.StatusNotFound)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusNotFound {
log.Fatalf("Failed to get status code expected status code 404: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusNotFound))
By(fmt.Sprintf("Testing for ingress %s/%s we want to get a 200 for path %s", ingressUpdate.Namespace, ingressUpdate.Name, bepath2))
updatedIng = addPathIngress(updatedIng,
bepath2,
Expand All @@ -508,28 +468,20 @@ var ___ = framework.KubeDescribe("Ingress tests paths", func() {
Expect(err).NotTo(HaveOccurred())
resp, err = getAndWaitResponse(rt, bereq2, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get status code expected status code 200: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent2 {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent2)
}
Expect(s).To(Equal(backendContent2))

By(fmt.Sprintf("Testing for ingress %s/%s we want to get a 200 for path %s without change from the other path", ingressUpdate.Namespace, ingressUpdate.Name, bepath))
beurl = "https://" + hostName + bepath
bereq, err = http.NewRequest("GET", beurl, nil)
resp, err = getAndWaitResponse(rt, bereq, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get status code expected status code 200: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))
})
})

Expand Down Expand Up @@ -614,9 +566,7 @@ var ____ = framework.KubeDescribe("Ingress tests custom routes", func() {
Expect(err).NotTo(HaveOccurred())
s, err := getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))

// Start actual ingress tests
// Test ingress with 1 custom route
Expand Down Expand Up @@ -645,25 +595,17 @@ var ____ = framework.KubeDescribe("Ingress tests custom routes", func() {
Expect(err).NotTo(HaveOccurred())
resp, err = getAndWaitResponse(rt, req, 10*time.Second, http.StatusTemporaryRedirect)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusTemporaryRedirect {
log.Fatalf("Failed to get status code expected status code 307: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusTemporaryRedirect))

reqRedirectURL := resp.Header.Get("Location")
By(fmt.Sprintf("Testing for ingress %s/%s rediretc Location we want to get a 200 for URL %s", ingressUpdate.Namespace, ingressUpdate.Name, reqRedirectURL))
if redirectDestinationURL != reqRedirectURL {
log.Fatalf("Failed to get the right redirect from header: %s, expected: %s", reqRedirectURL, redirectDestinationURL)
}
Expect(redirectDestinationURL).To(Equal(reqRedirectURL))
redirectreq, err := http.NewRequest("GET", reqRedirectURL, nil)
resp, err = getAndWaitResponse(rt, redirectreq, 10*time.Second, http.StatusOK)
Expect(err).NotTo(HaveOccurred())
if resp.StatusCode != http.StatusOK {
log.Fatalf("Failed to get status code expected status code 200: %d", resp.StatusCode)
}
Expect(resp.StatusCode).To(Equal(http.StatusOK))
s, err = getBody(resp)
Expect(err).NotTo(HaveOccurred())
if s != backendContent {
log.Fatalf("Failed to get the right content after update got: %s, expected: %s", s, backendContent)
}
Expect(s).To(Equal(backendContent))
})
})