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 <strigazi@gmail.com>
Change-Id: Ic1b8103551f48f85baa2ed9ff32d5b70b1fab84e
This commit is contained in:
Spyros Trigazis 2016-09-09 11:27:32 +02:00
parent 8b354e3e10
commit 2c635692ae
42 changed files with 241 additions and 229 deletions

View File

@ -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

View File

@ -12,14 +12,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutronclient.common import exceptions as n_exception
from neutronclient.neutron import v2_0 as neutronV20
import os import os
from oslo_log import log as logging from oslo_log import log as logging
from magnum.common import exception from magnum.drivers.common import k8s_fedora_template_def as kftd
from magnum.drivers.common import k8s_template_def
from magnum.drivers.common import template_def
from oslo_config import cfg from oslo_config import cfg
CONF = cfg.CONF CONF = cfg.CONF
@ -27,35 +23,7 @@ CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class ServerAddressOutputMapping(template_def.OutputMapping): class AtomicK8sTemplateDefinition(kftd.K8sFedoraTemplateDefinition):
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):
"""Kubernetes template for a Fedora Atomic VM.""" """Kubernetes template for a Fedora Atomic VM."""
provides = [ provides = [
@ -64,49 +32,6 @@ class AtomicK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'coe': 'kubernetes'}, '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 @property
def driver_module_path(self): def driver_module_path(self):
return __name__[:__name__.rindex('.')] return __name__[:__name__.rindex('.')]
@ -115,63 +40,3 @@ class AtomicK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
def template_path(self): def template_path(self):
return os.path.join(os.path.dirname(os.path.realpath(__file__)), return os.path.join(os.path.dirname(os.path.realpath(__file__)),
'templates/kubecluster.yaml') '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')

View File

@ -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`

View File

@ -1,4 +0,0 @@
kubernetes:
etcd:
flannel:
docker-io:

View File

@ -221,7 +221,7 @@ resources:
group: ungrouped group: ungrouped
config: config:
str_replace: str_replace:
template: {get_file: fragments/write-heat-params-master.yaml} template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.yaml}
params: params:
"$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]} "$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]}
"$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]} "$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]}
@ -259,7 +259,7 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/make-cert.sh} config: {get_file: ../../common/templates/kubernetes/fragments/make-cert.sh}
configure_docker_storage: configure_docker_storage:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -275,91 +275,91 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-etcd.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-etcd.sh}
write_kube_os_config: write_kube_os_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: configure_kubernetes:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-kubernetes-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-master.sh}
write_network_config: write_network_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/write-network-config.sh} config: {get_file: ../../common/templates/kubernetes/fragments/write-network-config.sh}
network_config_service: network_config_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-config-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-config-service.sh}
enable_services: enable_services:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/enable-services-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-master.sh}
kube_examples: kube_examples:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-examples.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml}
network_service: network_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh}
enable_kube_podmaster: enable_kube_podmaster:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: kube_system_namespace_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: kube_ui_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-ui-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/kube-ui-service.sh}
enable_kube_proxy: enable_kube_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: master_wc_notify:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/wc-notify-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/wc-notify-master.sh}
disable_selinux: disable_selinux:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/disable-selinux.sh} config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh}
add_proxy: add_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/add-proxy.sh} config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh}
kube_master_init: kube_master_init:
type: OS::Heat::MultipartMime type: OS::Heat::MultipartMime

View File

@ -218,7 +218,7 @@ resources:
group: ungrouped group: ungrouped
config: config:
str_replace: str_replace:
template: {get_file: fragments/write-heat-params.yaml} template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params.yaml}
params: params:
$KUBE_ALLOW_PRIV: {get_param: kube_allow_priv} $KUBE_ALLOW_PRIV: {get_param: kube_allow_priv}
$KUBE_MASTER_IP: {get_param: kube_master_ip} $KUBE_MASTER_IP: {get_param: kube_master_ip}
@ -260,13 +260,13 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/write-kubeconfig.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/write-kubeconfig.yaml}
make_cert: make_cert:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/make-cert-client.sh} config: {get_file: ../../common/templates/kubernetes/fragments/make-cert-client.sh}
configure_docker_storage: configure_docker_storage:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -288,25 +288,25 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-kubernetes-minion.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-minion.sh}
kube_examples: kube_examples:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-examples.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml}
network_service: network_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh}
enable_services: enable_services:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/enable-services-minion.sh} config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-minion.sh}
enable_docker_registry: enable_docker_registry:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -318,7 +318,7 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: minion_wc_notify:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -336,13 +336,13 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/disable-selinux.sh} config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh}
add_proxy: add_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/add-proxy.sh} config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh}
kube_minion_init: kube_minion_init:
type: OS::Heat::MultipartMime type: OS::Heat::MultipartMime

View File

@ -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')

View File

@ -421,7 +421,7 @@ resources:
properties: properties:
count: {get_param: number_of_masters} count: {get_param: number_of_masters}
resource_def: resource_def:
type: kubemaster-fedora-ironic.yaml type: kubemaster.yaml
properties: properties:
api_public_address: {get_attr: [api_pool_floating, floating_ip_address]} api_public_address: {get_attr: [api_pool_floating, floating_ip_address]}
api_private_address: {get_attr: [api_loadbalancer, vip_address]} api_private_address: {get_attr: [api_loadbalancer, vip_address]}
@ -473,7 +473,7 @@ resources:
count: {get_param: number_of_minions} count: {get_param: number_of_minions}
removal_policies: [{resource_list: {get_param: minions_to_remove}}] removal_policies: [{resource_list: {get_param: minions_to_remove}}]
resource_def: resource_def:
type: kubeminion-fedora-ironic.yaml type: kubeminion.yaml
properties: properties:
ssh_key_name: {get_param: ssh_key_name} ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image} server_image: {get_param: server_image}

View File

@ -215,7 +215,7 @@ resources:
group: ungrouped group: ungrouped
config: config:
str_replace: str_replace:
template: {get_file: fragments/write-heat-params-master.yaml} template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.yaml}
params: params:
"$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]} "$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]}
"$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]} "$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]}
@ -252,7 +252,7 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/make-cert.sh} config: {get_file: ../../common/templates/kubernetes/fragments/make-cert.sh}
configure_docker_storage: configure_docker_storage:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -268,91 +268,91 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-etcd.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-etcd.sh}
write_kube_os_config: write_kube_os_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: configure_kubernetes:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-kubernetes-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-master.sh}
write_network_config: write_network_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/write-network-config.sh} config: {get_file: ../../common/templates/kubernetes/fragments/write-network-config.sh}
network_config_service: network_config_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-config-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-config-service.sh}
enable_services: enable_services:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/enable-services-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-master.sh}
kube_examples: kube_examples:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-examples.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml}
network_service: network_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh}
enable_kube_podmaster: enable_kube_podmaster:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: kube_system_namespace_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: kube_ui_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-ui-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/kube-ui-service.sh}
enable_kube_proxy: enable_kube_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: master_wc_notify:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/wc-notify-master.sh} config: {get_file: ../../common/templates/kubernetes/fragments/wc-notify-master.sh}
disable_selinux: disable_selinux:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/disable-selinux.sh} config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh}
add_proxy: add_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/add-proxy.sh} config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh}
kube_master_init: kube_master_init:
type: OS::Heat::MultipartMime type: OS::Heat::MultipartMime

View File

@ -212,7 +212,7 @@ resources:
group: ungrouped group: ungrouped
config: config:
str_replace: str_replace:
template: {get_file: fragments/write-heat-params.yaml} template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params.yaml}
params: params:
$KUBE_ALLOW_PRIV: {get_param: kube_allow_priv} $KUBE_ALLOW_PRIV: {get_param: kube_allow_priv}
$KUBE_MASTER_IP: {get_param: kube_master_ip} $KUBE_MASTER_IP: {get_param: kube_master_ip}
@ -253,13 +253,13 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/write-kubeconfig.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/write-kubeconfig.yaml}
make_cert: make_cert:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/make-cert-client.sh} config: {get_file: ../../common/templates/kubernetes/fragments/make-cert-client.sh}
configure_docker_storage: configure_docker_storage:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -281,25 +281,25 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/configure-kubernetes-minion.sh} config: {get_file: ../../common/templates/kubernetes/fragments/configure-kubernetes-minion.sh}
kube_examples: kube_examples:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/kube-examples.yaml} config: {get_file: ../../common/templates/kubernetes/fragments/kube-examples.yaml}
network_service: network_service:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/network-service.sh} config: {get_file: ../../common/templates/kubernetes/fragments/network-service.sh}
enable_services: enable_services:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/enable-services-minion.sh} config: {get_file: ../../common/templates/kubernetes/fragments/enable-services-minion.sh}
enable_docker_registry: enable_docker_registry:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -311,7 +311,7 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped 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: minion_wc_notify:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@ -329,13 +329,13 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/disable-selinux.sh} config: {get_file: ../../common/templates/kubernetes/fragments/disable-selinux.sh}
add_proxy: add_proxy:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: ungrouped group: ungrouped
config: {get_file: fragments/add-proxy.sh} config: {get_file: ../../common/templates/kubernetes/fragments/add-proxy.sh}
kube_minion_init: kube_minion_init:
type: OS::Heat::MultipartMime type: OS::Heat::MultipartMime

View File

@ -22,6 +22,7 @@ from magnum.common import exception
from magnum.drivers.common import template_def as cmn_tdef 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_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_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.mesos_ubuntu_v1 import template_def as mesos_tdef
from magnum.drivers.swarm_fedora_atomic_v1 import template_def as swarm_tdef from magnum.drivers.swarm_fedora_atomic_v1 import template_def as swarm_tdef
from magnum.tests import base from magnum.tests import base
@ -74,7 +75,7 @@ class TemplateDefinitionTestCase(base.TestCase):
'kubernetes') 'kubernetes')
self.assertIsInstance(definition, self.assertIsInstance(definition,
k8sa_tdef.FedoraK8sIronicTemplateDefinition) k8si_tdef.FedoraK8sIronicTemplateDefinition)
def test_get_vm_coreos_kubernetes_definition(self): def test_get_vm_coreos_kubernetes_definition(self):
definition = cmn_tdef.TemplateDefinition.get_template_definition( definition = cmn_tdef.TemplateDefinition.get_template_definition(

View File

@ -58,7 +58,7 @@ oslo.config.opts.defaults =
magnum = magnum.common.config:set_cors_middleware_defaults magnum = magnum.common.config:set_cors_middleware_defaults
magnum.template_definitions = 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_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_coreos_k8s = magnum.drivers.k8s_coreos_v1.template_def:CoreOSK8sTemplateDefinition
magnum_vm_atomic_swarm = magnum.drivers.swarm_fedora_atomic_v1.template_def:AtomicSwarmTemplateDefinition magnum_vm_atomic_swarm = magnum.drivers.swarm_fedora_atomic_v1.template_def:AtomicSwarmTemplateDefinition