Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
gwg313 2026-05-17 12:44:19 -04:00
parent bfe8435665
commit 8d74a625bc
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
37 changed files with 224 additions and 103 deletions

View file

@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kyverno:cleanup-pods
labels:
rbac.kyverno.io/aggregate-to-cleanup-controller: "true"
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "delete"]

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- purge-terminal-pods.yaml
- cleanup-rbac.yaml

View file

@ -0,0 +1,21 @@
apiVersion: kyverno.io/v2beta1
kind: ClusterCleanupPolicy
metadata:
name: purge-terminal-pods
spec:
match:
any:
- resources:
kinds:
- Pod
schedule: "*/15 * * * *"
conditions:
all:
- key: "{{ request.object.status.phase }}"
operator: AnyIn
value:
- Succeeded
- Failed
- key: "{{ request.object.metadata.creationTimestamp }}"
operator: DurationGreaterThan
value: 30m