Files
litmus-hub/security/kyverno-policies/allow-capabilities-for-litmus-experiments-which-uses-runtime-api.yaml
Shubham Chaudhary 14c472265f chore(kyverno): Adding kyverno pod security policies for litmus pods (#504)
* chore(kyverno): Adding security policies

Signed-off-by: shubham chaudhary <shubham@chaosnative.com>

* chore(kyverno): updating policies

Signed-off-by: shubham chaudhary <shubham@chaosnative.com>

* chore(kyverno): updating policies

Signed-off-by: shubham chaudhary <shubham@chaosnative.com>

* chore(kyverno): changed the file names

Signed-off-by: shubham chaudhary <shubham@chaosnative.com>
2021-10-13 16:00:11 +05:30

35 lines
1.1 KiB
YAML

apiVersion: kyverno.io/v1
kind: Policy
metadata:
name: allow-add-capabilities
annotations:
policies.kyverno.io/category: Pod Security Standards
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Pod
policies.kyverno.io/description: >-
Provides a list of capabilities that are allowed to be added to a container.
spec:
validationFailureAction: audit
background: true
rules:
- name: capabilities
match:
resources:
kinds:
- Pod
selector:
matchLabels:
# applicable for experiments which uses container runtime apis
app.kubernetes.io/runtime-api-usage: "true"
validate:
message: >-
The provided capabilities are not allowed at securityContext.capabilities.add
pattern:
spec:
containers:
- =(securityContext):
=(capabilities):
# allow only NET_ADMIN and SYS_ADMIN capabilities
=(add):
- "NET_ADMIN | SYS_ADMIN"