Skip to content

Commit

Permalink
Merge pull request #418 from invidian/psp
Browse files Browse the repository at this point in the history
charts/descheduler: add PodSecurityPolicy support
  • Loading branch information
k8s-ci-robot authored Oct 22, 2020
2 parents cfc4cce + f9e9f06 commit 3399619
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/descheduler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ The following table lists the configurable parameters of the _descheduler_ chart
| `deschedulerPolicy.strategies` | The _descheduler_ strategies to apply | _see values.yaml_ |
| `priorityClassName` | The name of the priority class to add to pods | `system-cluster-critical` |
| `rbac.create` | If `true`, create & use RBAC resources | `true` |
| `podSecurityPolicy.create` | If `true`, create PodSecurityPolicy | `true` |
| `serviceAccount.create` | If `true`, create a service account for the cron job | `true` |
| `serviceAccount.name` | The name of the service account to use, if not set and create is true a name is generated using the fullname template | `nil` |
7 changes: 7 additions & 0 deletions charts/descheduler/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ rules:
- apiGroups: ["scheduling.k8s.io"]
resources: ["priorityclasses"]
verbs: ["get", "watch", "list"]
{{- if .Values.podSecurityPolicy.create }}
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- {{ template "descheduler.fullname" . }}
{{- end }}
{{- end -}}
38 changes: 38 additions & 0 deletions charts/descheduler/templates/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.podSecurityPolicy.create -}}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "descheduler.fullname" . }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default,runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
privileged: false
allowPrivilegeEscalation: false
requiredDropCapabilities:
- ALL
volumes:
- 'configMap'
- 'secret'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
rule: 'MustRunAs'
ranges:
- min: 1
max: 65535
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
- min: 1
max: 65535
readOnlyRootFilesystem: true
{{- end -}}
4 changes: 4 additions & 0 deletions charts/descheduler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ rbac:
# Specifies whether RBAC resources should be created
create: true

podSecurityPolicy:
# Specifies whether PodSecurityPolicy should be created.
create: true

serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
Expand Down

0 comments on commit 3399619

Please sign in to comment.