Skip to content

Commit 6c6ba9a

Browse files
committed
Remove deprecated PodSecurityPolicy
1 parent 604350a commit 6c6ba9a

File tree

9 files changed

+28
-244
lines changed

9 files changed

+28
-244
lines changed

charts/sourcegraph/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ In addition to the documented values, all services also support the following va
4646
| cadvisor.image.defaultTag | string | `"6.0.0@sha256:48082a2822a727e22c556ae2c3bae5f5bf4528c7b462efc3c085271ee5145be8"` | Docker image tag for the `cadvisor` image |
4747
| cadvisor.image.name | string | `"cadvisor"` | Docker image name for the `cadvisor` image |
4848
| cadvisor.name | string | `"cadvisor"` | Name used by resources. Does not affect service names or PVCs. |
49-
| cadvisor.podSecurityPolicy.enabled | bool | `false` | Enable [PodSecurityPolicy](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) for `cadvisor` pods |
5049
| cadvisor.resources | object | `{"limits":{"cpu":"300m","memory":"2000Mi"},"requests":{"cpu":"150m","memory":"200Mi"}}` | Resource requests & limits for the `cadvisor` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
5150
| cadvisor.serviceAccount.create | bool | `true` | Enable creation of ServiceAccount for `cadvisor` |
5251
| cadvisor.serviceAccount.name | string | `"cadvisor"` | Name of the ServiceAccount to be created or an existing ServiceAccount |
@@ -188,7 +187,6 @@ In addition to the documented values, all services also support the following va
188187
| nodeExporter.image.name | string | `"node-exporter"` | Docker image name for the `node-exporter` image |
189188
| nodeExporter.name | string | `"node-exporter"` | Name used by resources. Does not affect service names or PVCs. |
190189
| nodeExporter.podSecurityContext | object | `{"fsGroup":65534,"runAsGroup":65534,"runAsNonRoot":true,"runAsUser":65534}` | Security context for the `node-exporter` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
191-
| nodeExporter.podSecurityPolicy.enabled | bool | `false` | Enable [PodSecurityPolicy](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) for `node-exporter` pods |
192190
| nodeExporter.resources | object | `{"limits":{"cpu":"1","memory":"1Gi"},"requests":{"cpu":".2","memory":"100Mi"}}` | Resource requests & limits for the `node-exporter` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
193191
| nodeExporter.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `node-exporter` |
194192
| nodeExporter.serviceAccount.name | string | `"node-exporter"` | Name of the ServiceAccount to be created or an existing ServiceAccount |

charts/sourcegraph/templates/cadvisor/cadvisor.ClusterRole.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

charts/sourcegraph/templates/cadvisor/cadvisor.ClusterRoleBinding.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

charts/sourcegraph/templates/cadvisor/cadvisor.PodSecurityPolicy.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

charts/sourcegraph/templates/node-exporter/node-exporter.ClusterRole.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

charts/sourcegraph/templates/node-exporter/node-exporter.ClusterRoleBinding.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

charts/sourcegraph/templates/node-exporter/node-exporter.PodSecurityPolicy.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 28 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
suite: nodeExporter
22
templates:
33
- NOTES.txt
4-
- node-exporter/node-exporter.ClusterRole.yaml
5-
- node-exporter/node-exporter.ClusterRoleBinding.yaml
64
- node-exporter/node-exporter.DaemonSet.yaml
7-
- node-exporter/node-exporter.PodSecurityPolicy.yaml
85
- node-exporter/node-exporter.Service.yaml
96
- node-exporter/node-exporter.ServiceAccount.yaml
107
tests:
118
- it: should render the DaemonSet and Service if node-exporter is enabled
12-
set:
9+
set:
1310
nodeExporter:
1411
enabled: true
1512
asserts:
@@ -25,66 +22,37 @@ tests:
2522
template: node-exporter/node-exporter.Service.yaml
2623

2724
- it: should not render any resources if node-exporter is disabled
28-
set:
25+
set:
2926
nodeExporter:
3027
enabled: false
3128
asserts:
32-
- hasDocuments:
29+
- hasDocuments:
3330
count: 0
3431
templates:
35-
- node-exporter/node-exporter.ClusterRole.yaml
36-
- node-exporter/node-exporter.ClusterRoleBinding.yaml
3732
- node-exporter/node-exporter.DaemonSet.yaml
38-
- node-exporter/node-exporter.PodSecurityPolicy.yaml
3933
- node-exporter/node-exporter.Service.yaml
4034
- node-exporter/node-exporter.ServiceAccount.yaml
4135

42-
- it: should not render the PodSecurityPolicy, Service Accounts, and ClusterRoles by default
36+
- it: should not render the Service Accounts by default
4337
asserts:
44-
- hasDocuments:
45-
count: 0
46-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
47-
- hasDocuments:
48-
count: 0
49-
template: node-exporter/node-exporter.ClusterRole.yaml
50-
- hasDocuments:
51-
count: 0
52-
template: node-exporter/node-exporter.ClusterRoleBinding.yaml
53-
- hasDocuments:
38+
- hasDocuments:
5439
count: 0
5540
template: node-exporter/node-exporter.ServiceAccount.yaml
5641

