2023-09-18 00:24:26 +02:00
|
|
|
---
|
2020-11-11 20:17:48 -05:00
|
|
|
apiVersion: kyverno.io/v1
|
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: require-certain-labels
|
|
|
|
spec:
|
2023-09-18 00:24:26 +02:00
|
|
|
admission: true
|
|
|
|
background: true
|
2020-11-11 20:17:48 -05:00
|
|
|
rules:
|
2023-09-18 00:24:26 +02:00
|
|
|
- match:
|
|
|
|
any:
|
|
|
|
- resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
name: validate-certain-labels
|
2020-11-11 20:17:48 -05:00
|
|
|
validate:
|
|
|
|
anyPattern:
|
|
|
|
- metadata:
|
|
|
|
labels:
|
2023-09-18 00:24:26 +02:00
|
|
|
app.kubernetes.io/name: ?*
|
2020-11-11 20:17:48 -05:00
|
|
|
- metadata:
|
|
|
|
labels:
|
2023-09-18 00:24:26 +02:00
|
|
|
app.kubernetes.io/component: ?*
|
|
|
|
message: The label `app.kubernetes.io/name` or `app.kubernetes.io/component`
|
|
|
|
is required.
|
|
|
|
validationFailureAction: Audit
|