Files
kyverno-2026-example/04-generation/02-lifecycle/cleanup-debug-pods.yaml
2026-04-08 20:22:14 +07:00

30 lines
973 B
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
apiVersion: kyverno.io/v2alpha1
kind: ClusterCleanupPolicy
metadata:
name: cleanup-debug-pods
annotations:
policies.kyverno.io/title: "Автоудаление debug подов"
policies.kyverno.io/category: Governance
policies.kyverno.io/severity: low
policies.kyverno.io/description: >-
Удаляет поды с лейблом purpose=debug старше 4 часов.
Запускается каждый час по расписанию.
Предотвращает накопление забытых отладочных подов в кластере.
spec:
schedule: "0 * * * *" # каждый час в :00
match:
resources:
kinds:
- Pod
namespaces:
- default
- staging
selector:
matchLabels:
purpose: debug
conditions:
any:
- key: "{{ time_since('', request.object.metadata.creationTimestamp, '') }}"
operator: GreaterThan
value: "4h"