Skip to content

Commit

Permalink
update deployment securityContext (#171)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Yin <[email protected]>
  • Loading branch information
zhiweiyin318 authored Dec 8, 2023
1 parent 8474972 commit 00d2026
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions charts/cluster-proxy/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ spec:
- --leader-elect=true
- --signer-secret-namespace={{ .Release.Namespace }}
- --agent-install-all=true
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsNonRoot: true
readOnlyRootFilesystem: true
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ spec:
{{- range .Values.additionalProxyAgentArgs }}
- {{ . }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsNonRoot: true
readOnlyRootFilesystem: true
volumeMounts:
- name: ca
mountPath: /etc/ca
Expand All @@ -75,6 +83,14 @@ spec:
{{- range .Values.addonAgentArgs }}
- {{ . }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsNonRoot: true
readOnlyRootFilesystem: true
volumeMounts:
- name: hub-kubeconfig
mountPath: /etc/kubeconfig/
Expand Down
9 changes: 9 additions & 0 deletions pkg/proxyserver/controllers/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ func newProxyServerDeployment(config *proxyv1alpha1.ManagedProxyConfiguration) *
"--cluster-cert=/etc/agent-pki/tls.crt",
"--cluster-key=/etc/agent-pki/tls.key",
}, config.Spec.ProxyServer.AdditionalArgs...),
SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Privileged: pointer.Bool(false),
RunAsNonRoot: pointer.Bool(true),
ReadOnlyRootFilesystem: pointer.Bool(true),
AllowPrivilegeEscalation: pointer.Bool(false),
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "proxy-server-ca-certs",
Expand Down

0 comments on commit 00d2026

Please sign in to comment.