Support extra_network and extra_subnet labels

This allows users to add extra network interface to cluster nodes, e.g.
storage network.

Story: 2002448
Task: 21983
Change-Id: I10a6a4d72e9ec635f2c73d9fe64a8d136228f532
This commit is contained in:
Michał Nasiadka 2021-02-16 11:17:21 +01:00 committed by Bharat Kunwar
parent 439548e3de
commit 05c6885970
7 changed files with 107 additions and 2 deletions

View File

@ -500,6 +500,10 @@ the table are linked to more details elsewhere in the user guide.
+---------------------------------------+--------------------+---------------+
| `fixed_subnet_cidr`_ | see below | "" |
+---------------------------------------+--------------------+---------------+
| `extra_network`_ | see below | "" |
+---------------------------------------+--------------------+---------------+
| `extra_subnet`_ | see below | "" |
+---------------------------------------+--------------------+---------------+
.. _cluster:
@ -1619,6 +1623,12 @@ _`fixed_subnet_cidr`
specified an existing fixed_subnet during cluster creation.
Ussuri default: 10.0.0.0/24
_`extra_network`
Optional additional network to add to cluster nodes.
_`extra_subnet`
Optional additional subnet to add to cluster nodes.
External load balancer for services
-----------------------------------
@ -2705,7 +2715,6 @@ _`calico_tag`
Train default: v3.3.6
Ussuri default: v3.13.1
Besides, the Calico network driver needs kube_tag with v1.9.3 or later, because
Calico needs extra mounts for the kubelet container. See `commit
<https://github.com/projectatomic/atomic-system-containers/commit/54ab8abc7fa1bfb6fa674f55cd0c2fa0c812fd36>`_

View File

@ -125,7 +125,8 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'min_node_count', 'max_node_count', 'npd_enabled',
'ostree_remote', 'ostree_commit',
'use_podman', 'kube_image_digest',
'metrics_scraper_tag']
'metrics_scraper_tag',
'extra_network', 'extra_subnet']
labels = self._get_relevant_labels(cluster, kwargs)

View File

@ -42,6 +42,12 @@ conditions:
data:
calico_tag: {get_param: calico_tag}
extra_port:
not:
equals:
- get_param: extra_network
- ''
parameters:
# needs to become a list if we want to join master nodes?
@ -982,6 +988,19 @@ parameters:
description: The allowed CIDR list for master load balancer
default: []
extra_network:
type: string
description: >
Additional network to bind nodes to
default: ''
extra_subnet:
type: string
description: >
Subnet for additional network
default: ''
resources:
######################################################################
@ -1343,6 +1362,8 @@ resources:
containerd_tarball_sha256: {get_param: containerd_tarball_sha256}
post_install_manifest_url: {get_param: post_install_manifest_url}
metrics_scraper_tag: {get_param: metrics_scraper_tag}
extra_network: {get_param: extra_network}
extra_subnet: {get_param: extra_subnet}
kube_cluster_config:
condition: create_cluster_resources
@ -1521,6 +1542,9 @@ resources:
containerd_tarball_sha256: {get_param: containerd_tarball_sha256}
kube_service_account_key: {get_param: kube_service_account_key}
kube_service_account_private_key: {get_param: kube_service_account_private_key}
extra_network: {get_param: extra_network}
extra_subnet: {get_param: extra_subnet}
outputs:
api_address:

View File

