Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit 305e848

Browse files
TzlilSwimmer123teselil
and
teselil
authored
fix: make cel expression policy work (#963)
Co-authored-by: teselil <[email protected]>
1 parent 68a198d commit 305e848

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/CEL/policy.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ policies:
33
- name: CEL_policy
44
isDefault: true
55
rules:
6-
- identifier: CUSTOM_DEPLOYMENT_BILLING_LABEL_EXISTS
6+
- identifier: CUSTOM_WORKLOADS_BILLING_LABEL_EXISTS
77
messageOnFailure: "workloads labels should contain billing label"
88
- identifier: CUSTOM_SECRET_ENVIRONMENT_LABEL_EXISTS
99
messageOnFailure: "secret labels should contain environment label"
@@ -24,9 +24,9 @@ customRules:
2424
- Pod
2525
then:
2626
CELDefinition:
27-
- expression: "object.kind != 'Deployment' || (has(object.metadata.labels) && has(object.metadata.labels.billing))"
27+
- expression: "has(object.metadata.labels) && has(object.metadata.labels.billing)"
2828
message: "deployment labels should contain billing label"
29-
- expression: "object.kind != 'Pod' || (has(object.metadata.labels) && has(object.metadata.labels.billing))"
29+
- expression: "has(object.metadata.labels) && has(object.metadata.labels.billing)"
3030
message: "pod labels should contain billing label"
3131
- identifier: CUSTOM_SECRET_ENVIRONMENT_LABEL_EXISTS
3232
name: Ensure Secret has environment label [CUSTOM RULE]

0 commit comments

Comments
 (0)