1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-11 02:16:53 +00:00
kyverno/test/conformance/chainsaw/autogen/assert-autogen/policy-assert.yaml

57 lines
1.3 KiB
YAML
Raw Normal View History

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-default-sa
spec:
validationFailureAction: Audit
rules:
- match:
any:
- resources:
kinds:
- Pod
name: disallow-default-sa
validate:
message: default ServiceAccount should not be used
assert:
object:
spec:
(serviceAccountName == 'default'): false
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready
autogen:
rules:
- match:
any:
- resources:
kinds:
- Deployment
name: autogen-disallow-default-sa
validate:
message: default ServiceAccount should not be used
assert:
object:
spec:
template:
spec:
(serviceAccountName == 'default'): false
- match:
any:
- resources:
kinds:
- CronJob
name: autogen-cronjob-disallow-default-sa
validate:
message: default ServiceAccount should not be used
assert:
object:
spec:
jobTemplate:
spec:
template:
spec:
(serviceAccountName == 'default'): false