Add support for choosing Octavia provider

Story: 2008805

Add support for:
* choosing Octavia provider
* setting octavia_lb_algorithm
* disabling Octavia healthcheck

Change-Id: I2d424fc2e2f8967e4b3007faedbc089f37126968
This commit is contained in:
Michal Nasiadka 2020-11-27 11:18:29 +00:00 committed by Jake Yip
parent 61c7f7b34b
commit 5af49aa2fa
14 changed files with 184 additions and 6 deletions

View File

@ -502,6 +502,12 @@ the table are linked to more details elsewhere in the user guide.
+---------------------------------------+--------------------+---------------+
| `fixed_subnet_cidr`_ | see below | "" |
+---------------------------------------+--------------------+---------------+
| `octavia_provider`_ | see below | amphora |
+---------------------------------------+--------------------+---------------+
| `octavia_lb_algorithm`_ | see bellow | ROUND_ROBIN |
+---------------------------------------+--------------------+---------------+
| `octavia_lb_healthcheck`_ | see bellow | true |
+---------------------------------------+--------------------+---------------+
.. _cluster:
@ -1635,6 +1641,17 @@ _`fixed_subnet_cidr`
specified an existing fixed_subnet during cluster creation.
Ussuri default: 10.0.0.0/24
_`octavia_provider`
Octavia provider driver to be used for creating load balancers.
_`octavia_lb_algorithm`
Octavia Octavia lb algorithm to use for LoadBalancer type service
Default: ROUND_ROBIN
_`octavia_lb_healthcheck`
If true, enable Octavia load balancer healthcheck
Default: true
External load balancer for services
-----------------------------------

View File

@ -112,6 +112,9 @@ KUBEAPI_OPTIONS="$KUBEAPI_OPTIONS"
KUBEPROXY_OPTIONS="$KUBEPROXY_OPTIONS"
KUBESCHEDULER_OPTIONS="$KUBESCHEDULER_OPTIONS"
OCTAVIA_ENABLED="$OCTAVIA_ENABLED"
OCTAVIA_PROVIDER="$OCTAVIA_PROVIDER"
OCTAVIA_LB_ALGORITHM="$OCTAVIA_LB_ALGORITHM"
OCTAVIA_LB_HEALTHCHECK="$OCTAVIA_LB_HEALTHCHECK"
KUBE_SERVICE_ACCOUNT_KEY="$KUBE_SERVICE_ACCOUNT_KEY"
KUBE_SERVICE_ACCOUNT_PRIVATE_KEY="$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY"
PROMETHEUS_TAG="$PROMETHEUS_TAG"

View File

@ -74,6 +74,9 @@ DNS_CLUSTER_DOMAIN="$DNS_CLUSTER_DOMAIN"
KUBELET_OPTIONS="$KUBELET_OPTIONS"
KUBEPROXY_OPTIONS="$KUBEPROXY_OPTIONS"
OCTAVIA_ENABLED="$OCTAVIA_ENABLED"
OCTAVIA_PROVIDER="$OCTAVIA_PROVIDER"
OCTAVIA_LB_ALGORITHM=$OCTAVIA_LB_ALGORITHM
OCTAVIA_LB_HEALTHCHECK=$OCTAVIA_LB_HEALTHCHECK
HEAT_CONTAINER_AGENT_TAG="$HEAT_CONTAINER_AGENT_TAG"
AUTO_HEALING_ENABLED="$AUTO_HEALING_ENABLED"
AUTO_HEALING_CONTROLLER="$AUTO_HEALING_CONTROLLER"

View File

@ -20,7 +20,9 @@ ca-file=/etc/kubernetes/ca-bundle.crt
use-octavia=$OCTAVIA_ENABLED
subnet-id=$CLUSTER_SUBNET
floating-network-id=$EXTERNAL_NETWORK_ID
create-monitor=yes
lb-provider=$OCTAVIA_PROVIDER
lb-method=$OCTAVIA_LB_ALGORITHM
create-monitor=$OCTAVIA_LB_HEALTHCHECK
monitor-delay=1m
monitor-timeout=30s
monitor-max-retries=3