@ -684,6 +684,16 @@ parameters:
description: >
Tag of metrics-scraper for kubernetes dashboard.
extra_network:
type: string
description: >
Additional network name to bind ports to instances
extra_subnet:
type: string
description: >
Additional subnet name
conditions:
image_based: {equals: [{get_param: boot_volume_size}, 0]}
@ -693,6 +703,12 @@ conditions:
- get_param: boot_volume_size
- 0
extra_port:
not:
equals:
- get_param: extra_network
- ''
resources:
######################################################################
#
@ -949,6 +965,7 @@ resources:
user_data: {get_resource: agent_config}
networks:
- port: {get_resource: kube_master_eth0}
- port: {if: ["extra_port", {get_resource: kube_master_eth1}, ""]}
scheduler_hints: { group: { get_param: nodes_server_group_id }}
availability_zone: {get_param: availability_zone}
@ -963,6 +980,7 @@ resources:
user_data: {get_resource: agent_config}
networks:
- port: {get_resource: kube_master_eth0}
- port: {if: ["extra_port", {get_resource: kube_master_eth1}, ""]}
scheduler_hints: { group: { get_param: nodes_server_group_id }}
availability_zone: {get_param: availability_zone}
block_device_mapping_v2:
@ -981,6 +999,17 @@ resources:
- ip_address: {get_param: pods_network_cidr}
replacement_policy: AUTO
kube_master_eth1:
type: OS::Neutron::Port
condition: extra_port
properties:
network: {get_param: extra_network}
security_groups:
- {get_param: secgroup_kube_master_id}
fixed_ips:
- subnet: {get_param: extra_subnet}
replacement_policy: AUTO
kube_master_floating:
type: Magnum::Optional::KubeMaster::Neutron::FloatingIP
properties:

View File

@ -365,6 +365,16 @@ parameters:
The private key will be used to sign generated k8s service account
tokens.
extra_network:
type: string
description: >
Additional network name to bind ports to instances
extra_subnet:
type: string
description: >
Additional subnet name
conditions:
image_based: {equals: [{get_param: boot_volume_size}, 0]}
@ -374,6 +384,12 @@ conditions:
- get_param: boot_volume_size
- 0
extra_port:
not:
equals:
- get_param: extra_network
- ''
resources:
agent_config:
@ -536,6 +552,7 @@ resources:
software_config_transport: POLL_SERVER_HEAT
networks:
- port: {get_resource: kube_minion_eth0}
- port: {if: ["extra_port", {get_resource: kube_minion_eth1}, ""]}
scheduler_hints: { group: { get_param: nodes_server_group_id }}
availability_zone: {get_param: availability_zone}
@ -550,6 +567,7 @@ resources:
software_config_transport: POLL_SERVER_HEAT
networks:
- port: {get_resource: kube_minion_eth0}
- port: {if: ["extra_port", {get_resource: kube_minion_eth1}, ""]}
scheduler_hints: { group: { get_param: nodes_server_group_id }}
availability_zone: {get_param: availability_zone}
block_device_mapping_v2:
@ -568,6 +586,17 @@ resources:
- ip_address: {get_param: pods_network_cidr}
replacement_policy: AUTO
kube_minion_eth1:
type: OS::Neutron::Port
condition: extra_port
properties:
network: {get_param: extra_network}
security_groups:
- get_param: secgroup_kube_minion_id
fixed_ips:
- subnet: {get_param: extra_subnet}
replacement_policy: AUTO
kube_minion_floating:
type: Magnum::Optional::KubeMinion::Neutron::FloatingIP
properties:

View File

@ -621,6 +621,8 @@ 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')
extra_network = mock_cluster.labels.get('extra_network')
extra_subnet = mock_cluster.labels.get('extra_subnet')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -744,6 +746,8 @@ 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',
'extra_network': extra_network,
'extra_subnet': extra_subnet,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,
@ -1174,6 +1178,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
master_lb_allowed_cidrs = mock_cluster.labels.get(
'master_lb_allowed_cidrs')
extra_network = mock_cluster.labels.get('extra_network')
extra_subnet = mock_cluster.labels.get('extra_subnet')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -1299,6 +1305,8 @@ 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',
'extra_network': extra_network,
'extra_subnet': extra_subnet,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,

View File

@ -0,0 +1,5 @@
---
features:
- |
Support extra_network and extra_subnet labels to allow users to assign
extra network interface to cluster nodes, e.g. storage network.