Browse Source

Allow overwriting labels on swarm mode creation

Allow passing label values on cluster creation for swarm mode. This is
available in all kubernetes drivers as well as swarm, but somehow missed
on swarm mode.

Story: 2004942
Task: 29343

Change-Id: Ie3ac66f45e27cc92993116c3df0b33873dc67e24
changes/01/634501/4
Ricardo Rocha 3 years ago
parent
commit
b555f90c10
  1. 4
      magnum/drivers/heat/swarm_mode_template_def.py
  2. 6
      magnum/tests/unit/drivers/test_template_definition.py
  3. 5
      releasenotes/notes/bug-2004942-052321df27529562.yaml

4
magnum/drivers/heat/swarm_mode_template_def.py

@ -135,11 +135,11 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
CONF.cluster.nodes_affinity_policy
for label in label_list:
extra_params[label] = cluster_template.labels.get(label)
extra_params[label] = cluster.labels.get(label)
# set docker_volume_type
# use the configuration default if None provided
docker_volume_type = cluster_template.labels.get(
docker_volume_type = cluster.labels.get(
'docker_volume_type', CONF.cinder.default_docker_volume_type)
extra_params['docker_volume_type'] = docker_volume_type

6
magnum/tests/unit/drivers/test_template_definition.py

@ -1169,10 +1169,10 @@ class AtomicSwarmModeTemplateDefinitionTestCase(base.TestCase):
mock_context.user_name = 'fake_user'
mock_context.tenant = 'fake_tenant'
docker_volume_type = mock_cluster_template.labels.get(
docker_volume_type = mock_cluster.labels.get(
'docker_volume_type')
rexray_preempt = mock_cluster_template.labels.get('rexray_preempt')
availability_zone = mock_cluster_template.labels.get(
rexray_preempt = mock_cluster.labels.get('rexray_preempt')
availability_zone = mock_cluster.labels.get(
'availability_zone')
number_of_secondary_masters = mock_cluster.master_count - 1

5
releasenotes/notes/bug-2004942-052321df27529562.yaml

@ -0,0 +1,5 @@
---
fixes:
- |
Allow overriding cluster template labels for swarm mode clusters - this
functionality was missed from this COE when it was introduced.
Loading…
Cancel
Save