From c880b24a80e9db0b02df3ae78117c3d9235d72ec Mon Sep 17 00:00:00 2001
From: Eugene Marchanka <81696153+eugene-marchanka@users.noreply.github.com>
Date: Mon, 8 May 2023 17:20:52 -0700
Subject: [PATCH] [MetalLB] Remove unused resources (#10004)

* Fix MetalLB deploy

This will fix MetalLB deploy

* Remove `metallb_ip_range` check

* Remove missing `metallb-config.yml`

* fix template name

* make deployment of layer3 conditional

* revert

* revert
---
 docs/metallb.md                                        | 2 +-
 roles/kubernetes-apps/metallb/tasks/main.yml           | 8 +-------
 roles/kubernetes-apps/metallb/templates/layer3.yaml.j2 | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/docs/metallb.md b/docs/metallb.md
index 5a174b17d..5b6c05af4 100644
--- a/docs/metallb.md
+++ b/docs/metallb.md
@@ -133,7 +133,7 @@ metallb_config:
 
 When using calico >= 3.18 you can replace MetalLB speaker by calico Service LoadBalancer IP advertisement.
 See [calico service IPs advertisement documentation](https://docs.projectcalico.org/archive/v3.18/networking/advertise-service-ips#advertise-service-load-balancer-ip-addresses).
-In this scenario you should disable the MetalLB speaker and configure the `calico_advertise_service_loadbalancer_ips` to match your `metallb_ip_range`
+In this scenario you should disable the MetalLB speaker and configure the `calico_advertise_service_loadbalancer_ips` to match your `ip_range`
 
 ```yaml
 metallb_speaker_enabled: false
diff --git a/roles/kubernetes-apps/metallb/tasks/main.yml b/roles/kubernetes-apps/metallb/tasks/main.yml
index 73cc2147a..50dc6c849 100644
--- a/roles/kubernetes-apps/metallb/tasks/main.yml
+++ b/roles/kubernetes-apps/metallb/tasks/main.yml
@@ -5,12 +5,6 @@
   when:
     - "kube_proxy_mode == 'ipvs' and not kube_proxy_strict_arp"
 
-- name: Kubernetes Apps | Check cluster settings for MetalLB
-  fail:
-    msg: "metallb_ip_range is mandatory to be specified for MetalLB"
-  when:
-    - metallb_ip_range is not defined or not metallb_ip_range
-
 - name: Kubernetes Apps | Check BGP peers for MetalLB
   fail:
     msg: "metallb_peers is mandatory when metallb_protocol is bgp and metallb_speaker_enabled"
@@ -45,7 +39,7 @@
     src: "{{ item }}.j2"
     dest: "{{ kube_config_dir }}/{{ item }}"
     mode: 0644
-  with_items: ["metallb.yml", "metallb-config.yml", "pools.yaml", "layer2.yaml", "layer3.yaml"]
+  with_items: ["metallb.yml", "pools.yaml", "layer2.yaml", "layer3.yaml"]
   register: "rendering"
   when:
     - "inventory_hostname == groups['kube_control_plane'][0]"
diff --git a/roles/kubernetes-apps/metallb/templates/layer3.yaml.j2 b/roles/kubernetes-apps/metallb/templates/layer3.yaml.j2
index 4004746ab..57d9465be 100644
--- a/roles/kubernetes-apps/metallb/templates/layer3.yaml.j2
+++ b/roles/kubernetes-apps/metallb/templates/layer3.yaml.j2
@@ -122,4 +122,4 @@ spec:
   ebgpMultiHop: {{ peer.multihop }}
   {% endif -%}
 
-{% endfor %}
\ No newline at end of file
+{% endfor %}
-- 
GitLab