Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.
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
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)"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would reinvocationPolicy in the webhook config help?

I assume if the webhook is reinvoked, metadata.name would be available the second time because the name generator is another admission plugin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when k8s creates the name, it goes back through the webhook