Skip to content

Commit 68c9a19

Browse files
rebtoorclaude
authored andcommitted
[kustomize_deploy] Fix MetalLB CR creation race with webhook readiness
The MetalLB validating webhook can reject CR creation with "no endpoints available" when the operator's webhook services aren't fully ready yet. The existing deployment availability checks pass before the backing Endpoints objects have addresses populated, creating a window where CR creation fails. Add an explicit wait for all four MetalLB webhook endpoint services (metallb-operator-controller-manager-service, metallb-operator-webhook-server-service, metallb-operator-webhook-service, webhook-service) to have at least one ready address before applying MetalLB CRs. Also add retry logic (retries: 10, delay: 15) to the CR apply step itself as a safety net for any remaining transient webhook failures. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Roberto Alfieri <ralfieri@redhat.com>
1 parent 52e11d1 commit 68c9a19

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

roles/kustomize_deploy/tasks/install_operators.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,28 @@
325325
register: _webhook_server_deployment
326326
until: _webhook_server_deployment is success
327327

328+
- name: Wait for MetalLB webhook endpoints to have addresses
329+
kubernetes.core.k8s_info:
330+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
331+
api_version: v1
332+
kind: Endpoints
333+
namespace: metallb-system
334+
name: "{{ item }}"
335+
retries: 10
336+
delay: 15
337+
register: _metallb_webhook_endpoints
338+
until:
339+
- _metallb_webhook_endpoints.resources is defined
340+
- _metallb_webhook_endpoints.resources | length == 1
341+
- >-
342+
(_metallb_webhook_endpoints.resources | first).subsets | default([])
343+
| map(attribute='addresses', default=[]) | flatten | length > 0
344+
loop:
345+
- metallb-operator-controller-manager-service
346+
- metallb-operator-webhook-server-service
347+
- metallb-operator-webhook-service
348+
- webhook-service
349+
328350
- name: Wait until NMstate operator resources are deployed
329351
kubernetes.core.k8s_info:
330352
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
@@ -374,6 +396,10 @@
374396
cifmw_kustomize_deploy_check_mode |
375397
default(false, true)
376398
}}
399+
retries: 10
400+
delay: 15
401+
register: _metallb_cr_apply
402+
until: _metallb_cr_apply is success
377403

378404
- name: Wait for MetalLB speaker pods
379405
kubernetes.core.k8s_info:

0 commit comments

Comments
 (0)