Browse Source

ng-10: Fix cluster template conditions

Removes the role heat param from all templates. Instead and only for
k8s templates adds the master_role and worker_role params. The new
worker_only condition should be true for all roles except for master.
Finally, adds the missing is_cluster_stack param to all templates.

Change-Id: Ie0799373fe492c2e0a0cad903ed6e8c93e6266b5
tags/10.0.0.0rc1
Theodoros Tsioutsias 10 months ago
parent
commit
44631afbbf
12 changed files with 106 additions and 53 deletions
  1. +2
    -0
      magnum/drivers/heat/k8s_template_def.py
  2. +0
    -2
      magnum/drivers/heat/template_def.py
  3. +12
    -0
      magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml
  4. +28
    -17
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
  5. +28
    -17
      magnum/drivers/k8s_fedora_coreos_v1/templates/kubecluster.yaml
  6. +12
    -0
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml
  7. +4
    -0
      magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml
  8. +4
    -0
      magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml
  9. +4
    -0
      magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml
  10. +12
    -6
      magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
  11. +0
    -5
      magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
  12. +0
    -6
      magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py

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

@@ -126,11 +126,13 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
master_params.update({
'master_flavor': 'flavor_id',
'master_image': 'image_id',
'master_role': 'role',
})
worker_params.update({
'number_of_minions': 'node_count',
'minion_flavor': 'flavor_id',
'minion_image': 'image_id',
'worker_role': 'role',
})
return super(
K8sTemplateDefinition, self).get_nodegroup_param_maps(


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

@@ -423,9 +423,7 @@ class BaseTemplateDefinition(TemplateDefinition):
worker_params = worker_params or dict()
master_params.update({
'number_of_masters': 'node_count',
'role': 'role'
})
worker_params.update({'role': 'role'})
return master_params, worker_params

def _handle_nodegroup_param_map(self, nodegroup, param_map):


+ 12
- 0
magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml View File

@@ -7,6 +7,18 @@ description: >

parameters:

is_cluster_stack:
type: boolean
default: false

master_role:
type: string
default: ""

worker_role:
type: string
default: ""

octavia_enabled:
type: string
default: true


+ 28
- 17
magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml View File

@@ -6,28 +6,35 @@ description: >
defaults to 1).

conditions:
master_only:
or:
create_cluster_resources:
equals:
- get_param: is_cluster_stack
- true

is_master:
and:
- equals:
- get_param: role
- get_param: master_role
- "master"
- equals:
- get_param: is_cluster_stack
- true
- get_param: worker_role
- ""

worker_only:
is_worker:
not:
equals:
- get_param: worker_role
- ""

master_only:
or:
- equals:
- get_param: role
- "worker"
- equals:
- get_param: is_cluster_stack
- true
- create_cluster_resources
- is_master

create_cluster_resources:
equals:
- get_param: is_cluster_stack
- true
worker_only:
or:
- create_cluster_resources
- is_worker

parameters:

@@ -40,7 +47,11 @@ parameters:
type: boolean
default: false

role:
master_role:
type: string
default: ""

worker_role:
type: string
default: ""



+ 28
- 17
magnum/drivers/k8s_fedora_coreos_v1/templates/kubecluster.yaml View File

@@ -6,28 +6,35 @@ description: >
defaults to 1).

conditions:
master_only:
or:
create_cluster_resources:
equals:
- get_param: is_cluster_stack
- true

is_master:
and:
- equals:
- get_param: role
- get_param: master_role
- "master"
- equals:
- get_param: is_cluster_stack
- true
- get_param: worker_role
- ""

worker_only:
is_worker:
not:
equals:
- get_param: worker_role
- ""

master_only:
or:
- equals:
- get_param: role
- "worker"
- equals:
- get_param: is_cluster_stack
- true
- create_cluster_resources
- is_master

create_cluster_resources:
equals:
- get_param: is_cluster_stack
- true
worker_only:
or:
- create_cluster_resources
- is_worker

parameters:

@@ -40,7 +47,11 @@ parameters:
type: boolean
default: false

role:
master_role:
type: string
default: ""

worker_role:
type: string
default: ""



+ 12
- 0
magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml View File

@@ -7,6 +7,18 @@ description: >

parameters:

is_cluster_stack:
type: boolean
default: false

master_role:
type: string
default: ""

worker_role:
type: string
default: ""

ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server


+ 4
- 0
magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml View File

@@ -8,6 +8,10 @@ description: >

parameters:

is_cluster_stack:
type: boolean
default: false

ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server


+ 4
- 0
magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml View File

@@ -13,6 +13,10 @@ parameters:
#
# REQUIRED PARAMETERS
#
is_cluster_stack:
type: boolean
default: false

ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server


+ 4
- 0
magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml View File

@@ -13,6 +13,10 @@ parameters:
#
# REQUIRED PARAMETERS
#
is_cluster_stack:
type: boolean
default: false

ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server


+ 12
- 6
magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py View File

@@ -369,7 +369,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'boot_volume_size': '60',
'boot_volume_type': 'lvmdriver-1',
'etcd_volume_type': 'lvmdriver-1',
'role': 'master'
'master_role': 'master',
'worker_role': 'worker',
}

if missing_attr is not None:
@@ -517,7 +518,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'boot_volume_size': '60',
'boot_volume_type': 'lvmdriver-1',
'etcd_volume_type': 'lvmdriver-1',
'role': 'master',
'master_role': 'master',
'worker_role': 'worker',
}

self.assertEqual(expected, definition)
@@ -647,7 +649,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'boot_volume_type': 'lvmdriver-1',
'etcd_volume_type': 'lvmdriver-1',
'keystone_auth_default_policy': self.keystone_auth_default_policy,
'role': 'master',
'master_role': 'master',
'worker_role': 'worker',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -756,7 +759,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'kubeproxy_options': '--kubeproxy',
'octavia_enabled': False,
'portal_network_cidr': '10.254.0.0/16',
'role': 'master',
'master_role': 'master',
'worker_role': 'worker',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -863,7 +867,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'kubeproxy_options': '--kubeproxy',
'octavia_enabled': False,
'portal_network_cidr': '10.254.0.0/16',
'role': 'master',
'master_role': 'master',
'worker_role': 'worker',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -1093,7 +1098,8 @@ class TestClusterConductorWithK8s(base.TestCase):
'boot_volume_size': '60',
'boot_volume_type': 'lvmdriver-1',
'etcd_volume_type': 'lvmdriver-1',
'role': 'master'
'master_role': 'master',
'worker_role': 'worker',
}
self.assertEqual(expected, definition)
self.assertEqual(


+ 0
- 5
magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py View File

@@ -188,7 +188,6 @@ class TestClusterConductorWithMesos(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -255,7 +254,6 @@ class TestClusterConductorWithMesos(base.TestCase):
'slave_flavor': 'flavor_id',
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -327,7 +325,6 @@ class TestClusterConductorWithMesos(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -403,7 +400,6 @@ class TestClusterConductorWithMesos(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -477,7 +473,6 @@ class TestClusterConductorWithMesos(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(


+ 0
- 6
magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py View File

@@ -213,7 +213,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': u'master',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -300,7 +299,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': u'master',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -382,7 +380,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'node_flavor': 'flavor_id',
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': 'master'
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -467,7 +464,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': u'master',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -556,7 +552,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': u'master',
}
self.assertEqual(expected, definition)
self.assertEqual(
@@ -643,7 +638,6 @@ class TestClusterConductorWithSwarm(base.TestCase):
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity',
'role': u'master',
}
self.assertEqual(expected, definition)
self.assertEqual(


Loading…
Cancel
Save