homelab-gitops/platform/kyverno/policies/50-cleanup/cleanup-terminal-pods.yaml
gwg313 baa0216960
add kyverno policies
Signed-off-by: gwg313 <gwg313@pm.me>
2026-05-28 20:09:06 -04:00

24 lines
496 B
YAML

apiVersion: kyverno.io/v2beta1
kind: ClusterCleanupPolicy
metadata:
name: cleanup-terminal-pods
spec:
match:
any:
- resources:
kinds:
- Pod
conditions:
all:
- key: "{{ target.status.phase }}"
operator: AnyIn
value:
- Succeeded
- Failed
- key: "{{ time_diff('{{ target.metadata.creationTimestamp }}','{{ time_now_utc() }}') }}"
operator: GreaterThan
value: 30m
schedule: "*/15 * * * *"