Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds psp for hephaestus manager #54

Merged
merged 1 commit into from
Aug 16, 2022
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
7 changes: 7 additions & 0 deletions deployments/helm/hephaestus/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{{/*
Return the controller manager name.
*/}}
{{- define "hephaestus.manager.name" -}}
{{ include "common.names.fullname" . }}-manager
{{- end }}

{{/*
Return the controller manager image name.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ rules:
verbs:
- list
- watch
{{- if or (include "hephaestus.pspRequired" .) (include "hephaestus.istioWithoutCNI" .) }}
{{- if include "hephaestus.pspRequired" . }}
- apiGroups:
- policy
resources:
- podsecuritypolicies
resourceNames:
- {{ include "hephaestus.manager.name" . }}
verbs:
- use
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}-manager
name: {{ include "hephaestus.manager.name" . }}
labels:
{{- include "hephaestus.controller.labels.standard" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if include "hephaestus.pspRequired" . }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ include "hephaestus.manager.name" . }}
labels:
{{- include "hephaestus.controller.labels.standard" . | nindent 4 }}
spec:
allowPrivilegeEscalation: false
fsGroup:
ranges:
- max: 65535
min: 1
rule: MustRunAs
{{- if include "hephaestus.istioWithoutCNI" . }}
allowedCapabilities:
- NET_ADMIN
- NET_RAW
{{- else }}
requiredDropCapabilities:
- ALL
{{- end }}
runAsUser:
rule: {{ if include "hephaestus.istioWithoutCNI" . }}RunAsAny{{ else }}MustRunAsNonRoot{{ end }}
seLinux:
rule: RunAsAny
supplementalGroups:
ranges:
- max: 65535
min: 1
rule: MustRunAs
volumes:
- configMap
- emptyDir
- projected
- secret
- downwardAPI
- persistentVolumeClaim
{{- end }}