Skip to content

Commit

Permalink
update deployment securityContext
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Yin <[email protected]>
  • Loading branch information
zhiweiyin318 committed Dec 6, 2023
1 parent 8474972 commit 3a4b944
Show file tree
Hide file tree
Showing 3 changed files with 43 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
19 changes: 19 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: falsePtr(),
RunAsNonRoot: truePtr(),
ReadOnlyRootFilesystem: truePtr(),
AllowPrivilegeEscalation: falsePtr(),
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "proxy-server-ca-certs",
Expand Down Expand Up @@ -220,3 +229,13 @@ func newProxyServerRoleBinding(config *proxyv1alpha1.ManagedProxyConfiguration)
}

}

func truePtr() *bool {
t := true
return &t
}

func falsePtr() *bool {
t := false
return &t
}

0 comments on commit 3a4b944

Please sign in to comment.