Browse Source

Docker volume size from nodegroups

Docker volume size as well as volume env files should be fetched
based on the nodegroup and not the cluster.

story: 2006701
task: 37008

Change-Id: Ia9e7f4612f36f4e57626b2e931b84898523e9ccb
tags/10.0.0.0rc1
Theodoros Tsioutsias 1 year ago
parent
commit
37c61fa2f8
7 changed files with 34 additions and 25 deletions
  1. +3
    -4
      magnum/drivers/heat/k8s_coreos_template_def.py
  2. +3
    -4
      magnum/drivers/heat/k8s_fedora_template_def.py
  3. +2
    -0
      magnum/drivers/heat/k8s_template_def.py
  4. +7
    -6
      magnum/drivers/heat/swarm_fedora_template_def.py
  5. +7
    -6
      magnum/drivers/heat/swarm_mode_template_def.py
  6. +11
    -4
      magnum/drivers/heat/template_def.py
  7. +1
    -1
      magnum/drivers/mesos_ubuntu_v1/template_def.py

+ 3
- 4
magnum/drivers/heat/k8s_coreos_template_def.py View File

@@ -31,8 +31,6 @@ class CoreOSK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition):

def __init__(self):
super(CoreOSK8sTemplateDefinition, self).__init__()
self.add_parameter('docker_volume_size',
cluster_attr='docker_volume_size')
self.add_parameter('docker_storage_driver',
cluster_template_attr='docker_storage_driver')

@@ -90,13 +88,14 @@ class CoreOSK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
extra_params=extra_params,
**kwargs)

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
env_files = []

template_def.add_priv_net_env_file(env_files, cluster_template,
cluster)
template_def.add_etcd_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster,
nodegroup=nodegroup)
template_def.add_lb_env_file(env_files, cluster_template)
template_def.add_fip_env_file(env_files, cluster_template, cluster)



+ 3
- 4
magnum/drivers/heat/k8s_fedora_template_def.py View File

@@ -35,8 +35,6 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):

def __init__(self):
super(K8sFedoraTemplateDefinition, self).__init__()
self.add_parameter('docker_volume_size',
cluster_attr='docker_volume_size')
self.add_parameter('docker_storage_driver',
cluster_template_attr='docker_storage_driver')

@@ -196,13 +194,14 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'boot_volume_size', CONF.cinder.default_boot_volume_size)
extra_params['boot_volume_size'] = boot_volume_size

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
env_files = []

template_def.add_priv_net_env_file(env_files, cluster_template,
cluster)
template_def.add_etcd_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster,
nodegroup=nodegroup)
template_def.add_lb_env_file(env_files, cluster_template)
template_def.add_fip_env_file(env_files, cluster_template, cluster)



+ 2
- 0
magnum/drivers/heat/k8s_template_def.py View File