View File

@ -10,6 +10,11 @@ conditions:
- get_param: allowed_cidrs
- []
octavia_lb_healthcheck_enabled:
equals:
- get_param: octavia_lb_healthcheck
- []
parameters:
fixed_subnet:
@ -31,10 +36,23 @@ parameters:
type: comma_delimited_list
description: The allowed CIDR list for master load balancer
octavia_provider:
type: string
description: Octavia provider to use for load balancer
octavia_lb_algorithm:
type: string
description: Octavia load balancer algorithm to use
octavia_lb_healthcheck:
type: boolean
description: Octavia load balancer healthcheck
resources:
loadbalancer:
type: Magnum::Optional::Neutron::LBaaS::LoadBalancer
properties:
provider: {get_param: octavia_provider}
vip_subnet: {get_param: fixed_subnet}
listener:
@ -57,11 +75,12 @@ resources:
pool:
type: Magnum::Optional::Neutron::LBaaS::Pool
properties:
lb_algorithm: ROUND_ROBIN
lb_algorithm: {get_param: octavia_lb_algorithm}
listener: {if: ["allowed_cidrs_enabled", {get_resource: listener_with_allowed_cidrs}, {get_resource: listener}]}
protocol: {get_param: protocol}
monitor:
condition: octavia_lb_healthcheck_enabled
type: Magnum::Optional::Neutron::LBaaS::HealthMonitor
properties:
type: TCP

View File

@ -11,6 +11,11 @@ conditions:
- get_param: allowed_cidrs
- []
octavia_lb_healthcheck_enabled:
equals:
- get_param: octavia_lb_healthcheck
- []
parameters:
fixed_subnet:
@ -29,10 +34,23 @@ parameters:
type: comma_delimited_list
description: The allowed CIDR list for master load balancer
octavia_provider:
type: string
description: Octavia provider to use for load balancer
octavia_lb_algorithm:
type: string
description: Octavia load balancer algorithm to use
octavia_lb_healthcheck:
type: boolean
description: Octavia load balancer healthcheck
resources:
loadbalancer:
type: Magnum::Optional::Neutron::LBaaS::LoadBalancer
properties:
provider: {get_param: octavia_provider}
vip_subnet: {get_param: fixed_subnet}
listener:
@ -55,11 +73,12 @@ resources:
pool:
type: Magnum::Optional::Neutron::LBaaS::Pool
properties:
lb_algorithm: ROUND_ROBIN
lb_algorithm: {get_param: octavia_lb_algorithm}
listener: {if: ["allowed_cidrs_enabled", {get_resource: listener_with_allowed_cidrs}, {get_resource: listener}]}
protocol: {get_param: protocol}
monitor:
condition: octavia_lb_healthcheck_enabled
type: Magnum::Optional::Neutron::LBaaS::HealthMonitor
properties:
type: TCP

View File

@ -257,7 +257,10 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
'kubecontroller_options',
'kubescheduler_options',
'influx_grafana_dashboard_enabled',
'master_lb_allowed_cidrs']
'master_lb_allowed_cidrs',
'octavia_provider',
'octavia_lb_algorithm',
'octavia_lb_healthcheck']
labels = self._get_relevant_labels(cluster, kwargs)

View File

