From 44fbdea61340f533f8bcd7c31571975436cb23d9 Mon Sep 17 00:00:00 2001 From: Iryna Shustava Date: Tue, 25 May 2021 14:43:15 -0700 Subject: [PATCH] Enable Openshift for connect injector (#972) --- CHANGELOG.md | 2 ++ templates/connect-inject-deployment.yaml | 3 +++ test/unit/connect-inject-deployment.bats | 26 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fad2e00..a312d1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ IMPROVEMENTS: * Connect: Allow overwriting Kubernetes HTTP probes when running with transparent proxy enabled. [[GH-953](https://github.com/hashicorp/consul-helm/pull/953)] +* Connect: Enable OpenShift for the connect-injector so that we can support running with transparent + proxy enabled. [[GH-972](https://github.com/hashicorp/consul-helm/pull/972)] BUG FIXES: * OpenShift: support `server.exposeGossipAndRPCPorts`. [[GH-932](https://github.com/hashicorp/consul-helm/issues/932)] diff --git a/templates/connect-inject-deployment.yaml b/templates/connect-inject-deployment.yaml index b1360c1c..51023efb 100644 --- a/templates/connect-inject-deployment.yaml +++ b/templates/connect-inject-deployment.yaml @@ -95,6 +95,9 @@ spec: {{- else }} -default-enable-transparent-proxy=false \ {{- end }} + {{- if .Values.global.openshift.enabled }} + -enable-openshift \ + {{- end }} {{- if .Values.connectInject.transparentProxy.defaultOverwriteProbes }} -transparent-proxy-default-overwrite-probes=true \ {{- else }} diff --git a/test/unit/connect-inject-deployment.bats b/test/unit/connect-inject-deployment.bats index 332ea413..0c3a93cf 100755 --- a/test/unit/connect-inject-deployment.bats +++ b/test/unit/connect-inject-deployment.bats @@ -1419,5 +1419,31 @@ EOF . | tee /dev/stderr | yq '.spec.template.spec.containers[0].command | any(contains("-transparent-proxy-default-overwrite-probes=false"))' | tee /dev/stderr) + [ "${actual}" = "true" ] +} + +#-------------------------------------------------------------------- +# openshift + +@test "connectInject/Deployment: openshift is is not set by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/connect-inject-deployment.yaml \ + --set 'connectInject.enabled=true' \ + . | tee /dev/stderr | + yq '.spec.template.spec.containers[0].command | any(contains("-enable-openshift"))' | tee /dev/stderr) + + [ "${actual}" = "false" ] +} + +@test "connectInject/Deployment: -enable-openshift is set when global.openshift.enabled is true" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/connect-inject-deployment.yaml \ + --set 'connectInject.enabled=true' \ + --set 'global.openshift.enabled=true' \ + . | tee /dev/stderr | + yq '.spec.template.spec.containers[0].command | any(contains("-enable-openshift"))' | tee /dev/stderr) + [ "${actual}" = "true" ] } \ No newline at end of file