From 2c635692aef8031a7212fbca18570d6700ad40cf Mon Sep 17 00:00:00 2001 From: Spyros Trigazis Date: Fri, 9 Sep 2016 11:27:32 +0200 Subject: [PATCH] Split k8s atomic vm and ironic drivers The 2 k8s atomic drivers we currently support are added to the same driver. This breaks ironic support with the stevedore work I'm currently doing. With stevedore, we can choose only one driver based on the server_type, os and coe. We won't be able to pick a driver and then choose an implementation bases on server_type. Partially-Implements: blueprint magnum-baremetal-full-support Co-Authored-By: Spyros Trigazis Change-Id: Ic1b8103551f48f85baa2ed9ff32d5b70b1fab84e --- .../drivers/common/k8s_fedora_template_def.py | 96 ++++++++++++ .../kubernetes}/fragments/add-proxy.sh | 0 .../kubernetes}/fragments/configure-etcd.sh | 0 .../fragments/configure-flannel.sh | 0 .../fragments/configure-kubernetes-master.sh | 0 .../fragments/configure-kubernetes-minion.sh | 0 .../kubernetes}/fragments/disable-selinux.sh | 0 .../kubernetes}/fragments/enable-etcd.sh | 0 .../fragments/enable-kube-podmaster.sh | 0 .../fragments/enable-kube-proxy-master.sh | 0 .../fragments/enable-kube-proxy-minion.sh | 0 .../fragments/enable-services-master.sh | 0 .../fragments/enable-services-minion.sh | 0 .../kubernetes}/fragments/kube-examples.yaml | 0 .../kube-system-namespace-service.sh | 0 .../kubernetes}/fragments/kube-ui-service.sh | 0 .../kubernetes}/fragments/make-cert-client.sh | 0 .../kubernetes}/fragments/make-cert.sh | 0 .../fragments/network-config-service.sh | 0 .../kubernetes}/fragments/network-service.sh | 0 .../kubernetes}/fragments/wc-notify-master.sh | 0 .../fragments/write-heat-params-master.yaml | 0 .../fragments/write-heat-params.yaml | 0 .../fragments/write-kube-os-config.sh | 0 .../fragments/write-kubeconfig.yaml | 0 .../fragments/write-network-config.sh | 0 .../k8s_fedora_atomic_v1/template_def.py | 139 +----------------- .../templates/elements/README.md | 29 ---- .../elements/kubernetes/elements-deps | 1 - .../elements/kubernetes/package-installs.yaml | 4 - .../templates/kubemaster.yaml | 34 ++--- .../templates/kubeminion.yaml | 20 +-- .../drivers/k8s_fedora_ironic_v1/__init__.py | 0 .../image}/kubernetes/Readme.md | 0 .../image}/kubernetes/elements-deps | 0 .../image}/kubernetes/package-installs.yaml | 0 .../k8s_fedora_ironic_v1/template_def.py | 84 +++++++++++ .../templates/kubecluster.yaml} | 4 +- .../templates/kubemaster.yaml} | 34 ++--- .../templates/kubeminion.yaml} | 20 +-- .../unit/drivers/test_template_definition.py | 3 +- setup.cfg | 2 +- 42 files changed, 241 insertions(+), 229 deletions(-) create mode 100644 magnum/drivers/common/k8s_fedora_template_def.py rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/add-proxy.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/configure-etcd.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/configure-flannel.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/configure-kubernetes-master.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/configure-kubernetes-minion.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/disable-selinux.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-etcd.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-kube-podmaster.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-kube-proxy-master.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-kube-proxy-minion.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-services-master.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/enable-services-minion.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/kube-examples.yaml (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/kube-system-namespace-service.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/kube-ui-service.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/make-cert-client.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/make-cert.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/network-config-service.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/network-service.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/wc-notify-master.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/write-heat-params-master.yaml (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/write-heat-params.yaml (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/write-kube-os-config.sh (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/write-kubeconfig.yaml (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates => common/templates/kubernetes}/fragments/write-network-config.sh (100%) delete mode 100644 magnum/drivers/k8s_fedora_atomic_v1/templates/elements/README.md delete mode 100644 magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/elements-deps delete mode 100644 magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/package-installs.yaml create mode 100644 magnum/drivers/k8s_fedora_ironic_v1/__init__.py rename magnum/drivers/{k8s_fedora_atomic_v1/image/ironic => k8s_fedora_ironic_v1/image}/kubernetes/Readme.md (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/image/ironic => k8s_fedora_ironic_v1/image}/kubernetes/elements-deps (100%) rename magnum/drivers/{k8s_fedora_atomic_v1/image/ironic => k8s_fedora_ironic_v1/image}/kubernetes/package-installs.yaml (100%) create mode 100644 magnum/drivers/k8s_fedora_ironic_v1/template_def.py rename magnum/drivers/{k8s_fedora_atomic_v1/templates/kubecluster-fedora-ironic.yaml => k8s_fedora_ironic_v1/templates/kubecluster.yaml} (99%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates/kubemaster-fedora-ironic.yaml => k8s_fedora_ironic_v1/templates/kubemaster.yaml} (87%) rename magnum/drivers/{k8s_fedora_atomic_v1/templates/kubeminion-fedora-ironic.yaml => k8s_fedora_ironic_v1/templates/kubeminion.yaml} (92%) diff --git a/magnum/drivers/common/k8s_fedora_template_def.py b/magnum/drivers/common/k8s_fedora_template_def.py new file mode 100644 index 0000000000..67d4671333 --- /dev/null +++ b/magnum/drivers/common/k8s_fedora_template_def.py @@ -0,0 +1,96 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_log import log as logging + +from magnum.drivers.common import k8s_template_def +from magnum.drivers.common import template_def +from oslo_config import cfg + +CONF = cfg.CONF + +LOG = logging.getLogger(__name__) + + +class ServerAddressOutputMapping(template_def.OutputMapping): + + public_ip_output_key = None + private_ip_output_key = None + + def __init__(self, dummy_arg, cluster_attr=None): + self.cluster_attr = cluster_attr + self.heat_output = self.public_ip_output_key + + def set_output(self, stack, cluster_template, cluster): + if not cluster_template.floating_ip_enabled: + self.heat_output = self.private_ip_output_key + + LOG.debug("Using heat_output: %s", self.heat_output) + super(ServerAddressOutputMapping, + self).set_output(stack, cluster_template, cluster) + + +class MasterAddressOutputMapping(ServerAddressOutputMapping): + public_ip_output_key = 'kube_masters' + private_ip_output_key = 'kube_masters_private' + + +class NodeAddressOutputMapping(ServerAddressOutputMapping): + public_ip_output_key = 'kube_minions' + private_ip_output_key = 'kube_minions_private' + + +class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition): + """Kubernetes template for a Fedora.""" + + def __init__(self): + super(K8sFedoraTemplateDefinition, self).__init__() + self.add_parameter('docker_volume_size', + cluster_template_attr='docker_volume_size') + self.add_parameter('docker_storage_driver', + cluster_template_attr='docker_storage_driver') + self.add_output('kube_minions', + cluster_attr='node_addresses', + mapping_type=NodeAddressOutputMapping) + self.add_output('kube_masters', + cluster_attr='master_addresses', + mapping_type=MasterAddressOutputMapping) + + def get_params(self, context, cluster_template, cluster, **kwargs): + extra_params = kwargs.pop('extra_params', {}) + + extra_params['username'] = context.user_name + extra_params['tenant_name'] = context.tenant + osc = self.get_osc(context) + extra_params['region_name'] = osc.cinder_region_name() + + return super(K8sFedoraTemplateDefinition, + self).get_params(context, cluster_template, cluster, + extra_params=extra_params, + **kwargs) + + def get_env_files(self, cluster_template): + env_files = [] + if cluster_template.master_lb_enabled: + env_files.append( + template_def.COMMON_ENV_PATH + 'with_master_lb.yaml') + else: + env_files.append( + template_def.COMMON_ENV_PATH + 'no_master_lb.yaml') + if cluster_template.floating_ip_enabled: + env_files.append( + template_def.COMMON_ENV_PATH + 'enable_floating_ip.yaml') + else: + env_files.append( + template_def.COMMON_ENV_PATH + 'disable_floating_ip.yaml') + + return env_files diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/add-proxy.sh b/magnum/drivers/common/templates/kubernetes/fragments/add-proxy.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/add-proxy.sh rename to magnum/drivers/common/templates/kubernetes/fragments/add-proxy.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-etcd.sh b/magnum/drivers/common/templates/kubernetes/fragments/configure-etcd.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-etcd.sh rename to magnum/drivers/common/templates/kubernetes/fragments/configure-etcd.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-flannel.sh b/magnum/drivers/common/templates/kubernetes/fragments/configure-flannel.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-flannel.sh rename to magnum/drivers/common/templates/kubernetes/fragments/configure-flannel.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-kubernetes-master.sh b/magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-kubernetes-master.sh rename to magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-kubernetes-minion.sh b/magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/configure-kubernetes-minion.sh rename to magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/disable-selinux.sh b/magnum/drivers/common/templates/kubernetes/fragments/disable-selinux.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/disable-selinux.sh rename to magnum/drivers/common/templates/kubernetes/fragments/disable-selinux.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-etcd.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-etcd.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-etcd.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-etcd.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-podmaster.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-kube-podmaster.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-podmaster.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-kube-podmaster.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-proxy-master.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-kube-proxy-master.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-proxy-master.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-kube-proxy-master.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-proxy-minion.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-kube-proxy-minion.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-kube-proxy-minion.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-kube-proxy-minion.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-services-master.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-services-master.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-services-master.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-services-master.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-services-minion.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-services-minion.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/enable-services-minion.sh rename to magnum/drivers/common/templates/kubernetes/fragments/enable-services-minion.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-examples.yaml b/magnum/drivers/common/templates/kubernetes/fragments/kube-examples.yaml similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-examples.yaml rename to magnum/drivers/common/templates/kubernetes/fragments/kube-examples.yaml diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-system-namespace-service.sh b/magnum/drivers/common/templates/kubernetes/fragments/kube-system-namespace-service.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-system-namespace-service.sh rename to magnum/drivers/common/templates/kubernetes/fragments/kube-system-namespace-service.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-ui-service.sh b/magnum/drivers/common/templates/kubernetes/fragments/kube-ui-service.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/kube-ui-service.sh rename to magnum/drivers/common/templates/kubernetes/fragments/kube-ui-service.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/make-cert-client.sh b/magnum/drivers/common/templates/kubernetes/fragments/make-cert-client.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/make-cert-client.sh rename to magnum/drivers/common/templates/kubernetes/fragments/make-cert-client.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/make-cert.sh b/magnum/drivers/common/templates/kubernetes/fragments/make-cert.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/make-cert.sh rename to magnum/drivers/common/templates/kubernetes/fragments/make-cert.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/network-config-service.sh b/magnum/drivers/common/templates/kubernetes/fragments/network-config-service.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/network-config-service.sh rename to magnum/drivers/common/templates/kubernetes/fragments/network-config-service.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/network-service.sh b/magnum/drivers/common/templates/kubernetes/fragments/network-service.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/network-service.sh rename to magnum/drivers/common/templates/kubernetes/fragments/network-service.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/wc-notify-master.sh b/magnum/drivers/common/templates/kubernetes/fragments/wc-notify-master.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/wc-notify-master.sh rename to magnum/drivers/common/templates/kubernetes/fragments/wc-notify-master.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-heat-params-master.yaml b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-heat-params-master.yaml rename to magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-heat-params.yaml b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params.yaml similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-heat-params.yaml rename to magnum/drivers/common/templates/kubernetes/fragments/write-heat-params.yaml diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-kube-os-config.sh b/magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-kube-os-config.sh rename to magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-kubeconfig.yaml b/magnum/drivers/common/templates/kubernetes/fragments/write-kubeconfig.yaml similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-kubeconfig.yaml rename to magnum/drivers/common/templates/kubernetes/fragments/write-kubeconfig.yaml diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-network-config.sh b/magnum/drivers/common/templates/kubernetes/fragments/write-network-config.sh similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/fragments/write-network-config.sh rename to magnum/drivers/common/templates/kubernetes/fragments/write-network-config.sh diff --git a/magnum/drivers/k8s_fedora_atomic_v1/template_def.py b/magnum/drivers/k8s_fedora_atomic_v1/template_def.py index ad9db4bf4c..a3d9654bed 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/template_def.py +++ b/magnum/drivers/k8s_fedora_atomic_v1/template_def.py @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from neutronclient.common import exceptions as n_exception -from neutronclient.neutron import v2_0 as neutronV20 import os from oslo_log import log as logging -from magnum.common import exception -from magnum.drivers.common import k8s_template_def -from magnum.drivers.common import template_def +from magnum.drivers.common import k8s_fedora_template_def as kftd from oslo_config import cfg CONF = cfg.CONF @@ -27,35 +23,7 @@ CONF = cfg.CONF LOG = logging.getLogger(__name__) -class ServerAddressOutputMapping(template_def.OutputMapping): - - public_ip_output_key = None - private_ip_output_key = None - - def __init__(self, dummy_arg, cluster_attr=None): - self.cluster_attr = cluster_attr - self.heat_output = self.public_ip_output_key - - def set_output(self, stack, cluster_template, cluster): - if not cluster_template.floating_ip_enabled: - self.heat_output = self.private_ip_output_key - - LOG.debug("Using heat_output: %s", self.heat_output) - super(ServerAddressOutputMapping, - self).set_output(stack, cluster_template, cluster) - - -class MasterAddressOutputMapping(ServerAddressOutputMapping): - public_ip_output_key = 'kube_masters' - private_ip_output_key = 'kube_masters_private' - - -class NodeAddressOutputMapping(ServerAddressOutputMapping): - public_ip_output_key = 'kube_minions' - private_ip_output_key = 'kube_minions_private' - - -class AtomicK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition): +class AtomicK8sTemplateDefinition(kftd.K8sFedoraTemplateDefinition): """Kubernetes template for a Fedora Atomic VM.""" provides = [ @@ -64,49 +32,6 @@ class AtomicK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition): 'coe': 'kubernetes'}, ] - def __init__(self): - super(AtomicK8sTemplateDefinition, self).__init__() - self.add_parameter('docker_volume_size', - cluster_template_attr='docker_volume_size') - self.add_parameter('docker_storage_driver', - cluster_template_attr='docker_storage_driver') - self.add_output('kube_minions', - cluster_attr='node_addresses', - mapping_type=NodeAddressOutputMapping) - self.add_output('kube_masters', - cluster_attr='master_addresses', - mapping_type=MasterAddressOutputMapping) - - def get_params(self, context, cluster_template, cluster, **kwargs): - extra_params = kwargs.pop('extra_params', {}) - - extra_params['username'] = context.user_name - extra_params['tenant_name'] = context.tenant - osc = self.get_osc(context) - extra_params['region_name'] = osc.cinder_region_name() - - return super(AtomicK8sTemplateDefinition, - self).get_params(context, cluster_template, cluster, - extra_params=extra_params, - **kwargs) - - def get_env_files(self, cluster_template): - env_files = [] - if cluster_template.master_lb_enabled: - env_files.append( - template_def.COMMON_ENV_PATH + 'with_master_lb.yaml') - else: - env_files.append( - template_def.COMMON_ENV_PATH + 'no_master_lb.yaml') - if cluster_template.floating_ip_enabled: - env_files.append( - template_def.COMMON_ENV_PATH + 'enable_floating_ip.yaml') - else: - env_files.append( - template_def.COMMON_ENV_PATH + 'disable_floating_ip.yaml') - - return env_files - @property def driver_module_path(self): return __name__[:__name__.rindex('.')] @@ -115,63 +40,3 @@ class AtomicK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition): def template_path(self): return os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates/kubecluster.yaml') - - -class FedoraK8sIronicTemplateDefinition(AtomicK8sTemplateDefinition): - """Kubernetes template for a Fedora Baremetal.""" - - provides = [ - {'server_type': 'bm', - 'os': 'fedora', - 'coe': 'kubernetes'}, - ] - - def __init__(self): - super(FedoraK8sIronicTemplateDefinition, self).__init__() - self.add_parameter('fixed_subnet', - cluster_template_attr='fixed_subnet', - param_type=str, - required=True) - - def get_fixed_network_id(self, osc, cluster_template): - try: - subnet = neutronV20.find_resource_by_name_or_id( - osc.neutron(), - 'subnet', - cluster_template.fixed_subnet - ) - except n_exception.NeutronException as e: - # NOTE(yuanying): NeutronCLIError doesn't have status_code - # if subnet name is duplicated, NeutronClientNoUniqueMatch - # (which is kind of NeutronCLIError) will be raised. - if getattr(e, 'status_code', 400) < 500: - raise exception.InvalidSubnet(message=("%s" % e)) - else: - raise e - - if subnet['ip_version'] != 4: - raise exception.InvalidSubnet( - message="Subnet IP version should be 4" - ) - - return subnet['network_id'] - - def get_params(self, context, cluster_template, cluster, **kwargs): - ep = kwargs.pop('extra_params', {}) - - osc = self.get_osc(context) - ep['fixed_network'] = self.get_fixed_network_id(osc, cluster_template) - - return super(FedoraK8sIronicTemplateDefinition, - self).get_params(context, cluster_template, cluster, - extra_params=ep, - **kwargs) - - @property - def driver_module_path(self): - return __name__[:__name__.rindex('.')] - - @property - def template_path(self): - return os.path.join(os.path.dirname(os.path.realpath(__file__)), - 'templates/kubecluster-fedora-ironic.yaml') diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/README.md b/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/README.md deleted file mode 100644 index f996087c98..0000000000 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/README.md +++ /dev/null @@ -1,29 +0,0 @@ -Kubernetes elements -=================== - -This directory contains `[diskimage-builder](https://github.com/openstack/diskimage-builder)` -elements to build an image which contains kubernetes required to use kubecluster-fedora-ironic.yaml. - -An example fedora based image and uploaded to glance with the following: - - git clone https://git.openstack.org/openstack/magnum - git clone https://git.openstack.org/openstack/diskimage-builder.git - git clone https://git.openstack.org/openstack/tripleo-image-elements.git - git clone https://git.openstack.org/openstack/heat-templates.git - git clone https://git.openstack.org/openstack/dib-utils.git - export PATH="${PWD}/dib-utils/bin:$PATH" - export ELEMENTS_PATH=tripleo-image-elements/elements:heat-templates/hot/software-config/elements - export ELEMENTS_PATH=${ELEMENTS_PATH}:magnum/etc/magnum/templates/kubernetes/elements - export DIB_RELEASE=21 - diskimage-builder/bin/disk-image-create baremetal \ - fedora selinux-permissive \ - os-collect-config \ - os-refresh-config \ - os-apply-config \ - heat-config-script \ - kubernetes \ - -o fedora-21-kubernetes.qcow2 - - KERNEL_ID=`glance image-create --name fedora-k8s-kernel --visibility public --disk-format=aki --container-format=aki --file=fedora-21-kubernetes.vmlinuz | grep id | tr -d '| ' | cut --bytes=3-57` - RAMDISK_ID=`glance image-create --name fedora-k8s-ramdisk --visibility public --disk-format=ari --container-format=ari --file=fedora-21-kubernetes.initrd | grep id | tr -d '| ' | cut --bytes=3-57` - BASE_ID=`glance image-create --name fedora-k8s --visibility public --disk-format=qcow2 --container-format=bare --property kernel_id=$KERNEL_ID --property ramdisk_id=$RAMDISK_ID --file=fedora-21-kubernetes.qcow2 | grep -v kernel | grep -v ramdisk | grep id | tr -d '| ' | cut --bytes=3-57` diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/elements-deps b/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/elements-deps deleted file mode 100644 index 7076aba945..0000000000 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/elements-deps +++ /dev/null @@ -1 +0,0 @@ -package-installs diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/package-installs.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/package-installs.yaml deleted file mode 100644 index ea99a147d8..0000000000 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/elements/kubernetes/package-installs.yaml +++ /dev/null @@ -1,4 +0,0 @@ -kubernetes: -etcd: -flannel: -docker-io: \ No newline at end of file diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml index 7a51f8a43b..74131fb4c4 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml +++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml @@ -221,7 +221,7 @@ resources: group: ungrouped config: str_replace: - template: {get_file: fragments/write-heat-params-master.yaml} + template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.yaml} params: "$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]} "$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]} @@ -259,7 +259,7 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/make-cert.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/make-cert.sh} configure_docker_storage: type: OS::Heat::SoftwareConfig @@ -275,91 +275,91 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-etcd.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-etcd.sh} write_kube_os_config: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-kube-os-config.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/write-kube-os-config.sh} configure_kubernetes: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-kubernetes-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-master.sh} write_network_config: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-network-config.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/write-network-config.sh} network_config_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-config-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-config-service.sh} enable_services: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-services-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-master.sh} kube_examples: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-examples.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml} network_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh} enable_kube_podmaster: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-podmaster.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-podmaster.sh} kube_system_namespace_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-system-namespace-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-system-namespace-service.sh} kube_ui_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-ui-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-ui-service.sh} enable_kube_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-proxy-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-master.sh} master_wc_notify: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/wc-notify-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/wc-notify-master.sh} disable_selinux: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/disable-selinux.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh} add_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/add-proxy.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh} kube_master_init: type: OS::Heat::MultipartMime diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml index f130b3903c..66e7631976 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml +++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml @@ -218,7 +218,7 @@ resources: group: ungrouped config: str_replace: - template: {get_file: fragments/write-heat-params.yaml} + template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params.yaml} params: $KUBE_ALLOW_PRIV: {get_param: kube_allow_priv} $KUBE_MASTER_IP: {get_param: kube_master_ip} @@ -260,13 +260,13 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-kubeconfig.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/write-kubeconfig.yaml} make_cert: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/make-cert-client.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/make-cert-client.sh} configure_docker_storage: type: OS::Heat::SoftwareConfig @@ -288,25 +288,25 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-kubernetes-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-minion.sh} kube_examples: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-examples.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml} network_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh} enable_services: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-services-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-minion.sh} enable_docker_registry: type: OS::Heat::SoftwareConfig @@ -318,7 +318,7 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-proxy-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-minion.sh} minion_wc_notify: type: OS::Heat::SoftwareConfig @@ -336,13 +336,13 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/disable-selinux.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh} add_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/add-proxy.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh} kube_minion_init: type: OS::Heat::MultipartMime diff --git a/magnum/drivers/k8s_fedora_ironic_v1/__init__.py b/magnum/drivers/k8s_fedora_ironic_v1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/Readme.md b/magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/Readme.md similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/Readme.md rename to magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/Readme.md diff --git a/magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/elements-deps b/magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/elements-deps similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/elements-deps rename to magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/elements-deps diff --git a/magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/package-installs.yaml b/magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/package-installs.yaml similarity index 100% rename from magnum/drivers/k8s_fedora_atomic_v1/image/ironic/kubernetes/package-installs.yaml rename to magnum/drivers/k8s_fedora_ironic_v1/image/kubernetes/package-installs.yaml diff --git a/magnum/drivers/k8s_fedora_ironic_v1/template_def.py b/magnum/drivers/k8s_fedora_ironic_v1/template_def.py new file mode 100644 index 0000000000..57f041359f --- /dev/null +++ b/magnum/drivers/k8s_fedora_ironic_v1/template_def.py @@ -0,0 +1,84 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutronclient.common import exceptions as n_exception +from neutronclient.neutron import v2_0 as neutronV20 +import os +from oslo_log import log as logging + +from magnum.common import exception +from magnum.drivers.common import k8s_fedora_template_def as kftd +from oslo_config import cfg + +CONF = cfg.CONF + +LOG = logging.getLogger(__name__) + + +class FedoraK8sIronicTemplateDefinition(kftd.K8sFedoraTemplateDefinition): + """Kubernetes template for a Fedora Baremetal.""" + + provides = [ + {'server_type': 'bm', + 'os': 'fedora', + 'coe': 'kubernetes'}, + ] + + def __init__(self): + super(FedoraK8sIronicTemplateDefinition, self).__init__() + self.add_parameter('fixed_subnet', + cluster_template_attr='fixed_subnet', + param_type=str, + required=True) + + def get_fixed_network_id(self, osc, cluster_template): + try: + subnet = neutronV20.find_resource_by_name_or_id( + osc.neutron(), + 'subnet', + cluster_template.fixed_subnet + ) + except n_exception.NeutronException as e: + # NOTE(yuanying): NeutronCLIError doesn't have status_code + # if subnet name is duplicated, NeutronClientNoUniqueMatch + # (which is kind of NeutronCLIError) will be raised. + if getattr(e, 'status_code', 400) < 500: + raise exception.InvalidSubnet(message=("%s" % e)) + else: + raise e + + if subnet['ip_version'] != 4: + raise exception.InvalidSubnet( + message="Subnet IP version should be 4" + ) + + return subnet['network_id'] + + def get_params(self, context, cluster_template, cluster, **kwargs): + ep = kwargs.pop('extra_params', {}) + + osc = self.get_osc(context) + ep['fixed_network'] = self.get_fixed_network_id(osc, cluster_template) + + return super(FedoraK8sIronicTemplateDefinition, + self).get_params(context, cluster_template, cluster, + extra_params=ep, + **kwargs) + + @property + def driver_module_path(self): + return __name__[:__name__.rindex('.')] + + @property + def template_path(self): + return os.path.join(os.path.dirname(os.path.realpath(__file__)), + 'templates/kubecluster.yaml') diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster-fedora-ironic.yaml b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml similarity index 99% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster-fedora-ironic.yaml rename to magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml index f585fb5b2d..57278fbf8d 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster-fedora-ironic.yaml +++ b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml @@ -421,7 +421,7 @@ resources: properties: count: {get_param: number_of_masters} resource_def: - type: kubemaster-fedora-ironic.yaml + type: kubemaster.yaml properties: api_public_address: {get_attr: [api_pool_floating, floating_ip_address]} api_private_address: {get_attr: [api_loadbalancer, vip_address]} @@ -473,7 +473,7 @@ resources: count: {get_param: number_of_minions} removal_policies: [{resource_list: {get_param: minions_to_remove}}] resource_def: - type: kubeminion-fedora-ironic.yaml + type: kubeminion.yaml properties: ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster-fedora-ironic.yaml b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubemaster.yaml similarity index 87% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster-fedora-ironic.yaml rename to magnum/drivers/k8s_fedora_ironic_v1/templates/kubemaster.yaml index c0ae62ae53..67597f8e96 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster-fedora-ironic.yaml +++ b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubemaster.yaml @@ -215,7 +215,7 @@ resources: group: ungrouped config: str_replace: - template: {get_file: fragments/write-heat-params-master.yaml} + template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.yaml} params: "$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]} "$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]} @@ -252,7 +252,7 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/make-cert.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/make-cert.sh} configure_docker_storage: type: OS::Heat::SoftwareConfig @@ -268,91 +268,91 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-etcd.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-etcd.sh} write_kube_os_config: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-kube-os-config.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/write-kube-os-config.sh} configure_kubernetes: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-kubernetes-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-master.sh} write_network_config: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-network-config.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/write-network-config.sh} network_config_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-config-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-config-service.sh} enable_services: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-services-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-master.sh} kube_examples: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-examples.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml} network_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh} enable_kube_podmaster: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-podmaster.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-podmaster.sh} kube_system_namespace_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-system-namespace-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-system-namespace-service.sh} kube_ui_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-ui-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-ui-service.sh} enable_kube_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-proxy-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-master.sh} master_wc_notify: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/wc-notify-master.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/wc-notify-master.sh} disable_selinux: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/disable-selinux.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh} add_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/add-proxy.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh} kube_master_init: type: OS::Heat::MultipartMime diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion-fedora-ironic.yaml b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion.yaml similarity index 92% rename from magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion-fedora-ironic.yaml rename to magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion.yaml index 74bb01740a..1dc74598c5 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion-fedora-ironic.yaml +++ b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion.yaml @@ -212,7 +212,7 @@ resources: group: ungrouped config: str_replace: - template: {get_file: fragments/write-heat-params.yaml} + template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params.yaml} params: $KUBE_ALLOW_PRIV: {get_param: kube_allow_priv} $KUBE_MASTER_IP: {get_param: kube_master_ip} @@ -253,13 +253,13 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/write-kubeconfig.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/write-kubeconfig.yaml} make_cert: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/make-cert-client.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/make-cert-client.sh} configure_docker_storage: type: OS::Heat::SoftwareConfig @@ -281,25 +281,25 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/configure-kubernetes-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-minion.sh} kube_examples: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/kube-examples.yaml} + config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml} network_service: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/network-service.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh} enable_services: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-services-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-minion.sh} enable_docker_registry: type: OS::Heat::SoftwareConfig @@ -311,7 +311,7 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/enable-kube-proxy-minion.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-minion.sh} minion_wc_notify: type: OS::Heat::SoftwareConfig @@ -329,13 +329,13 @@ resources: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/disable-selinux.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh} add_proxy: type: OS::Heat::SoftwareConfig properties: group: ungrouped - config: {get_file: fragments/add-proxy.sh} + config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh} kube_minion_init: type: OS::Heat::MultipartMime diff --git a/magnum/tests/unit/drivers/test_template_definition.py b/magnum/tests/unit/drivers/test_template_definition.py index f2feca6933..f3320ef6ab 100644 --- a/magnum/tests/unit/drivers/test_template_definition.py +++ b/magnum/tests/unit/drivers/test_template_definition.py @@ -22,6 +22,7 @@ from magnum.common import exception from magnum.drivers.common import template_def as cmn_tdef from magnum.drivers.k8s_coreos_v1 import template_def as k8s_coreos_tdef from magnum.drivers.k8s_fedora_atomic_v1 import template_def as k8sa_tdef +from magnum.drivers.k8s_fedora_ironic_v1 import template_def as k8si_tdef from magnum.drivers.mesos_ubuntu_v1 import template_def as mesos_tdef from magnum.drivers.swarm_fedora_atomic_v1 import template_def as swarm_tdef from magnum.tests import base @@ -74,7 +75,7 @@ class TemplateDefinitionTestCase(base.TestCase): 'kubernetes') self.assertIsInstance(definition, - k8sa_tdef.FedoraK8sIronicTemplateDefinition) + k8si_tdef.FedoraK8sIronicTemplateDefinition) def test_get_vm_coreos_kubernetes_definition(self): definition = cmn_tdef.TemplateDefinition.get_template_definition( diff --git a/setup.cfg b/setup.cfg index 603555f858..2c74c09e13 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,7 +58,7 @@ oslo.config.opts.defaults = magnum = magnum.common.config:set_cors_middleware_defaults magnum.template_definitions = - magnum_bm_fedora_k8s = magnum.drivers.k8s_fedora_atomic_v1.template_def:FedoraK8sIronicTemplateDefinition + magnum_bm_fedora_k8s = magnum.drivers.k8s_fedora_ironic_v1.template_def:FedoraK8sIronicTemplateDefinition magnum_vm_atomic_k8s = magnum.drivers.k8s_fedora_atomic_v1.template_def:AtomicK8sTemplateDefinition magnum_vm_coreos_k8s = magnum.drivers.k8s_coreos_v1.template_def:CoreOSK8sTemplateDefinition magnum_vm_atomic_swarm = magnum.drivers.swarm_fedora_atomic_v1.template_def:AtomicSwarmTemplateDefinition