From 5f333565a35a62e1f8c79bef63dee0c7e45408e6 Mon Sep 17 00:00:00 2001 From: ace Date: Tue, 12 Sep 2023 23:24:02 +0300 Subject: [PATCH] metallb: fix for kubernetes running without kube-proxy --- roles/metallb/tasks/main.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/roles/metallb/tasks/main.yaml b/roles/metallb/tasks/main.yaml index 2a769a6..5b24d4c 100644 --- a/roles/metallb/tasks/main.yaml +++ b/roles/metallb/tasks/main.yaml @@ -11,15 +11,25 @@ release_values: "{{ metallb_combined_values | from_yaml }}" wait: true +- name: Check if kube-proxy ConfigMap exist + check_mode: false + shell: | + kubectl get configmap kube-proxy -n kube-system + register: _kube_proxy_configmap + failed_when: false + changed_when: false + - name: Check for strict arp check_mode: false shell: | kubectl get configmap kube-proxy -n kube-system -o yaml | \ sed -e "s/strictARP: false/strictARP: true/" | \ kubectl diff -f - -n kube-system - register: check_strict_arp - when: metallb_strict_arp - changed_when: check_strict_arp.rc != 0 + register: check_strict_arp_status + when: + - _kube_proxy_configmap.rc == 0 + - metallb_strict_arp + changed_when: check_strict_arp_status.rc != 0 - name: Apply strict arp shell: | @@ -28,8 +38,9 @@ kubectl apply -f - -n kube-system \ && kubectl -n kube-system delete pods --selector=k8s-app=kube-proxy when: - - strict_arp_for_metallb - - metallb_strict_arp.changed + - _kube_proxy_configmap.rc == 0 + - metallb_strict_arp + - metallb_strict_arp_status.changed - name: Apply MetalLB L2 definitions k8s: