[suse] Allow k8s cluster without floating ip

With this patch k8s opensuse cluster can be created
without floating ip.

Change-Id: Id0da2057bcf6b1ad518fed3aadb7141caddc4955
This commit is contained in:
yatin 2016-10-17 16:28:59 +05:30
parent c00d197954
commit 9b10456a58
4 changed files with 28 additions and 19 deletions

View File

@ -51,10 +51,21 @@ class JeOSK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
**kwargs)
def get_env_files(self, cluster_template):
env_files = []
if cluster_template.master_lb_enabled:
return [template_def.COMMON_ENV_PATH + 'with_master_lb.yaml']
env_files.append(
template_def.COMMON_ENV_PATH + 'with_master_lb.yaml')
else:
return [template_def.COMMON_ENV_PATH + 'no_master_lb.yaml']
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 template_path(self):

View File

@ -438,6 +438,18 @@ resources:
pool_private_ip: {get_attr: [etcd_loadbalancer, vip_address]}
master_private_ip: {get_attr: [kube_masters, resource.0.kube_master_ip]}
######################################################################
#
# resources that expose the IPs of either floating ip or a given
# fixed ip depending on whether FloatingIP is enabled for the cluster.
#
api_address_floating_switch:
type: Magnum::FloatingIPAddressSwitcher
properties:
public_ip: {get_attr: [api_address_lb_switch, public_ip]}
private_ip: {get_attr: [api_address_lb_switch, private_ip]}
######################################################################
#
# kubernetes masters. This is a resource group that will create
@ -542,7 +554,7 @@ outputs:
str_replace:
template: api_ip_address
params:
api_ip_address: {get_attr: [api_address_switch, public_ip]}
api_ip_address: {get_attr: [api_address_floating_switch, ip_address]}
description: >
This is the API endpoint of the Kubernetes server. Use this to access
the Kubernetes API from outside the cluster.

View File

@ -158,20 +158,6 @@ resources:
handle: {get_resource: master_wait_handle}
timeout: {get_param: wait_condition_timeout}
######################################################################
#
# resource that exposes the IPs of either the kube master or the API
# LBaaS pool depending on whether LBaaS is enabled for the bay.
#
api_address_switch:
type: Magnum::ApiGatewaySwitcher
properties:
pool_public_ip: {get_param: api_public_address}
pool_private_ip: {get_param: api_private_address}
master_public_ip: {get_attr: [kube_master_floating, floating_ip_address]}
master_private_ip: {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]}
######################################################################
#
# software configs. these are components that are combined into
@ -292,7 +278,7 @@ resources:
replacement_policy: AUTO
kube_master_floating:
type: OS::Neutron::FloatingIP
type: Magnum::Optional::KubeMaster::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: kube_master_eth0}

View File

@ -301,7 +301,7 @@ resources:
replacement_policy: AUTO
kube_minion_floating:
type: OS::Neutron::FloatingIP
type: Magnum::Optional::KubeMinion::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: kube_minion_eth0}