Skip to content

Commit

Permalink
Add partials for service account token mount path and security contex…
Browse files Browse the repository at this point in the history
…t capabilities

Signed-off-by: ihcsim <ihcsim@gmail.com>
  • Loading branch information
ihcsim committed Jul 30, 2019
1 parent 1d22f4d commit 6240c13
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/linkerd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ PrometheusResources:

# proxy configuration
Proxy:
Capabilities:
Add:
Drop:
ClusterDomain: *cluster_domain
ControlPlaneNamespace: *namespace
EnableExternalProfile: false
Expand All @@ -92,6 +95,7 @@ Proxy:
PullPolicy: *image_pull_policy
Version: *linkerd_version
LogLevel: &proxy_log_level warn,linkerd2_proxy=info
MountPaths:
Port: &proxy_ports
Admin: &proxy_port_admin 4191
Control: &proxy_port_control 4190
Expand All @@ -114,6 +118,9 @@ Proxy:

# proxy-init configuration
ProxyInit:
Capabilities:
Add:
Drop:
Image:
Name: &proxy_init_image_name gcr.io/linkerd-io/proxy-init
PullPolicy: *image_pull_policy
Expand Down
16 changes: 16 additions & 0 deletions charts/partials/templates/_capabilities.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- define "partials.proxy.capabilities" -}}
capabilities:
{{- if .Capabilities.Add }}
add:
{{- toYaml .Capabilities.Add | trim | nindent 2 }}
{{- end }}
{{- if .Capabilities.Drop }}
drop:
{{- toYaml .Capabilities.Drop | trim | nindent 2 }}
{{- end }}
{{- end -}}

{{- define "partials.proxy-init.capabilities.drop" -}}
drop:
{{ toYaml .Capabilities.Drop | trim }}
{{- end -}}
12 changes: 12 additions & 0 deletions charts/partials/templates/_proxy-init.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@
add:
- NET_ADMIN
- NET_RAW
{{- if .Capabilities -}}
{{- if .Capabilities.Add }}
{{- toYaml .Capabilities.Add | trim | nindent 6 }}
{{- end }}
{{- if .Capabilities.Drop -}}
{{- include "partials.proxy-init.capabilities.drop" . | nindent 6 -}}
{{- end }}
{{- end }}
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: false
runAsUser: 0
terminationMessagePolicy: FallbackToLogsOnError
{{- if .MountPaths }}
volumeMounts:
{{- toYaml .MountPaths | trim | nindent 2 -}}
{{- end }}
{{- end -}}
6 changes: 6 additions & 0 deletions charts/partials/templates/_proxy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@
{{- end }}
securityContext:
allowPrivilegeEscalation: false
{{- if .Capabilities -}}
{{- include "partials.proxy.capabilities" . | nindent 4 -}}
{{- end }}
readOnlyRootFilesystem: true
runAsUser: {{.UID}}
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /var/run/linkerd/identity/end-entity
name: linkerd-identity-end-entity
{{- if .MountPaths }}
{{- toYaml .MountPaths | trim | nindent 2 -}}
{{- end }}
{{ end -}}

0 comments on commit 6240c13

Please sign in to comment.