Skip to content

Commit

Permalink
Backport of NET-4967: Fix helm install when setting copyAnnotations o…
Browse files Browse the repository at this point in the history
…r nodeSelector for apiGateway into release/1.2.x (#2674)

* backport of commit 233b0d1

* backport of commit c2f4378

* backport of commit c38dd3f

* backport of commit 7df5f84

---------

Co-authored-by: Nathan Coleman <[email protected]>
  • Loading branch information
1 parent 19c29df commit f88485f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/2597.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
api-gateway: fix helm install when setting copyAnnotations or nodeSelector
```
6 changes: 4 additions & 2 deletions charts/consul/templates/gateway-resources-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ spec:
{{- end}}
{{- end}}
{{- if .Values.connectInject.apiGateway.managedGatewayClass.nodeSelector }}
- -node-selector={{ .Values.connectInject.apiGateway.managedGatewayClass.nodeSelector }}
- -node-selector
- {{- toYaml .Values.connectInject.apiGateway.managedGatewayClass.nodeSelector | nindent 14 -}}
{{- end }}
{{- if .Values.connectInject.apiGateway.managedGatewayClass.tolerations }}
- -tolerations={{ .Values.connectInject.apiGateway.managedGatewayClass.tolerations }}
{{- end }}
{{- if .Values.connectInject.apiGateway.managedGatewayClass.copyAnnotations.service }}
- -service-annotations={{ .Values.connectInject.apiGateway.managedGatewayClass.copyAnnotations.service.annotations }}
- -service-annotations
- {{- toYaml .Values.connectInject.apiGateway.managedGatewayClass.copyAnnotations.service.annotations | nindent 14 -}}
{{- end }}
- -service-type={{ .Values.connectInject.apiGateway.managedGatewayClass.serviceType }}
{{- end}}
Expand Down
16 changes: 11 additions & 5 deletions charts/consul/test/unit/gateway-resources-job.bats
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,20 @@ target=templates/gateway-resources-job.yaml
local actual=$(echo "$spec" | jq 'any(index("-service-type=Foo"))')
[ "${actual}" = "true" ]

local actual=$(echo "$spec" | jq '.[12] | ."-node-selector=foo"')
[ "${actual}" = "\"bar\"" ]
local actual=$(echo "$spec" | jq '.[12]')
[ "${actual}" = "\"-node-selector\"" ]

local actual=$(echo "$spec" | jq '.[13]')
[ "${actual}" = "\"foo: bar\"" ]

local actual=$(echo "$spec" | jq '.[13] | ."-tolerations=- key"')
local actual=$(echo "$spec" | jq '.[14] | ."-tolerations=- key"')
[ "${actual}" = "\"bar\"" ]

local actual=$(echo "$spec" | jq '.[14]')
[ "${actual}" = "\"-service-annotations=- bingo\"" ]
local actual=$(echo "$spec" | jq '.[15]')
[ "${actual}" = "\"-service-annotations\"" ]

local actual=$(echo "$spec" | jq '.[16]')
[ "${actual}" = "\"- bingo\"" ]
}


Expand Down

0 comments on commit f88485f

Please sign in to comment.