57-
- it: should render the PodSecurityPolicy, ServiceAccounts, and ClusterRoles if PodSecurityPolicy + Service Accounts are enabled
58-
set:
42+
- it: should render the ServiceAccounts if Service Accounts are enabled
43+
set:
5944
nodeExporter:
6045
serviceAccount:
6146
create: true
62-
podSecurityPolicy:
63-
enabled: true
6447
asserts:
65-
- containsDocument:
66-
kind: PodSecurityPolicy
67-
apiVersion: policy/v1beta1
68-
name: node-exporter
69-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
7048
- containsDocument:
7149
kind: ServiceAccount
7250
apiVersion: v1
7351
name: node-exporter
7452
template: node-exporter/node-exporter.ServiceAccount.yaml
75-
- containsDocument:
76-
kind: ClusterRole
77-
apiVersion: rbac.authorization.k8s.io/v1
78-
name: node-exporter
79-
template: node-exporter/node-exporter.ClusterRole.yaml
80-
- containsDocument:
81-
kind: ClusterRoleBinding
82-
apiVersion: rbac.authorization.k8s.io/v1
83-
name: node-exporter
84-
template: node-exporter/node-exporter.ClusterRoleBinding.yaml
85-
53+
8654
- it: should add the ServiceAccount name to the DaemonSet spec if the ServiceAccount is enabled
87-
set:
55+
set:
8856
nodeExporter:
8957
serviceAccount:
9058
create: true
@@ -94,9 +62,9 @@ tests:
9462
path: spec.template.spec.serviceAccountName
9563
value: "test-service-account-name"
9664
template: node-exporter/node-exporter.DaemonSet.yaml
97-
65+
9866
- it: should add not the ServiceAccount name to the DaemonSet spec if the ServiceAccount is disabled
99-
set:
67+
set:
10068
nodeExporter:
10169
serviceAccount:
10270
create: false
@@ -105,95 +73,52 @@ tests:
10573
- notExists:
10674
path: spec.template.spec.serviceAccountName
10775
template: node-exporter/node-exporter.DaemonSet.yaml
108-
109-
- it: should fail to render if the PodSecurityPolicy is enabled, but the ServiceAccount isn't
110-
set:
111-
nodeExporter:
112-
serviceAccount:
113-
create: false
114-
podSecurityPolicy:
115-
enabled: true
116-
asserts:
117-
- failedTemplate:
118-
errorMessage: "Node Exporter's service account must be enabled in order to use its pod security policy (set 'nodeExporter.ServiceAccount.create' to true)"
119-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
12076

121-
- it: should not render the podSecurityPolicy if disabled
122-
set:
123-
nodeExporter:
124-
podSecurityPolicy:
125-
enabled: false
126-
asserts:
127-
- hasDocuments:
128-
count: 0
129-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
130-
131-
- it: should ensure that the namespace is properly propagated to the cluster role binding
132-
release:
133-
namespace: "my-test-namespace"
77+
- it: should have hostPID enabled by default
13478
set:
13579
nodeExporter:
13680
serviceAccount:
13781
create: true
138-
podSecurityPolicy:
139-
enabled: true
14082
asserts:
14183
- equal:
142-
path: subjects[0].namespace
143-
value: "my-test-namespace"
144-
template: node-exporter/node-exporter.ClusterRoleBinding.yaml
145-
146-
- it: should have hostPID enabled by default
147-
set:
148-
nodeExporter:
149-
# (these settings are unrelated to host pid defaults, they're just for ensuring that PodSecurityPolicy gets rendered so that we can check them in same test)
150-
serviceAccount:
151-
create: true
152-
podSecurityPolicy:
153-
enabled: true
154-
asserts:
155-
- equal:
15684
path: spec.template.spec.hostPID
15785
value: true
15886
template: node-exporter/node-exporter.DaemonSet.yaml
159-
- equal:
160-
path: spec.hostPID
87+
- equal:
88+
path: spec.template.spec.hostPID
16189
value: true
162-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
163-
164-
- it: should propagate host PID settings to both the daemonset and podSecurityPolicy
90+
template: node-exporter/node-exporter.DaemonSet.yaml
91+
92+
- it: should propagate host PID settings to the daemonset
16593
set:
16694
nodeExporter:
16795
hostPID: false
168-
# (these settings are unrelated to host pid defaults, they're just for ensuring that PodSecurityPolicy gets rendered so that we can check them in same test)
16996
serviceAccount:
17097
create: true
171-
podSecurityPolicy:
172-
enabled: true
173-
asserts:
174-
- equal:
98+
asserts:
99+
- equal:
175100
path: spec.template.spec.hostPID
176101
value: false
177102
template: node-exporter/node-exporter.DaemonSet.yaml
178-
- equal:
179-
path: spec.hostPID
103+
- equal:
104+
path: spec.template.spec.hostPID
180105
value: false
181-
template: node-exporter/node-exporter.PodSecurityPolicy.yaml
106+
template: node-exporter/node-exporter.DaemonSet.yaml
182107

183108
- it: should not generate warnings if node-exporter is enabled
184109
set:
185110
nodeExporter:
186111
enabled: true
187-
asserts:
112+
asserts:
188113
- notMatchRegexRaw:
189114
pattern: You have set 'nodeExporter.enabled' to 'false'
190115
template: NOTES.txt
191-
116+
192117
- it: should generate warnings if node-exporter is disabled
193118
set:
194119
nodeExporter:
195120
enabled: false
196-
asserts:
121+
asserts:
197122
- matchRegexRaw:
198123
pattern: You have set 'nodeExporter.enabled' to 'false'
199124
template: NOTES.txt
@@ -202,16 +127,16 @@ tests:
202127
set:
203128
nodeExporter:
204129
hostPID: true
205-
asserts:
130+
asserts:
206131
- notMatchRegexRaw:
207132
pattern: You have set 'nodeExporter.hostPID' to 'false'
208133
template: NOTES.txt
209134

210-
- it: should generate warnings if hostPID is false
135+
- it: should generate warnings if hostPID is false
211136
set:
212137
nodeExporter:
213138
hostPID: false
214-
asserts:
139+
asserts:
215140
- matchRegexRaw:
216141
pattern: You have set 'nodeExporter.hostPID' to 'false'
217142
template: NOTES.txt

0 commit comments

Comments
 (0)