Commit d5d5d88
Fix webhook config merge to match by name instead of index
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>1 parent 6fd66d8 commit d5d5d88
1 file changed
Lines changed: 38 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
79 | 109 | | |
80 | 110 | | |
81 | 111 | | |
| |||
0 commit comments