Files
kyverno-2026-example/06-monitoring/02-debugging/test-pols/policy-require-labels.yaml
T
2026-05-19 16:37:43 +07:00

27 lines
721 B
YAML
Raw 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/v1
kind: ClusterPolicy
metadata:
name: require-labels-demo
annotations:
policies.kyverno.io/title: "DEMO: Требовать обязательные labels"
policies.kyverno.io/description: >-
Демонстрационная политика для урока 6.2.
Проверяет наличие labels 'app' и 'owner' у Pod.
spec:
validationFailureAction: Audit
background: true
rules:
- name: check-required-labels
match:
any:
- resources:
kinds:
- Pod
validate:
message: "Pod must have labels 'app' and 'owner'."
pattern:
metadata:
labels:
app: "?*"
owner: "?*"