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

fix: make cel expression policy work #963

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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