@ -660,6 +660,24 @@ parameters:
whether or not to use Octavia for LoadBalancer type service.
default: False
octavia_provider:
type: string
default: amphora
description: >
Octavia provider driver to use for LoadBalancer type service.
octavia_lb_algorithm:
type: string
default: ROUND_ROBIN
description: >
Octavia lb algorithm to use for LoadBalancer type service
octavia_lb_healthcheck:
type: boolean
description: >
if true, enable Octavia load balancer healthcheck
default: true
kube_service_account_key:
type: string
hidden: true
@ -1021,6 +1039,9 @@ resources:
protocol: {get_param: loadbalancing_protocol}
port: {get_param: kubernetes_port}
allowed_cidrs: {get_param: master_lb_allowed_cidrs}
octavia_provider: {get_param: octavia_provider}
octavia_lb_algorithm: {get_param: octavia_lb_algorithm}
octavia_lb_healthcheck: {get_param: octavia_lb_healthcheck}
etcd_lb:
condition: create_cluster_resources
@ -1030,6 +1051,9 @@ resources:
protocol: {get_param: loadbalancing_protocol}
port: 2379
allowed_cidrs: {get_param: master_lb_allowed_cidrs}
octavia_provider: {get_param: octavia_provider}
octavia_lb_algorithm: {get_param: octavia_lb_algorithm}
octavia_lb_healthcheck: {get_param: octavia_lb_healthcheck}
######################################################################
#
@ -1317,6 +1341,9 @@ resources:
kubecontroller_options: {get_param: kubecontroller_options}
kubescheduler_options: {get_param: kubescheduler_options}
octavia_enabled: {get_param: octavia_enabled}
octavia_provider: {get_param: octavia_provider}
octavia_lb_algorithm: {get_param: octavia_lb_algorithm}
octavia_lb_healthcheck: {get_param: octavia_lb_healthcheck}
kube_service_account_key: {get_param: kube_service_account_key}
kube_service_account_private_key: {get_param: kube_service_account_private_key}
prometheus_tag: {get_param: prometheus_tag}
@ -1538,6 +1565,9 @@ resources:
kubelet_options: {get_param: kubelet_options}
kubeproxy_options: {get_param: kubeproxy_options}
octavia_enabled: {get_param: octavia_enabled}
octavia_provider: {get_param: octavia_provider}
octavia_lb_algorithm: {get_param: octavia_lb_algorithm}
octavia_lb_healthcheck: {get_param: octavia_lb_healthcheck}
heat_container_agent_tag: {get_param: heat_container_agent_tag}
auto_healing_enabled: {get_param: auto_healing_enabled}
npd_enabled: {get_param: npd_enabled}

View File

@ -434,6 +434,23 @@ parameters:
whether or not to use Octavia for LoadBalancer type service.
default: False
octavia_provider:
type: string
description: >
Octavia provider driver to use for LoadBalancer type service.
octavia_lb_algorithm:
type: string
default: ROUND_ROBIN
description: >
Octavia lb algorithm to use for LoadBalancer type service.
octavia_lb_healthcheck:
type: boolean
default: True
description: >
Octavia lb healthcheck.
kube_service_account_key:
type: string
hidden: true
@ -849,6 +866,9 @@ resources:
"$KUBEPROXY_OPTIONS": {get_param: kubeproxy_options}
"$KUBESCHEDULER_OPTIONS": {get_param: kubescheduler_options}
"$OCTAVIA_ENABLED": {get_param: octavia_enabled}
"$OCTAVIA_PROVIDER": {get_param: octavia_provider}
"$OCTAVIA_LB_ALGORITHM": {get_param: octavia_lb_algorithm}
"$OCTAVIA_LB_HEALTHCHECK": {get_param: octavia_lb_healthcheck}
"$KUBE_SERVICE_ACCOUNT_KEY": {get_param: kube_service_account_key}
"$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY": {get_param: kube_service_account_private_key}
"$PROMETHEUS_TAG": {get_param: prometheus_tag}

View File

@ -294,6 +294,24 @@ parameters:
whether or not to use Octavia for LoadBalancer type service.
default: False
octavia_provider:
type: string
description: >
Octavia provider driver to use for LoadBalancer type service.
default: False
octavia_lb_algorithm:
type: string
default: ROUND_ROBIN
description: >
Octavia lb algorithm to use for LoadBalancer type service.
octavia_lb_healthcheck:
type: boolean
default: True
description: >
Octavia lb healthcheck.
cloud_provider_enabled:
type: boolean
description: Enable or disable the openstack kubernetes cloud provider
@ -482,6 +500,9 @@ resources:
$KUBELET_OPTIONS: {get_param: kubelet_options}
$KUBEPROXY_OPTIONS: {get_param: kubeproxy_options}
$OCTAVIA_ENABLED: {get_param: octavia_enabled}
$OCTAVIA_PROVIDER: {get_param: octavia_provider}
$OCTAVIA_LB_ALGORITHM: {get_param: octavia_lb_algorithm}
$OCTAVIA_LB_HEALTHCHECK: {get_param: octavia_lb_healthcheck}
$HEAT_CONTAINER_AGENT_TAG: {get_param: heat_container_agent_tag}
$AUTO_HEALING_ENABLED: {get_param: auto_healing_enabled}
$AUTO_HEALING_CONTROLLER: {get_param: auto_healing_controller}

