Skip to content

Commit 584ada8

Browse files
Update Ansible sample to comply with Pod Security Standards (#5853)
* 🌱 update Ansible sample to show how the Pods/Containers should be configured as restrictive * fix nit format
1 parent bf3bc89 commit 584ada8

File tree

2 files changed

+18
-0
lines changed
  • hack/generate/samples/internal/ansible
  • testdata/ansible/memcached-operator/roles/memcached/tasks

2 files changed

+18
-0
lines changed

hack/generate/samples/internal/ansible/constants.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const roleFragment = `
2626
labels:
2727
app: memcached
2828
spec:
29+
securityContext:
30+
runAsNonRoot: true
31+
seccompProfile:
32+
type: RuntimeDefault
2933
replicas: "{{size}}"
3034
selector:
3135
matchLabels:
@@ -37,6 +41,11 @@ const roleFragment = `
3741
spec:
3842
containers:
3943
- name: memcached
44+
securityContext:
45+
allowPrivilegeEscalation: false
46+
capabilities:
47+
drop:
48+
- "ALL"
4049
command:
4150
- memcached
4251
- -m=64

testdata/ansible/memcached-operator/roles/memcached/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
labels:
1212
app: memcached
1313
spec:
14+
securityContext:
15+
runAsNonRoot: true
16+
seccompProfile:
17+
type: RuntimeDefault
1418
replicas: "{{size}}"
1519
selector:
1620
matchLabels:
@@ -22,6 +26,11 @@
2226
spec:
2327
containers:
2428
- name: memcached
29+
securityContext:
30+
allowPrivilegeEscalation: false
31+
capabilities:
32+
drop:
33+
- "ALL"
2534
command:
2635
- memcached
2736
- -m=64

0 commit comments

Comments
 (0)