[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
This commit is contained in:
Ricardo Rocha 2017-12-20 14:07:14 +00:00
parent 273405cb5a
commit 299638507d
2 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'docker_volume_type', CONF.cinder.default_docker_volume_type)
extra_params['docker_volume_type'] = docker_volume_type
kube_tag = cluster_template.labels.get('kube_tag')
kube_tag = cluster.labels.get('kube_tag')
if kube_tag:
extra_params['kube_tag'] = kube_tag

View File

@ -269,7 +269,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'docker_volume_type')
etcd_volume_size = mock_cluster.labels.get(
'etcd_volume_size')
kube_tag = mock_cluster_template.labels.get('kube_tag')
kube_tag = mock_cluster.labels.get('kube_tag')
container_infra_prefix = mock_cluster_template.labels.get(
'container_infra_prefix')
@ -352,7 +352,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'docker_volume_type')
etcd_volume_size = mock_cluster.labels.get(
'etcd_volume_size')
kube_tag = mock_cluster_template.labels.get('kube_tag')
kube_tag = mock_cluster.labels.get('kube_tag')
container_infra_prefix = mock_cluster_template.labels.get(
'container_infra_prefix')