summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Rocha <rocha.porto@gmail.com>2017-12-20 14:07:14 +0000
committerRicardo Rocha <rocha.porto@gmail.com>2017-12-20 14:07:14 +0000
commit299638507d0d9893ea3cf9589ba56715717cf29a (patch)
treea809e088cd11cfa61734d0983f68528c2cb64228
parent273405cb5a8cdbcec816f646cfe82f13784b3bf1 (diff)
[k8s] Take kube_tag from cluster if specified
Labels can be overriden on cluster creation, and should take precendence against the cluster template when passed. When not passed, they are filled with the ones from the template. Fix the setting of kube_tag on the template definition, we were taking the cluster template and ignoring cluster. Change-Id: I8fff6f15a780c74b1f09e7238472620e8f93b532 Closes-Bug: #1739422
Notes
Notes (review): Code-Review+2: Spyros Trigazis (strigazi) <strigazi@gmail.com> Code-Review+2: yatin <ykarel@redhat.com> Workflow+1: yatin <ykarel@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 26 Dec 2017 05:13:33 +0000 Reviewed-on: https://review.openstack.org/529326 Project: openstack/magnum Branch: refs/heads/master
-rw-r--r--magnum/drivers/heat/k8s_fedora_template_def.py2
-rw-r--r--magnum/tests/unit/drivers/test_template_definition.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/magnum/drivers/heat/k8s_fedora_template_def.py b/magnum/drivers/heat/k8s_fedora_template_def.py
index 73426b7..bdf38e8 100644
--- a/magnum/drivers/heat/k8s_fedora_template_def.py
+++ b/magnum/drivers/heat/k8s_fedora_template_def.py
@@ -78,7 +78,7 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
78 'docker_volume_type', CONF.cinder.default_docker_volume_type) 78 'docker_volume_type', CONF.cinder.default_docker_volume_type)
79 extra_params['docker_volume_type'] = docker_volume_type 79 extra_params['docker_volume_type'] = docker_volume_type
80 80
81 kube_tag = cluster_template.labels.get('kube_tag') 81 kube_tag = cluster.labels.get('kube_tag')
82 if kube_tag: 82 if kube_tag:
83 extra_params['kube_tag'] = kube_tag 83 extra_params['kube_tag'] = kube_tag
84 84
diff --git a/magnum/tests/unit/drivers/test_template_definition.py b/magnum/tests/unit/drivers/test_template_definition.py
index deed236..9523899 100644
--- a/magnum/tests/unit/drivers/test_template_definition.py
+++ b/magnum/tests/unit/drivers/test_template_definition.py
@@ -269,7 +269,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
269 'docker_volume_type') 269 'docker_volume_type')
270 etcd_volume_size = mock_cluster.labels.get( 270 etcd_volume_size = mock_cluster.labels.get(
271 'etcd_volume_size') 271 'etcd_volume_size')
272 kube_tag = mock_cluster_template.labels.get('kube_tag') 272 kube_tag = mock_cluster.labels.get('kube_tag')
273 container_infra_prefix = mock_cluster_template.labels.get( 273 container_infra_prefix = mock_cluster_template.labels.get(
274 'container_infra_prefix') 274 'container_infra_prefix')
275 275
@@ -352,7 +352,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
352 'docker_volume_type') 352 'docker_volume_type')
353 etcd_volume_size = mock_cluster.labels.get( 353 etcd_volume_size = mock_cluster.labels.get(
354 'etcd_volume_size') 354 'etcd_volume_size')
355 kube_tag = mock_cluster_template.labels.get('kube_tag') 355 kube_tag = mock_cluster.labels.get('kube_tag')
356 container_infra_prefix = mock_cluster_template.labels.get( 356 container_infra_prefix = mock_cluster_template.labels.get(
357 'container_infra_prefix') 357 'container_infra_prefix')
358 358