Skip to content

Commit

Permalink
Fix matchConditions to be compatible with GenerateName (#382)
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Short <todd.short@me.com>
  • Loading branch information
tmshort committed Sep 6, 2024
1 parent 6584e7e commit 40cb322
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/base/manager/webhook/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
- op: add
path: /webhooks/0/clientConfig/service/port
value: 443
# Make sure there's a name defined, otherwise, we can't create a label. This could happen when generateName is set
# Then, if any of the conditions are true, create the label:
# 1. No labels exist
# 2. The olm.operatorframework.io/metadata.name label doesn't exist
# 3. The olm.operatorframework.io/metadata.name label doesn't match the name
- op: add
path: /webhooks/0/matchConditions
value:
- name: MissingOrIncorrectMetadataNameLabel
expression: "!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name"
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"

0 comments on commit 40cb322

Please sign in to comment.