Skip to content

Commit

Permalink
Properly quote injection template labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Laci21 committed Feb 10, 2021
1 parent 4782ce8 commit 1873b4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/resources/sidecarinjector/configmap_sidecar_injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ func (r *Reconciler) templates() map[string]string {
{{- range $index, $container := .Spec.Containers }}{{ if not (eq $container.Name "istio-proxy") }}{{ $containers = append $containers $container.Name }}{{end}}{{- end}}
metadata:
labels:
security.istio.io/tlsMode: {{ index .ObjectMeta.Labels ` + "`" + `security.istio.io/tlsMode` + "`" + ` | default "istio" }}
service.istio.io/canonical-name: {{ index .ObjectMeta.Labels ` + "`" + `service.istio.io/canonical-name` + "`" + ` | default (index .ObjectMeta.Labels ` + "`" + `app.kubernetes.io/name` + "`" + `) | default (index .ObjectMeta.Labels ` + "`" + `app` + "`" + `) | default .DeploymentMeta.Name }}
service.istio.io/canonical-revision: {{ index .ObjectMeta.Labels ` + "`" + `service.istio.io/canonical-revision` + "`" + ` | default (index .ObjectMeta.Labels ` + "`" + `app.kubernetes.io/version` + "`" + `) | default (index .ObjectMeta.Labels ` + "`" + `version` + "`" + `) | default "latest" }}
istio.io/rev: {{ .Revision | default "default" }}
security.istio.io/tlsMode: {{ index .ObjectMeta.Labels ` + "`" + `security.istio.io/tlsMode` + "`" + ` | default "istio" | quote }}
service.istio.io/canonical-name: {{ index .ObjectMeta.Labels ` + "`" + `service.istio.io/canonical-name` + "`" + ` | default (index .ObjectMeta.Labels ` + "`" + `app.kubernetes.io/name` + "`" + `) | default (index .ObjectMeta.Labels ` + "`" + `app` + "`" + `) | default .DeploymentMeta.Name | quote }}
service.istio.io/canonical-revision: {{ index .ObjectMeta.Labels ` + "`" + `service.istio.io/canonical-revision` + "`" + ` | default (index .ObjectMeta.Labels ` + "`" + `app.kubernetes.io/version` + "`" + `) | default (index .ObjectMeta.Labels ` + "`" + `version` + "`" + `) | default "latest" | quote }}
istio.io/rev: {{ .Revision | default "default" | quote }}
annotations:
{{- if eq (len $containers) 1 }}
kubectl.kubernetes.io/default-logs-container: "{{ index $containers 0 }}"
Expand Down

0 comments on commit 1873b4b

Please sign in to comment.