2023-11-23 00:46:44 +02:00
|
|
|
apiVersion: kyverno.io/v1
|
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: allowed-annotations
|
|
|
|
status:
|
|
|
|
autogen:
|
|
|
|
rules:
|
|
|
|
- match:
|
|
|
|
any:
|
|
|
|
- resources:
|
|
|
|
kinds:
|
|
|
|
- DaemonSet
|
|
|
|
- Deployment
|
|
|
|
- Job
|
|
|
|
- ReplicaSet
|
|
|
|
- ReplicationController
|
2024-04-30 20:26:12 +08:00
|
|
|
- StatefulSet
|
2023-11-23 00:46:44 +02:00
|
|
|
name: autogen-allowed-fluxcd-annotations
|
|
|
|
validate:
|
|
|
|
deny:
|
|
|
|
conditions:
|
|
|
|
all:
|
|
|
|
- key: '{{ request.object.spec.template.metadata.annotations.keys(@)[?contains(@, ''fluxcd.io/'')] }}'
|
|
|
|
operator: AnyNotIn
|
|
|
|
value:
|
|
|
|
- fluxcd.io/cow
|
|
|
|
- fluxcd.io/dog
|
|
|
|
message: The only approved FluxCD annotations are `fluxcd.io/cow` and `fluxcd.io/dog`.
|
2024-08-27 23:07:57 +03:00
|
|
|
failureAction: Enforce
|
2023-11-23 00:46:44 +02:00
|
|
|
- match:
|
|
|
|
any:
|
|
|
|
- resources:
|
|
|
|
kinds:
|
|
|
|
- CronJob
|
|
|
|
name: autogen-cronjob-allowed-fluxcd-annotations
|
|
|
|
validate:
|
|
|
|
deny:
|
|
|
|
conditions:
|
|
|
|
all:
|
|
|
|
- key: '{{ request.object.spec.jobTemplate.spec.template.metadata.annotations.keys(@)[?contains(@, ''fluxcd.io/'')] }}'
|
|
|
|
operator: AnyNotIn
|
|
|
|
value:
|
|
|
|
- fluxcd.io/cow
|
|
|
|
- fluxcd.io/dog
|
|
|
|
message: The only approved FluxCD annotations are `fluxcd.io/cow` and `fluxcd.io/dog`.
|
2024-08-27 23:07:57 +03:00
|
|
|
failureAction: Enforce
|