Skip to content

Commit

Permalink
Add validation conditions to ensure identity and tap aren't disabled for
Browse files Browse the repository at this point in the history
control plane components

Signed-off-by: ihcsim <ihcsim@gmail.com>
  • Loading branch information
ihcsim committed Jul 30, 2019
1 parent 87727c5 commit 1d22f4d
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charts/linkerd/templates/_validate.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- define "linkerd.proxy.validation" -}}
{{- if .DisableIdentity -}}
{{- fail (printf "Can't disable identity mTLS for %s. Set '.Values.Proxy.DisableIdentity' to 'false'" .Component) -}}
{{- end -}}

{{- if .DisableTap -}}
{{- fail (printf "Can't disable tap for %s. Set '.Values.Proxy.DisableTap' to 'false'" .Component) -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions charts/linkerd/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-controller" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-grafana" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-identity" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-prometheus" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/proxy-injector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-proxy-injector" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/sp-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-sp-validator" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/tap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-tap" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/linkerd/templates/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
{{ end -}}
{{ $_ := set .Proxy "WorkloadKind" "deployment" -}}
{{ $_ := set .Proxy "Component" "linkerd-web" -}}
{{ include "linkerd.proxy.validation" .Proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down

0 comments on commit 1d22f4d

Please sign in to comment.