Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/add-ons/grafana/templates/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
10 changes: 8 additions & 2 deletions charts/add-ons/tracing/templates/tracing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spec:
- mountPath: /conf
name: {{ printf "%s-config-val" .Values.collector.name}}
- {{- include "partials.proxy" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ if not .Values.global.noInitContainer -}}
{{ if not .Values.global.cniEnabled -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

initContainers:
- {{- include "partials.proxy-init" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
Expand All @@ -136,6 +136,9 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
---
###
Expand Down Expand Up @@ -214,7 +217,7 @@ spec:
{{- include "partials.resources" .Values.jaeger.resources | nindent 8 }}
{{- end }}
- {{- include "partials.proxy" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ if not .Values.global.noInitContainer -}}
{{ if not .Values.global.cniEnabled -}}
initContainers:
- {{- include "partials.proxy-init" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
Expand All @@ -224,4 +227,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/destination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,8 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{end -}}
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{- if .Values.prometheusPersistence.enabled }}
---
Expand Down
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/proxy-injector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
---
kind: Service
Expand Down
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/smi-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- name: config
configMap:
name: linkerd-smi-metrics
Expand Down
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/sp-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/tap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
- name: tls
secret:
Expand Down
3 changes: 3 additions & 0 deletions charts/linkerd2/templates/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,7 @@ spec:
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{ if not .Values.global.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
3 changes: 3 additions & 0 deletions charts/linkerd2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ global:
limit: 50Mi
request: 10Mi
closeWaitTimeoutSecs: 0
xtMountPath:
mountPath: /run
name: linkerd-proxy-init-xtables-lock

# control plane annotations - do not edit
createdByAnnotation: linkerd.io/created-by
Expand Down
10 changes: 8 additions & 2 deletions charts/partials/templates/_proxy-init.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ securityContext:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
{{- if .Values.global.proxyInit.saMountPath }}
{{- if or (not .Values.global.cniEnabled) .Values.global.proxyInit.saMountPath }}
volumeMounts:
{{- end -}}
{{- if not .Values.global.cniEnabled }}
- mountPath: {{.Values.global.proxyInit.xtMountPath.mountPath}}
name: {{.Values.global.proxyInit.xtMountPath.name}}
{{- end -}}
{{- if .Values.global.proxyInit.saMountPath }}
- mountPath: {{.Values.global.proxyInit.saMountPath.mountPath}}
name: {{.Values.global.proxyInit.saMountPath.name}}
readOnly: {{.Values.global.proxyInit.saMountPath.readOnly}}
{{- end -}}
{{- end -}}
{{- end -}}
5 changes: 5 additions & 0 deletions charts/partials/templates/_volumes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ downwardAPI:
path: "labels"
name: podinfo
{{- end -}}

{{ define "partials.proxyInit.volumes.xtables" -}}
emptyDir: {}
name: linkerd-proxy-init-xtables-lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using .Values.global.proxyInit,xMountPath.name directly here too? so that we don't have to maintain multiple copies of this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

{{- end -}}
24 changes: 17 additions & 7 deletions charts/patch/templates/patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
"value": "{{$value}}"
},
{{- end }}
{{- if or .Values.global.proxyInit .Values.global.proxy }}
{{- if .Values.addRootVolumes }}
{
"op": "add",
"path": "{{$prefix}}/spec/volumes",
"value": []
},
{{- end }}
{{- end}}
{{- if .Values.global.proxyInit }}
{{- if .Values.addRootInitContainers }}
{
Expand All @@ -43,6 +52,14 @@
"value": []
},
{{- end }}
{
"op": "add",
"path": "{{$prefix}}/spec/volumes/-",
"value": {
"emptyDir": {},
"name": "linkerd-proxy-init-xtables-lock"
}
},
{
"op": "add",
"path": "{{$prefix}}/spec/initContainers/-",
Expand All @@ -59,13 +76,6 @@
},
{{- end }}
{{- if .Values.global.proxy }}
{{- if .Values.addRootVolumes }}
{
"op": "add",
"path": "{{$prefix}}/spec/volumes",
"value": []
},
{{- end }}
{{- if (.Values.global.proxy.trace.collectorSvcAddr) }}
{
"op": "add",
Expand Down
4 changes: 4 additions & 0 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,10 @@ func (options *installOptions) buildValuesWithoutIdentity(configs *pb.All) (*l5d
installValues.Global.ProxyInit.Image.Version = options.initImageVersion
installValues.Global.ProxyInit.IgnoreInboundPorts = strings.Join(options.ignoreInboundPorts, ",")
installValues.Global.ProxyInit.IgnoreOutboundPorts = strings.Join(options.ignoreOutboundPorts, ",")
installValues.Global.ProxyInit.XTMountPath = &l5dcharts.VolumeMountPath{
MountPath: k8s.MountPathXtablesLock,
Name: k8s.InitXtablesLockVolumeMountName,
}

installValues.DebugContainer.Image.Name = registryOverride(options.debugImage, options.dockerRegistry)
installValues.DebugContainer.Image.PullPolicy = options.imagePullPolicy
Expand Down
4 changes: 4 additions & 0 deletions cli/cmd/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func TestRender(t *testing.T) {
Request: "10Mi",
},
},
XTMountPath: &charts.VolumeMountPath{
MountPath: "/run",
Name: "linkerd-proxy-init-xtables-lock",
},
},
},
Configs: charts.ConfigJSONs{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down Expand Up @@ -299,7 +304,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
5 changes: 5 additions & 0 deletions cli/cmd/testdata/inject_contour.golden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
20 changes: 20 additions & 0 deletions cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down Expand Up @@ -321,7 +326,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down Expand Up @@ -485,7 +495,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down Expand Up @@ -649,7 +664,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
5 changes: 5 additions & 0 deletions cli/cmd/testdata/inject_emojivoto_deployment.golden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ spec:
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /run
name: linkerd-proxy-init-xtables-lock
volumes:
- emptyDir: {}
name: linkerd-proxy-init-xtables-lock
- emptyDir:
medium: Memory
name: linkerd-identity-end-entity
Expand Down
Loading