From 9302ce00361314c4d2a9ada77005943a448d53a1 Mon Sep 17 00:00:00 2001 From: Kevin Lefevre Date: Sat, 16 Sep 2017 09:43:24 +0200 Subject: [PATCH] Enhanced OpenStack cloud provider (#1627) - Enable Cinder API version for block storage - Enable floating IP for LBaaS --- inventory/group_vars/all.yml | 3 +++ .../preinstall/templates/openstack-cloud-config.j2 | 8 ++++++++ roles/kubespray-defaults/defaults/main.yaml | 13 ++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index be260166a..dcb94b44c 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -74,9 +74,12 @@ bin_dir: /usr/local/bin #azure_vnet_name: #azure_route_table_name: +## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (https://github.com/kubernetes/kubernetes/issues/50461) +#openstack_blockstorage_version: "v1/v2/auto (default)" ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following variables. #openstack_lbaas_enabled: True #openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP" +#openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default" #openstack_lbaas_create_monitor: "yes" #openstack_lbaas_monitor_delay: "1m" #openstack_lbaas_monitor_timeout: "30s" diff --git a/roles/kubernetes/preinstall/templates/openstack-cloud-config.j2 b/roles/kubernetes/preinstall/templates/openstack-cloud-config.j2 index bc68d1ee5..55f6680e4 100644 --- a/roles/kubernetes/preinstall/templates/openstack-cloud-config.j2 +++ b/roles/kubernetes/preinstall/templates/openstack-cloud-config.j2 @@ -8,9 +8,17 @@ tenant-id={{ openstack_tenant_id }} domain-name={{ openstack_domain_name }} {% endif %} +{% if openstack_blockstorage_version is defined %} +[BlockStorage] +bs-version={{ openstack_blockstorage_version }} +{% endif %} + {% if openstack_lbaas_enabled and openstack_lbaas_subnet_id %} [LoadBalancer] subnet-id={{ openstack_lbaas_subnet_id }} +{% if openstack_lbaas_floating_network_id is defined %} +floating-network-id={{ openstack_lbaas_floating_network_id }} +{% endif %} create-monitor={{ openstack_lbaas_create_monitor }} monitor-delay={{ openstack_lbaas_monitor_delay }} monitor-timeout={{ openstack_lbaas_monitor_timeout }} diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 25fe2ecdd..5bd2fdc14 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -123,13 +123,16 @@ k8s_image_pull_policy: IfNotPresent efk_enabled: false enable_network_policy: false +## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (https://github.com/kubernetes/kubernetes/issues/50461) +#openstack_blockstorage_version: "v1/v2/auto (default)" ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following variables. openstack_lbaas_enabled: false -openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP" -openstack_lbaas_create_monitor: "yes" -openstack_lbaas_monitor_delay: false -openstack_lbaas_monitor_timeout: false -openstack_lbaas_monitor_max_retries: false +#openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP" +#openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default" +#openstack_lbaas_create_monitor: "yes" +#openstack_lbaas_monitor_delay: false +#openstack_lbaas_monitor_timeout: false +#openstack_lbaas_monitor_max_retries: false ## List of authorization modes that must be configured for ## the k8s cluster. Only 'AlwaysAllow','AlwaysDeny', and