From 5ec24672680659c4877d0d349f01e59117f2f033 Mon Sep 17 00:00:00 2001
From: Marc-Antoine <piequi@gmail.com>
Date: Mon, 21 Sep 2020 16:04:32 +0200
Subject: [PATCH] Add external_openstack_lbaas_provider setting for occm
 (#6566)

* Add external_openstack_lbaas_provider setting for occm

* Integrate with existing lbaas_provider block

* Refactor lbaas_provider config template block

* Remove external_openstack_lbaas_use_octavia from sample inventory
---
 inventory/sample/group_vars/all/openstack.yml            | 2 +-
 .../templates/external-openstack-cloud-config.j2         | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/inventory/sample/group_vars/all/openstack.yml b/inventory/sample/group_vars/all/openstack.yml
index a7f86271c..ce22e12ee 100644
--- a/inventory/sample/group_vars/all/openstack.yml
+++ b/inventory/sample/group_vars/all/openstack.yml
@@ -20,8 +20,8 @@
 # external_openstack_lbaas_subnet_id: "Neutron subnet ID to create LBaaS VIP"
 # external_openstack_lbaas_floating_network_id: "Neutron network ID to get floating IP from"
 # external_openstack_lbaas_floating_subnet_id: "Neutron subnet ID to get floating IP from"
-# external_openstack_lbaas_use_octavia: true
 # external_openstack_lbaas_method: "ROUND_ROBIN"
+# external_openstack_lbaas_provider: "octavia"
 # external_openstack_lbaas_create_monitor: false
 # external_openstack_lbaas_monitor_delay: "1m"
 # external_openstack_lbaas_monitor_timeout: "30s"
diff --git a/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2 b/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2
index 2ccf9f9bd..eda2d9720 100644
--- a/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2
+++ b/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2
@@ -30,7 +30,6 @@ ca-file="{{ kube_config_dir }}/external-openstack-cacert.pem"
 {% endif %}
 
 [LoadBalancer]
-use-octavia={{ external_openstack_lbaas_use_octavia | string | lower }}
 create-monitor={{ external_openstack_lbaas_create_monitor }}
 monitor-delay={{ external_openstack_lbaas_monitor_delay }}
 monitor-timeout={{ external_openstack_lbaas_monitor_timeout }}
@@ -56,8 +55,12 @@ manage-security-groups={{ external_openstack_lbaas_manage_security_groups }}
 {% if external_openstack_lbaas_internal_lb is defined %}
 internal-lb={{ external_openstack_lbaas_internal_lb }}
 {% endif %}
-{% if external_openstack_lbaas_use_octavia is defined and external_openstack_lbaas_use_octavia %}
+{% if external_openstack_lbaas_provider is defined %}
+lb-provider={{ external_openstack_lbaas_provider }}
+use-octavia={{ external_openstack_lbaas_provider | lower == 'octavia' }}
+{% else %}
 lb-provider=octavia
+use-octavia=true
 {% endif %}
 
 [Networking]
@@ -72,4 +75,4 @@ public-network-name="{{ network_name }}"
 [Metadata]
 {% if external_openstack_metadata_search_order is defined %}
 search-order="{{ external_openstack_metadata_search_order }}"
-{% endif %}
\ No newline at end of file
+{% endif %}
-- 
GitLab