Skip to content

Commit e26ad5c

Browse files
authored
Merge pull request #1188 from snyk/feat/remove-psp
feat: remove pod security policy as it is deprecated by Kubernetes
2 parents 099e769 + 1e9ec7f commit e26ad5c

File tree

10 files changed

+0
-129
lines changed

10 files changed

+0
-129
lines changed

snyk-monitor/README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,6 @@ For example, run the following for first-time setup:
220220
And run the following for subsequent upgrades:
221221
`--set pvc.enabled=true`
222222

223-
## PodSecurityPolicies
224-
**This should not be used when installing on OpenShift.**
225-
226-
Using PodSecurityPolicies can be achieved by setting the following values in the Helm chart:
227-
* psp.enabled - default is `false`. Set to `true` if PodSecurityPolicy is needed
228-
* psp.name - default is empty. Leave it empty if you want us to install the necessary PodSecurityPolicy. Modify it to specify an existing PodSecurityPolicy rather than creating a new one.
229-
230-
For example:
231-
```shell
232-
helm upgrade --install snyk-monitor snyk-charts/snyk-monitor \
233-
--namespace snyk-monitor \
234-
--set clusterName="Production cluster" \
235-
--set psp.enabled=true
236-
```
237-
238223
## Configuring excluded namespaces ##
239224

240225
By default, `snyk-monitor` does not scan containers that are internal to Kubernetes, in the following namespaces:

snyk-monitor/templates/clusterrole.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,4 @@ rules:
6969
- get
7070
- list
7171
- watch
72-
{{- if .Values.psp.enabled }}
73-
- apiGroups:
74-
- policy
75-
resources:
76-
- podsecuritypolicies
77-
verbs:
78-
- get
79-
- list
80-
- use
81-
resourceNames:
82-
- {{ if eq .Values.psp.name "" }}{{ include "snyk-monitor.name" . }}{{ else }}{{ .Values.psp.name }}{{- end }}
83-
{{- end }}
8472
{{- end }}

snyk-monitor/templates/psp.yaml

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

snyk-monitor/templates/role.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,4 @@ rules:
6969
- get
7070
- list
7171
- watch
72-
{{- if .Values.psp.enabled }}
73-
- apiGroups:
74-
- policy
75-
resources:
76-
- podsecuritypolicies
77-
verbs:
78-
- get
79-
- list
80-
- use
81-
resourceNames:
82-
- {{ if eq .Values.psp.name "" }}{{ include "snyk-monitor.name" . }}{{ else }}{{ .Values.psp.name }}{{- end }}
83-
{{- end }}
8472
{{- end }}

snyk-monitor/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ networkPolicy:
113113
egress:
114114
- {}
115115

116-
psp:
117-
enabled: false
118-
name: ""
119-
120116
# Override the excluded namespaces
121117
excludedNamespaces:
122118

snyk-operator-certified/helm-charts/snyk-monitor/README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,6 @@ For example, run the following for first-time setup:
171171
And run the following for subsequent upgrades:
172172
`--set pvc.enabled=true`
173173

174-
## PodSecurityPolicies
175-
**This should not be used when installing on OpenShift.**
176-
177-
Using PodSecurityPolicies can be achieved by setting the following values in the Helm chart:
178-
* psp.enabled - default is `false`. Set to `true` if PodSecurityPolicy is needed
179-
* psp.name - default is empty. Leave it empty if you want us to install the necessary PodSecurityPolicy. Modify it to specify an existing PodSecurityPolicy rather than creating a new one.
180-
181-
For example:
182-
```shell
183-
helm upgrade --install snyk-monitor snyk-charts/snyk-monitor \
184-
--namespace snyk-monitor \
185-
--set clusterName="Production cluster" \
186-
--set psp.enabled=true
187-
```
188-
189174
## Configuring excluded namespaces ##
190175

191176
By default, `snyk-monitor` does not scan containers that are internal to Kubernetes, in the following namespaces:

snyk-operator-certified/helm-charts/snyk-monitor/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,5 @@ log_level:
9191

9292
nodeSelector: {}
9393

94-
psp:
95-
enabled: false
96-
name: ""
97-
9894
# Override the excluded namespaces
9995
excludedNamespaces:

test/helpers/kubectl.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,3 @@ async function getLatestStableK8sRelease(): Promise<string> {
343343
console.log(`The latest stable K8s release is ${k8sRelease}`);
344344
return k8sRelease;
345345
}
346-
347-
export async function verifyPodSecurityPolicy(name: string): Promise<boolean> {
348-
console.log(`Trying to find Pod Security Policy ${name}`);
349-
for (let attempt = 0; attempt < 60; attempt++) {
350-
try {
351-
await exec(`./kubectl get podsecuritypolicy ${name}`);
352-
return true;
353-
} catch (err) {
354-
await sleep(500);
355-
}
356-
}
357-
return false;
358-
}

test/integration/kubernetes.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -732,18 +732,6 @@ test('snyk-monitor has nodeSelector', async () => {
732732
);
733733
});
734734

735-
test('snyk-monitor has PodSecurityPolicy', async () => {
736-
if (process.env['DEPLOYMENT_TYPE'] !== 'Helm') {
737-
console.log(
738-
"Not testing PodSecurityPolicy because we're not installing with Helm",
739-
);
740-
return;
741-
}
742-
743-
const pspExists = await kubectl.verifyPodSecurityPolicy('snyk-monitor');
744-
expect(pspExists).toBeTruthy();
745-
});
746-
747735
test('snyk-monitor secure configuration is as expected', async () => {
748736
const kubeConfig = new KubeConfig();
749737
kubeConfig.loadFromDefault();

test/setup/deployers/helm.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async function deployKubernetesMonitor(
3131
`--set image.pullPolicy=${imagePullPolicy} ` +
3232
'--set integrationApi=https://kubernetes-upstream.dev.snyk.io ' +
3333
'--set nodeSelector."kubernetes\\.io/os"=linux ' +
34-
'--set psp.enabled=true ' +
3534
'--set pvc.enabled=true ' +
3635
'--set pvc.create=true ' +
3736
'--set log_level="INFO" ' +

0 commit comments

Comments
 (0)