View File

@ -382,6 +382,9 @@ class TestClusterConductorWithK8s(base.TestCase):
'post_install_manifest_url': '',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
if missing_attr is not None:
@ -538,7 +541,10 @@ class TestClusterConductorWithK8s(base.TestCase):
'worker_nodegroup_name': 'worker_ng',
'post_install_manifest_url': '',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
self.assertEqual(expected, definition)
@ -676,7 +682,10 @@ class TestClusterConductorWithK8s(base.TestCase):
'worker_nodegroup_name': 'worker_ng',
'post_install_manifest_url': '',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -794,6 +803,9 @@ class TestClusterConductorWithK8s(base.TestCase):
'worker_nodegroup_name': 'worker_ng',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -909,6 +921,9 @@ class TestClusterConductorWithK8s(base.TestCase):
'worker_nodegroup_name': 'worker_ng',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -1160,6 +1175,9 @@ class TestClusterConductorWithK8s(base.TestCase):
'post_install_manifest_url': '',
'master_lb_allowed_cidrs': None,
'fixed_subnet_cidr': self.fixed_subnet_cidr,
'octavia_provider': None,
'octavia_lb_algorithm': None,
'octavia_lb_healthcheck': None,
}
self.assertEqual(expected, definition)
self.assertEqual(

View File

@ -622,6 +622,9 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
metrics_scraper_tag = mock_cluster.labels.get('metrics_scraper_tag')
master_lb_allowed_cidrs = mock_cluster.labels.get(
'master_lb_allowed_cidrs')
octavia_provider = mock_cluster.labels.get('octavia_provider')
octavia_lb_algorithm = mock_cluster.labels.get('octavia_lb_algorithm')
octavia_lb_healthcheck = mock_cluster.labels.get('octavia_lb_healthcheck')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -746,6 +749,9 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'metrics_scraper_tag': metrics_scraper_tag,
'master_lb_allowed_cidrs': master_lb_allowed_cidrs,
'fixed_subnet_cidr': '20.200.0.0/16',
'octavia_provider': octavia_provider,
'octavia_lb_algorithm': octavia_lb_algorithm,
'octavia_lb_healthcheck': octavia_lb_healthcheck,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,
@ -1178,6 +1184,10 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
master_lb_allowed_cidrs = mock_cluster.labels.get(
'master_lb_allowed_cidrs')
octavia_provider = mock_cluster.labels.get('octavia_provider')
octavia_lb_algorithm = mock_cluster.labels.get('octavia_lb_algorithm')
octavia_lb_healthcheck = mock_cluster.labels.get('octavia_lb_healthcheck')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
k8s_def.get_params(mock_context, mock_cluster_template, mock_cluster)
@ -1303,6 +1313,9 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'metrics_scraper_tag': metrics_scraper_tag,
'master_lb_allowed_cidrs': master_lb_allowed_cidrs,
'fixed_subnet_cidr': '20.200.0.0/16',
'octavia_provider': octavia_provider,
'octavia_lb_algorithm': octavia_lb_algorithm,
'octavia_lb_healthcheck': octavia_lb_healthcheck,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,

View File

@ -0,0 +1,5 @@
---
features:
- |
Added support for choosing Octavia LB algorithm by using
``octavia_lb_algorithm`` tag.

View File

@ -0,0 +1,5 @@
---
features:
- |
Added support for choosing Octavia provider driver by using
``octavia_provider`` tag.