Skip to content

Commit

Permalink
gypsydiver/cluster autoscaler trim down psp (helm#15903)
Browse files Browse the repository at this point in the history
* Trim down PodSecurityPolicy

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>

* keep extensions as psp apiGroup

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>

* bump chart version

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>

* keep extensions as psp apiGroup

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>

* add helm labels

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>

* add readme note

Signed-off-by: Fernando Mendoza <fermendozarcs@gmail.com>
  • Loading branch information
gypsydiver authored and kengou committed Sep 18, 2019
1 parent f40b51f commit e2ba8b3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion stable/cluster-autoscaler/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
description: Scales worker nodes within autoscaling groups.
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
name: cluster-autoscaler
version: 2.0.0
version: 3.0.0
appVersion: 1.13.1
home: https://github.com/kubernetes/autoscaler
sources:
Expand Down
4 changes: 4 additions & 0 deletions stable/cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,7 @@ Containers:
--node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster/<ClusterName>
--v=4
```

#### PodSecurityPolicy

Though enough for the majority of installations, the default PodSecurityPolicy _could_ be too restrictive depending on the specifics of your release. Please make sure to check that the template fits with any customizations made or disable it by setting `rbac.pspEnabled` to `false`.
2 changes: 1 addition & 1 deletion stable/cluster-autoscaler/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ rules:
resources:
- podsecuritypolicies
resourceNames:
- privileged-{{ template "cluster-autoscaler.fullname" . }}
- {{ template "cluster-autoscaler.fullname" . }}
verbs:
- use
{{- end -}}
Expand Down
48 changes: 33 additions & 15 deletions stable/cluster-autoscaler/templates/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,43 @@
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: privileged-{{ template "cluster-autoscaler.fullname" . }}
name: {{ template "cluster-autoscaler.fullname" . }}
labels:
{{ include "cluster-autoscaler.labels" . | indent 4 }}
spec:
allowedCapabilities:
- '*'
fsGroup:
rule: RunAsAny
privileged: true
# Prevents running in privileged mode
privileged: false
# Required to prevent escalations to root.
allowPrivilegeEscalation: false
requiredDropCapabilities:
- ALL
volumes:
- 'configMap'
- 'secret'
- 'hostPath'
allowedHostPaths:
- pathPrefix: {{ .Values.sslCertHostPath }}
{{- if eq .Values.cloudProvider "gce" }}
- pathPrefix: {{ .Values.cloudConfigPath }}
{{- end }}
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
volumes:
- '*'
hostPID: true
hostIPC: true
hostNetwork: true
hostPorts:
- min: 1
max: 65536
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
{{- end }}

0 comments on commit e2ba8b3

Please sign in to comment.