Skip to content

Fix webhook config merge to match by name instead of index#1888

Merged
openshift-merge-bot[bot] merged 1 commit intoopenstack-k8s-operators:mainfrom
lmiccini:fix-webhook-merge-by-name
Apr 15, 2026
Merged

Fix webhook config merge to match by name instead of index#1888
openshift-merge-bot[bot] merged 1 commit intoopenstack-k8s-operators:mainfrom
lmiccini:fix-webhook-merge-by-name

Conversation

@lmiccini
Copy link
Copy Markdown
Contributor

@lmiccini lmiccini commented Apr 14, 2026

  • MergeWebhookConfigurationForUpdate was copying the entire clientConfig from current to updated webhooks by array index. When the webhook arrays have different ordering (Kubernetes sorts alphabetically by name, but the template YAML has a different order), each webhook gets the clientConfig from the wrong entry, scrambling all the service paths.
  • This caused admission requests to be routed to the wrong handler. For example, mrabbitmq-v1beta1.kb.io would get the path for /mutate-network-openstack-org-v1beta1-reservation, resulting in: unable to decode rabbitmq.openstack.org/v1beta1, Kind=RabbitMq into *v1beta1.Reservation
  • Fix by matching webhooks by name field and only copying the caBundle (injected by cert-manager) rather than the entire clientConfig, preserving the correct service path from the updated template.

Jira: https://redhat.atlassian.net/browse/OSPRH-29026

@openshift-ci openshift-ci bot requested review from fultonj and rebtoor April 14, 2026 13:57
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

OpenStackControlPlane CRD Size Report

Metric Value
CRD JSON size 322326 bytes (315KB)
Base branch size 322326 bytes
Change +0.00%
Status yellow — growing
Threshold reference
Color Range Meaning
🟢 green < 300KB Comfortable
🟡 yellow 300–400KB Growing
🟠 orange 400–750KB Concerning
🔴 red > 750KB Approaching 1.5MB etcd limit (cut in half to allow space for update)

@lmiccini lmiccini requested review from abays and stuggi and removed request for fultonj and rebtoor April 14, 2026 13:58
@lmiccini lmiccini force-pushed the fix-webhook-merge-by-name branch from d5d5d88 to 69824a8 Compare April 14, 2026 14:14
@lmiccini lmiccini requested a review from fmount April 14, 2026 15:40
Comment thread internal/operator/bindata/merge.go Outdated
MergeWebhookConfigurationForUpdate was copying the entire clientConfig
from current to updated webhooks by array index. When the webhook arrays
have different ordering (e.g. Kubernetes sorts alphabetically by name,
but the template YAML has a different order), each webhook gets the
clientConfig from the wrong entry. This scrambles the service paths,
causing admission requests to be routed to the wrong handler.

For example, mrabbitmq-v1beta1.kb.io would get the path for
/mutate-network-openstack-org-v1beta1-reservation instead of
/mutate-rabbitmq-openstack-org-v1beta1-rabbitmq, resulting in:
"unable to decode rabbitmq.openstack.org/v1beta1, Kind=RabbitMq
into *v1beta1.Reservation"

Fix by matching webhooks by name and only copying the caBundle field
(injected by cert-manager) rather than the entire clientConfig. This
preserves the correct service path from the updated template.

Jira: https://redhat.atlassian.net/browse/OSPRH-29026

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lmiccini lmiccini force-pushed the fix-webhook-merge-by-name branch from 69824a8 to cd8350e Compare April 14, 2026 16:08
Copy link
Copy Markdown
Contributor

@abays abays left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abays, lmiccini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fmount
Copy link
Copy Markdown
Contributor

fmount commented Apr 14, 2026

looks gook! thanks @lmiccini!!

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/dfd55f523d1c41cd940711cb56151d09

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 26m 11s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 26m 25s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 27m 29s
✔️ openstack-operator-tempest-multinode SUCCESS in 1h 46m 26s
openstack-operator-edpm-baremetal-minor-update FAILURE in 2h 05m 01s

@lmiccini
Copy link
Copy Markdown
Contributor Author

recheck

@openshift-merge-bot openshift-merge-bot bot merged commit b950208 into openstack-k8s-operators:main Apr 15, 2026
8 checks passed
@lmiccini lmiccini deleted the fix-webhook-merge-by-name branch April 15, 2026 04:18
@lmiccini
Copy link
Copy Markdown
Contributor Author

/cherry-pick 18.0-fr5

@openshift-cherrypick-robot
Copy link
Copy Markdown

@lmiccini: new pull request created: #1889

Details

In response to this:

/cherry-pick 18.0-fr5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants