From f2c37f598661e4549f64bf41d24376e2dd14f62c Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Tue, 17 Nov 2020 17:57:39 +0700 Subject: [PATCH 1/2] Add ability to provide extra Ingree backends (refs #361). --- Chart.yaml | 2 +- templates/server-ingress.yaml | 6 ++++++ test/unit/server-ingress.bats | 19 ++++++++++++++++++- values.yaml | 8 ++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index bc953d97b..8de5470c8 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: vault -version: 0.8.0 +version: 0.8.1 appVersion: 1.5.4 description: Official HashiCorp Vault Chart home: https://www.vaultproject.io diff --git a/templates/server-ingress.yaml b/templates/server-ingress.yaml index 7c19f5fea..d2e525cc3 100644 --- a/templates/server-ingress.yaml +++ b/templates/server-ingress.yaml @@ -41,6 +41,12 @@ spec: - host: {{ .host | quote }} http: paths: + {{- range .extraBackends }} + - path: {{ .path }} + backend: + serviceName: {{ .serviceName }} + servicePort: {{ .servicePort }} + {{- end }} {{- range (.paths | default (list "/")) }} - path: {{ . }} backend: diff --git a/test/unit/server-ingress.bats b/test/unit/server-ingress.bats index 5af493847..fa54f0698 100755 --- a/test/unit/server-ingress.bats +++ b/test/unit/server-ingress.bats @@ -120,4 +120,21 @@ load _helpers . | tee /dev/stderr | yq -r '.spec.rules[0].http.paths[0].backend.serviceName' | tee /dev/stderr) [ "${actual}" = "RELEASE-NAME-vault" ] -} \ No newline at end of file +} + +@test "server/ingress: adds extra backend workaround for ALB https redirection - yaml" { + cd `chart_dir` + + local actual=$(helm template \ + --show-only templates/server-ingress.yaml \ + --set 'server.ingress.enabled=true' \ + --set 'server.ingress.hosts[0].host=test.com' \ + --set 'server.ingress.hosts[0].paths[0]=/' \ + --set 'server.ingress.hosts[0].extraBackends[0].path=/' \ + --set 'server.ingress.hosts[0].extraBackends[0].serviceName=ssl-redirect' \ + --set 'server.ingress.hosts[0].extraBackends[0].servicePort=use-annotation' \ + --set 'server.service.enabled=true' \ + . | tee /dev/stderr | + yq -r '.spec.rules[0].http.paths[0].backend.serviceName' | tee /dev/stderr) + [ "${actual}" = "ssl-redirect" ] +} diff --git a/values.yaml b/values.yaml index a0b77a5f8..3dc76c938 100644 --- a/values.yaml +++ b/values.yaml @@ -175,6 +175,14 @@ server: hosts: - host: chart-example.local paths: [] + # Allow adding extra backend sections. This allows us to make use of + # the annotations required to do https redirection using AWS + # Application Load Balancers. + # See . + # extraBackends: + # - path: /* + # serviceName: ssl-redirect + # servicePort: use-annotation tls: [] # - secretName: chart-example-tls From 6a01664d111f1eaf6c5df59e4cfb86ff2b160950 Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Thu, 10 Dec 2020 14:13:41 +0700 Subject: [PATCH 2/2] Undo version bump. --- Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chart.yaml b/Chart.yaml index 8de5470c8..bc953d97b 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: vault -version: 0.8.1 +version: 0.8.0 appVersion: 1.5.4 description: Official HashiCorp Vault Chart home: https://www.vaultproject.io