Skip to content

Commit aaa1880

Browse files
authored
Merge pull request #73 from weargoggles/podsecuritypolicy-support
Support for PodSecurityPolicies
2 parents b27b219 + 72d5b14 commit aaa1880

18 files changed

+138
-0
lines changed

helm/generated_examples/baremetal-cleanbyjobs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,7 @@ roleRef:
189189
# Source: provisioner/templates/namespace.yaml
190190

191191

192+
---
193+
# Source: provisioner/templates/pod-security-policy.yaml
194+
195+

helm/generated_examples/baremetal-namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ roleRef:
161161
name: local-storage-provisioner-node-clusterrole
162162
apiGroup: rbac.authorization.k8s.io
163163

164+
---
165+
# Source: provisioner/templates/pod-security-policy.yaml
166+
167+

helm/generated_examples/baremetal-nodeselector.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,7 @@ roleRef:
156156
# Source: provisioner/templates/namespace.yaml
157157

158158

159+
---
160+
# Source: provisioner/templates/pod-security-policy.yaml
161+
162+

helm/generated_examples/baremetal-priority-critical.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,7 @@ roleRef:
155155
# Source: provisioner/templates/namespace.yaml
156156

157157

158+
---
159+
# Source: provisioner/templates/pod-security-policy.yaml
160+
161+

helm/generated_examples/baremetal-priority-noncritical.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,7 @@ roleRef:
155155
# Source: provisioner/templates/namespace.yaml
156156

157157

158+
---
159+
# Source: provisioner/templates/pod-security-policy.yaml
160+
161+

helm/generated_examples/baremetal-prometheus.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,7 @@ roleRef:
201201
# Source: provisioner/templates/namespace.yaml
202202

203203

204+
---
205+
# Source: provisioner/templates/pod-security-policy.yaml
206+
207+

helm/generated_examples/baremetal-resyncperiod.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,7 @@ roleRef:
154154
# Source: provisioner/templates/namespace.yaml
155155

156156

157+
---
158+
# Source: provisioner/templates/pod-security-policy.yaml
159+
160+

helm/generated_examples/baremetal-tolerations.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@ roleRef:
157157
# Source: provisioner/templates/namespace.yaml
158158

159159

160+
---
161+
# Source: provisioner/templates/pod-security-policy.yaml
162+
163+

helm/generated_examples/baremetal-with-resource-limits.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ roleRef:
161161
# Source: provisioner/templates/namespace.yaml
162162

163163

164+
---
165+
# Source: provisioner/templates/pod-security-policy.yaml
166+
167+

helm/generated_examples/baremetal-without-rbac.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ reclaimPolicy: Delete
9090
# Source: provisioner/templates/namespace.yaml
9191

9292

93+
---
94+
# Source: provisioner/templates/pod-security-policy.yaml
95+
96+
9397
---
9498
# Source: provisioner/templates/provisioner-cluster-role-binding.yaml
9599

helm/generated_examples/baremetal.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,7 @@ roleRef:
154154
# Source: provisioner/templates/namespace.yaml
155155

156156

157+
---
158+
# Source: provisioner/templates/pod-security-policy.yaml
159+
160+

helm/generated_examples/gce-pre1.9.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,7 @@ roleRef:
152152
# Source: provisioner/templates/namespace.yaml
153153

154154

155+
---
156+
# Source: provisioner/templates/pod-security-policy.yaml
157+
158+

helm/generated_examples/gce-retain.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,7 @@ roleRef:
172172
# Source: provisioner/templates/namespace.yaml
173173

174174

175+
---
176+
# Source: provisioner/templates/pod-security-policy.yaml
177+
178+

helm/generated_examples/gce.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,7 @@ roleRef:
172172
# Source: provisioner/templates/namespace.yaml
173173

174174

175+
---
176+
# Source: provisioner/templates/pod-security-policy.yaml
177+
178+

helm/generated_examples/gke.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,7 @@ roleRef:
151151
# Source: provisioner/templates/namespace.yaml
152152

153153

154+
---
155+
# Source: provisioner/templates/pod-security-policy.yaml
156+
157+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- if .Values.common.podSecurityPolicy -}}
2+
apiVersion: policy/v1beta1
3+
kind: PodSecurityPolicy
4+
metadata:
5+
name: local-storage-provisioner-pod-security-policy
6+
labels:
7+
heritage: {{ .Release.Service | quote }}
8+
release: {{ .Release.Name | quote }}
9+
chart: {{ replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name }}
10+
spec:
11+
allowedHostPaths:
12+
- pathPrefix: /dev
13+
{{- range $classConfig := .Values.classes }}
14+
- pathPrefix: {{ $classConfig.hostDir }}
15+
{{- end }}
16+
allowPrivilegeEscalation: false
17+
fsGroup:
18+
rule: RunAsAny
19+
privileged: true
20+
requiredDropCapabilities:
21+
- ALL
22+
runAsUser:
23+
ranges:
24+
- max: 65535
25+
min: 1
26+
rule: MustRunAs
27+
seLinux:
28+
rule: RunAsAny
29+
supplementalGroups:
30+
rule: RunAsAny
31+
volumes:
32+
- configMap
33+
- secret
34+
- hostPath
35+
{{- end }}

helm/provisioner/templates/provisioner-cluster-role-binding.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,43 @@ roleRef:
8282
name: local-storage-provisioner-jobs-role
8383
apiGroup: rbac.authorization.k8s.io
8484
{{- end }}
85+
{{- if .Values.common.podSecurityPolicy }}
86+
---
87+
apiVersion: rbac.authorization.k8s.io/v1
88+
kind: Role
89+
metadata:
90+
name: local-storage-provisioner-psp-role
91+
namespace: {{ .Values.common.namespace }}
92+
labels:
93+
heritage: {{ .Release.Service | quote }}
94+
release: {{ .Release.Name | quote }}
95+
chart: {{ replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name }}
96+
rules:
97+
- apiGroups:
98+
- policy
99+
resources:
100+
- podsecuritypolicies
101+
resourceNames:
102+
- local-storage-provisioner-pod-security-policy
103+
verbs:
104+
- use
105+
---
106+
apiVersion: rbac.authorization.k8s.io/v1
107+
kind: RoleBinding
108+
metadata:
109+
name: local-storage-provisioner-psp-rolebinding
110+
namespace: {{ .Values.common.namespace }}
111+
labels:
112+
heritage: {{ .Release.Service | quote }}
113+
release: {{ .Release.Name | quote }}
114+
chart: {{ replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name }}
115+
subjects:
116+
- kind: ServiceAccount
117+
name: {{ .Values.daemonset.serviceAccount }}
118+
namespace: {{ .Values.common.namespace }}
119+
roleRef:
120+
kind: Role
121+
name: local-storage-provisioner-psp-role
122+
apiGroup: rbac.authorization.k8s.io
123+
{{- end }}
85124
{{- end }}

helm/provisioner/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ common:
3737
# Defines the name of configmap used by Provisioner
3838
#
3939
configMapName: "local-provisioner-config"
40+
#
41+
# Enables or disables Pod Security Policy creation and binding
42+
#
43+
podSecurityPolicy: false
4044
#
4145
# Configure storage classes.
4246
#

0 commit comments

Comments
 (0)