@@ -128,6 +128,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
'master_image': 'image_id',
'master_role': 'role',
'master_nodegroup_name': 'name',
'docker_volume_size': 'docker_volume_size'
})
worker_params.update({
'number_of_minions': 'node_count',
@@ -135,6 +136,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
'minion_image': 'image_id',
'worker_role': 'role',
'worker_nodegroup_name': 'name',
'docker_volume_size': 'docker_volume_size'
})
return super(
K8sTemplateDefinition, self).get_nodegroup_param_maps(


+ 7
- 6
magnum/drivers/heat/swarm_fedora_template_def.py View File

@@ -45,8 +45,6 @@ class SwarmFedoraTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_parameter('cluster_uuid',
cluster_attr='uuid',
param_type=str)
self.add_parameter('docker_volume_size',
cluster_attr='docker_volume_size')
self.add_parameter('volume_driver',
cluster_template_attr='volume_driver')
self.add_parameter('external_network',
@@ -83,12 +81,14 @@ class SwarmFedoraTemplateDefinition(template_def.BaseTemplateDefinition):
worker_params = worker_params or dict()
master_params.update({
'master_flavor': 'flavor_id',
'master_image': 'image_id'
'master_image': 'image_id',
'docker_volume_size': 'docker_volume_size'
})
worker_params.update({
'number_of_nodes': 'node_count',
'node_flavor': 'flavor_id',
'node_image': 'image_id'
'node_image': 'image_id',
'docker_volume_size': 'docker_volume_size'
})
return super(
SwarmFedoraTemplateDefinition, self).get_nodegroup_param_maps(
@@ -156,12 +156,13 @@ class SwarmFedoraTemplateDefinition(template_def.BaseTemplateDefinition):
extra_params=extra_params,
**kwargs)

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
env_files = []

template_def.add_priv_net_env_file(env_files, cluster_template,
cluster)
template_def.add_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster,
nodegroup=nodegroup)
template_def.add_lb_env_file(env_files, cluster_template)

return env_files

+ 7
- 6
magnum/drivers/heat/swarm_mode_template_def.py View File

@@ -92,8 +92,6 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_parameter('cluster_uuid',
cluster_attr='uuid',
param_type=str)
self.add_parameter('docker_volume_size',
cluster_attr='docker_volume_size')
self.add_parameter('volume_driver',
cluster_template_attr='volume_driver')
self.add_parameter('external_network',
@@ -148,12 +146,14 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
worker_params = worker_params or dict()
master_params.update({
'master_flavor': 'flavor_id',
'master_image': 'image_id'
'master_image': 'image_id',
'docker_volume_size': 'docker_volume_size'
})
worker_params.update({
'number_of_nodes': 'node_count',
'node_flavor': 'flavor_id',
'node_image': 'image_id'
'node_image': 'image_id',
'docker_volume_size': 'docker_volume_size'
})
return super(
SwarmModeTemplateDefinition, self).get_nodegroup_param_maps(
@@ -182,12 +182,13 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
self).update_outputs(stack, cluster_template, cluster,
nodegroups=nodegroups)

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
env_files = []

template_def.add_priv_net_env_file(env_files, cluster_template,
cluster)
template_def.add_volume_env_file(env_files, cluster)
template_def.add_volume_env_file(env_files, cluster,
nodegroup=nodegroup)
template_def.add_lb_env_file(env_files, cluster_template)
template_def.add_fip_env_file(env_files, cluster_template, cluster)



+ 11
- 4
magnum/drivers/heat/template_def.py View File

@@ -235,7 +235,7 @@ class TemplateDefinition(object):

return template_params

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
"""Gets stack environment files based upon ClusterTemplate attributes.

Base implementation returns no files (empty list). Meant to be
@@ -323,9 +323,12 @@ class TemplateDefinition(object):
pass

def extract_definition(self, context, cluster_template, cluster, **kwargs):
nodegroups_list = kwargs.get('nodegroups', None)
nodegroup = None if not nodegroups_list else nodegroups_list[0]
return (self.template_path,
self.get_params(context, cluster_template, cluster, **kwargs),
self.get_env_files(cluster_template, cluster))
self.get_env_files(cluster_template, cluster,
nodegroup=nodegroup))


class BaseTemplateDefinition(TemplateDefinition):
@@ -533,8 +536,12 @@ def add_lb_env_file(env_files, cluster_template):
env_files.append(COMMON_ENV_PATH + 'no_master_lb.yaml')


def add_volume_env_file(env_files, cluster):
if cluster.docker_volume_size is None:
def add_volume_env_file(env_files, cluster, nodegroup=None):
if nodegroup:
docker_volume_size = nodegroup.docker_volume_size
else:
docker_volume_size = cluster.docker_volume_size
if docker_volume_size is None:
env_files.append(COMMON_ENV_PATH + 'no_volume.yaml')
else:
env_files.append(COMMON_ENV_PATH + 'with_volume.yaml')


+ 1
- 1
magnum/drivers/mesos_ubuntu_v1/template_def.py View File

@@ -122,7 +122,7 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
scale_manager.get_removal_nodes(hosts))
return scale_params

def get_env_files(self, cluster_template, cluster):
def get_env_files(self, cluster_template, cluster, nodegroup=None):
env_files = []

template_def.add_priv_net_env_file(env_files, cluster_template,


Loading…
Cancel
Save