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

Commit

Permalink
fix: make cel expression policy work (#963)
Browse files Browse the repository at this point in the history
Co-authored-by: teselil <[email protected]>
  • Loading branch information
TzlilSwimmer123 and teselil authored Jul 23, 2023
1 parent 68a198d commit 305e848
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/CEL/policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ policies:
- name: CEL_policy
isDefault: true
rules:
- identifier: CUSTOM_DEPLOYMENT_BILLING_LABEL_EXISTS
- identifier: CUSTOM_WORKLOADS_BILLING_LABEL_EXISTS
messageOnFailure: "workloads labels should contain billing label"
- identifier: CUSTOM_SECRET_ENVIRONMENT_LABEL_EXISTS
messageOnFailure: "secret labels should contain environment label"
Expand All @@ -24,9 +24,9 @@ customRules:
- Pod
then:
CELDefinition:
- expression: "object.kind != 'Deployment' || (has(object.metadata.labels) && has(object.metadata.labels.billing))"
- expression: "has(object.metadata.labels) && has(object.metadata.labels.billing)"
message: "deployment labels should contain billing label"
- expression: "object.kind != 'Pod' || (has(object.metadata.labels) && has(object.metadata.labels.billing))"
- expression: "has(object.metadata.labels) && has(object.metadata.labels.billing)"
message: "pod labels should contain billing label"
- identifier: CUSTOM_SECRET_ENVIRONMENT_LABEL_EXISTS
name: Ensure Secret has environment label [CUSTOM RULE]
Expand Down

0 comments on commit 305e848

Please sign in to comment.