From ce3c68424adef31ad0e67841432ce2d239991a1a Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Wed, 23 Nov 2016 16:17:19 +0100 Subject: [PATCH] Factorize load balancer code into its own template Heat types moved to lb.yaml: Neutron::LBaaS::LoadBalancer Neutron::LBaaS::Listener Neutron::LBaaS::Pool Neutron::LBaaS::HealthMonitor FloatingIP on LBaaS Closes-Bug: 1644454 Change-Id: I513b92c205ed97334033ba38ddf1d890ed61ff84 --- .../templates/environments/no_master_lb.yaml | 2 +- .../environments/with_master_lb.yaml | 2 +- magnum/drivers/common/templates/lb.yaml | 63 ++++++++++ .../k8s_coreos_v1/templates/kubecluster.yaml | 94 ++++---------- .../templates/kubecluster.yaml | 98 ++++----------- .../templates/kubecluster.yaml | 118 ++++++------------ .../templates/mesoscluster.yaml | 58 +++------ .../templates/cluster.yaml | 112 +++++------------ 8 files changed, 193 insertions(+), 354 deletions(-) create mode 100644 magnum/drivers/common/templates/lb.yaml diff --git a/magnum/drivers/common/templates/environments/no_master_lb.yaml b/magnum/drivers/common/templates/environments/no_master_lb.yaml index 10d8ba341b..e6c8d09638 100644 --- a/magnum/drivers/common/templates/environments/no_master_lb.yaml +++ b/magnum/drivers/common/templates/environments/no_master_lb.yaml @@ -8,7 +8,7 @@ resource_registry: "Magnum::Optional::Neutron::LBaaS::Listener": "OS::Heat::None" "Magnum::Optional::Neutron::LBaaS::Pool": "OS::Heat::None" "Magnum::Optional::Neutron::LBaaS::HealthMonitor": "OS::Heat::None" - "Magnum::Optional::Neutron::FloatingIP": "OS::Heat::None" + "Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Heat::None" # Master node template "Magnum::Optional::Neutron::LBaaS::PoolMember": "OS::Heat::None" diff --git a/magnum/drivers/common/templates/environments/with_master_lb.yaml b/magnum/drivers/common/templates/environments/with_master_lb.yaml index debdb0c502..deaa253caf 100644 --- a/magnum/drivers/common/templates/environments/with_master_lb.yaml +++ b/magnum/drivers/common/templates/environments/with_master_lb.yaml @@ -8,7 +8,7 @@ resource_registry: "Magnum::Optional::Neutron::LBaaS::Listener": "OS::Neutron::LBaaS::Listener" "Magnum::Optional::Neutron::LBaaS::Pool": "OS::Neutron::LBaaS::Pool" "Magnum::Optional::Neutron::LBaaS::HealthMonitor": "OS::Neutron::LBaaS::HealthMonitor" - "Magnum::Optional::Neutron::FloatingIP": "OS::Neutron::FloatingIP" + "Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Neutron::FloatingIP" # Master node template "Magnum::Optional::Neutron::LBaaS::PoolMember": "OS::Neutron::LBaaS::PoolMember" diff --git a/magnum/drivers/common/templates/lb.yaml b/magnum/drivers/common/templates/lb.yaml new file mode 100644 index 0000000000..fb928d5cf4 --- /dev/null +++ b/magnum/drivers/common/templates/lb.yaml @@ -0,0 +1,63 @@ +heat_template_version: 2014-10-16 + +parameters: + + fixed_subnet: + type: string + + external_network: + type: string + + protocol: + type: string + default: TCP + constraints: + - allowed_values: ["TCP", "HTTP"] + + port: + type: number + +resources: + loadbalancer: + type: Magnum::Optional::Neutron::LBaaS::LoadBalancer + properties: + vip_subnet: {get_param: fixed_subnet} + + listener: + type: Magnum::Optional::Neutron::LBaaS::Listener + properties: + loadbalancer: {get_resource: loadbalancer} + protocol: {get_param: loadbalancing_protocol} + protocol_port: {get_param: port} + + pool: + type: Magnum::Optional::Neutron::LBaaS::Pool + properties: + lb_algorithm: ROUND_ROBIN + listener: {get_resource: listener} + protocol: {get_param: loadbalancing_protocol} + + monitor: + type: Magnum::Optional::Neutron::LBaaS::HealthMonitor + properties: + type: TCP + delay: 5 + max_retries: 5 + timeout: 5 + pool: { get_resource: pool } + + floating: + type: Magnum::Optional::Neutron::LBaaS::FloatingIP + properties: + floating_network: {get_param: external_network} + port_id: {get_attr: [loadbalancer, vip_port_id]} + +outputs: + pool_id: + value: {get_resource: pool} + + address: + value: {get_attr: [loadbalancer, vip_address]} + + floating_address: + value: {get_attr: [floating, floating_ip_address]} diff --git a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml index 7879e582e5..8ada936d09 100644 --- a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml @@ -234,6 +234,22 @@ resources: router_id: {get_resource: extrouter} subnet: {get_resource: fixed_subnet} + api_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_param: fixed_subnet} + external_network: {get_param: external_network} + protocol: {get_param: loadbalancing_protocol} + port: {get_param: kubernetes_port} + + etcd_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_param: fixed_subnet} + external_network: {get_param: external_network} + protocol: HTTP + port: 2379 + ###################################################################### # # security groups. we need to permit network traffic of various @@ -272,74 +288,6 @@ resources: - protocol: tcp - protocol: udp - ###################################################################### - # - # load balancers. - # - api_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - api_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: api_loadbalancer} - protocol: {get_param: loadbalancing_protocol} - protocol_port: {get_param: kubernetes_port} - - api_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: api_listener} - protocol: {get_param: loadbalancing_protocol} - - api_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: api_pool } - - api_pool_floating: - type: Magnum::Optional::Neutron::FloatingIP - depends_on: - - extrouter_inside - properties: - floating_network: {get_param: external_network} - port_id: {get_attr: [api_loadbalancer, vip_port_id]} - - etcd_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - etcd_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: etcd_loadbalancer} - protocol: HTTP - protocol_port: 2379 - - etcd_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: etcd_listener} - protocol: HTTP - - etcd_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: etcd_pool } - ###################################################################### # # resources that expose the IPs of either the kube master or a given @@ -387,8 +335,8 @@ resources: resource_def: type: kubemaster.yaml properties: - api_public_address: {get_attr: [api_pool_floating, floating_ip_address]} - api_private_address: {get_attr: [api_loadbalancer, vip_address]} + api_public_address: {get_attr: [api_lb, floating_address]} + api_private_address: {get_attr: [api_lb, address]} ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} master_flavor: {get_param: master_flavor} @@ -411,8 +359,8 @@ resources: kube_version: {get_param: kube_version} wait_condition_timeout: {get_param: wait_condition_timeout} cluster_uuid: {get_param: cluster_uuid} - api_pool_id: {get_resource: api_pool} - etcd_pool_id: {get_resource: etcd_pool} + api_pool_id: {get_attr: [api_lb, pool_id]} + etcd_pool_id: {get_attr: [etcd_lb, pool_id]} magnum_url: {get_param: magnum_url} trustee_user_id: {get_param: trustee_user_id} trustee_password: {get_param: trustee_password} @@ -443,6 +391,7 @@ resources: fixed_subnet: {get_resource: fixed_subnet} flannel_network_cidr: {get_param: flannel_network_cidr} kube_master_ip: {get_attr: [api_address_lb_switch, private_ip]} + etcd_server_ip: {get_attr: [etcd_address_lb_switch, private_ip]} external_network: {get_param: external_network} kube_allow_priv: {get_param: kube_allow_priv} network_driver: {get_param: network_driver} @@ -453,7 +402,6 @@ resources: https_proxy: {get_param: https_proxy} no_proxy: {get_param: no_proxy} kube_version: {get_param: kube_version} - etcd_server_ip: {get_attr: [etcd_address_lb_switch, private_ip]} wait_condition_timeout: {get_param: wait_condition_timeout} cluster_uuid: {get_param: cluster_uuid} magnum_url: {get_param: magnum_url} diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml index 44336aaa3b..9e7807fcc0 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml @@ -298,6 +298,22 @@ resources: router_id: {get_resource: extrouter} subnet: {get_resource: fixed_subnet} + api_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_resource: fixed_subnet} + external_network: {get_param: external_network} + protocol: {get_param: loadbalancing_protocol} + port: {get_param: kubernetes_port} + + etcd_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_resource: fixed_subnet} + external_network: {get_param: external_network} + protocol: HTTP + port: 2379 + ###################################################################### # # security groups. we need to permit network traffic of various @@ -339,74 +355,6 @@ resources: - protocol: tcp - protocol: udp - ###################################################################### - # - # load balancers. - # - api_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - api_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: api_loadbalancer} - protocol: {get_param: loadbalancing_protocol} - protocol_port: {get_param: kubernetes_port} - - api_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: api_listener} - protocol: {get_param: loadbalancing_protocol} - - api_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: api_pool } - - api_pool_floating: - type: Magnum::Optional::Neutron::FloatingIP - depends_on: - - extrouter_inside - properties: - floating_network: {get_param: external_network} - port_id: {get_attr: [api_loadbalancer, vip_port_id]} - - etcd_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - etcd_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: etcd_loadbalancer} - protocol: HTTP - protocol_port: 2379 - - etcd_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: etcd_listener} - protocol: HTTP - - etcd_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: etcd_pool } - ###################################################################### # # resources that expose the IPs of either the kube master or a given @@ -416,15 +364,15 @@ resources: api_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_public_ip: {get_attr: [api_pool_floating, floating_ip_address]} - pool_private_ip: {get_attr: [api_loadbalancer, vip_address]} + pool_public_ip: {get_attr: [api_lb, floating_address]} + pool_private_ip: {get_attr: [api_lb, address]} master_public_ip: {get_attr: [kube_masters, resource.0.kube_master_external_ip]} master_private_ip: {get_attr: [kube_masters, resource.0.kube_master_ip]} etcd_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_private_ip: {get_attr: [etcd_loadbalancer, vip_address]} + pool_private_ip: {get_attr: [etcd_lb, address]} master_private_ip: {get_attr: [kube_masters, resource.0.kube_master_ip]} ###################################################################### @@ -454,8 +402,8 @@ resources: resource_def: type: kubemaster.yaml properties: - api_public_address: {get_attr: [api_pool_floating, floating_ip_address]} - api_private_address: {get_attr: [api_loadbalancer, vip_address]} + api_public_address: {get_attr: [api_lb, floating_address]} + api_private_address: {get_attr: [api_lb, address]} ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} master_flavor: {get_param: master_flavor} @@ -474,8 +422,8 @@ resources: magnum_url: {get_param: magnum_url} fixed_network: {get_resource: fixed_network} fixed_subnet: {get_resource: fixed_subnet} - api_pool_id: {get_resource: api_pool} - etcd_pool_id: {get_resource: etcd_pool} + api_pool_id: {get_attr: [api_lb, pool_id]} + etcd_pool_id: {get_attr: [etcd_lb, pool_id]} username: {get_param: username} password: {get_param: password} tenant_name: {get_param: tenant_name} diff --git a/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml index baec083fcd..7383396340 100644 --- a/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml @@ -278,6 +278,22 @@ parameters: resources: + api_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_param: fixed_subnet} + external_network: {get_param: external_network} + protocol: {get_param: loadbalancing_protocol} + port: {get_param: kubernetes_port} + + etcd_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_param: fixed_subnet} + external_network: {get_param: external_network} + protocol: HTTP + port: 2379 + ###################################################################### # # security groups. we need to permit network traffic of various @@ -324,92 +340,38 @@ resources: - protocol: tcp - protocol: udp - ###################################################################### - # - # load balancers. - # - api_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_param: fixed_subnet} - - api_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: api_loadbalancer} - protocol: {get_param: loadbalancing_protocol} - protocol_port: {get_param: kubernetes_port} - - api_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: api_listener} - protocol: {get_param: loadbalancing_protocol} - - api_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: api_pool } - - api_pool_floating: - type: Magnum::Optional::Neutron::FloatingIP - properties: - floating_network: {get_param: external_network} - port_id: {get_attr: [api_loadbalancer, vip_port_id]} - - etcd_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_param: fixed_subnet} - - etcd_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: etcd_loadbalancer} - protocol: HTTP - protocol_port: 2379 - - etcd_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: etcd_listener} - protocol: HTTP - - etcd_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: etcd_pool } - ###################################################################### # # resources that expose the IPs of either the kube master or a given # LBaaS pool depending on whether LBaaS is enabled for the cluster. # - api_address_switch: + api_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_public_ip: {get_attr: [api_pool_floating, floating_ip_address]} - pool_private_ip: {get_attr: [api_loadbalancer, vip_address]} + pool_public_ip: {get_attr: [api_lb, floating_address]} + pool_private_ip: {get_attr: [api_lb, address]} master_public_ip: {get_attr: [kube_masters, resource.0.kube_master_external_ip]} master_private_ip: {get_attr: [kube_masters, resource.0.kube_master_ip]} - etcd_address_switch: + etcd_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_private_ip: {get_attr: [etcd_loadbalancer, vip_address]} + pool_private_ip: {get_attr: [etcd_lb, 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 @@ -423,8 +385,8 @@ resources: resource_def: type: kubemaster.yaml properties: - api_public_address: {get_attr: [api_pool_floating, floating_ip_address]} - api_private_address: {get_attr: [api_loadbalancer, vip_address]} + api_public_address: {get_attr: [api_lb, floating_address]} + api_private_address: {get_attr: [api_lb, address]} ssh_key_name: {get_param: ssh_key_name} server_image: {get_param: server_image} master_flavor: {get_param: master_flavor} @@ -443,8 +405,8 @@ resources: magnum_url: {get_param: magnum_url} fixed_network: {get_param: fixed_network} fixed_subnet: {get_param: fixed_subnet} - api_pool_id: {get_resource: api_pool} - etcd_pool_id: {get_resource: etcd_pool} + api_pool_id: {get_attr: [api_lb, pool_id]} + etcd_pool_id: {get_attr: [etcd_lb, pool_id]} username: {get_param: username} password: {get_param: password} tenant_name: {get_param: tenant_name} @@ -483,8 +445,8 @@ resources: fixed_subnet: {get_param: fixed_subnet} network_driver: {get_param: network_driver} flannel_network_cidr: {get_param: flannel_network_cidr} - kube_master_ip: {get_attr: [api_address_switch, private_ip]} - etcd_server_ip: {get_attr: [etcd_address_switch, private_ip]} + kube_master_ip: {get_attr: [api_address_lb_switch, private_ip]} + etcd_server_ip: {get_attr: [etcd_address_lb_switch, private_ip]} external_network: {get_param: external_network} kube_allow_priv: {get_param: kube_allow_priv} docker_volume_size: {get_param: docker_volume_size} @@ -526,7 +488,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 cluster. Use this to access the Kubernetes API. diff --git a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml index 6881b029f2..f07f671ef6 100644 --- a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml +++ b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml @@ -227,6 +227,14 @@ resources: router_id: {get_resource: extrouter} subnet: {get_resource: fixed_subnet} + api_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_resource: fixed_subnet} + external_network: {get_param: external_network} + protocol: HTTP + port: 8080 + ###################################################################### # # security groups. we need to permit network traffic of various @@ -342,57 +350,19 @@ resources: config: {get_resource: start_services_master} servers: {get_attr: [mesos_masters, attributes, mesos_server_id]} - ###################################################################### - # - # load balancers. - # - api_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - api_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: api_loadbalancer} - protocol: HTTP - protocol_port: 8080 - - api_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: api_listener} - protocol: HTTP - - api_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: api_pool } - - api_pool_floating: - type: Magnum::Optional::Neutron::FloatingIP - depends_on: - - extrouter_inside - properties: - floating_network: {get_param: external_network} - port_id: {get_attr: [api_loadbalancer, vip_port_id]} - ###################################################################### # # resources that expose the IPs of either the mesos master or a given # LBaaS pool depending on whether LBaaS is enabled for the bay. # - api_address_switch: + api_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_public_ip: {get_attr: [api_pool_floating, floating_ip_address]} + pool_public_ip: {get_attr: [api_lb, floating_address]} + pool_private_ip: {get_attr: [api_lb, address]} master_public_ip: {get_attr: [mesos_masters, resource.0.mesos_master_external_ip]} + master_private_ip: {get_attr: [mesos_masters, resource.0.mesos_master_ip]} ###################################################################### # @@ -416,7 +386,7 @@ resources: fixed_network: {get_resource: fixed_network} fixed_subnet: {get_resource: fixed_subnet} secgroup_mesos_id: {get_resource: secgroup_master} - api_pool_id: {get_resource: api_pool} + api_pool_id: {get_attr: [api_lb, pool_id]} ###################################################################### # @@ -463,7 +433,7 @@ resources: outputs: api_address: - value: {get_attr: [api_address_switch, public_ip]} + value: {get_attr: [api_address_lb_switch, public_ip]} description: > This is the API endpoint of the Mesos master. Use this to access the Mesos API from outside the cluster. diff --git a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml index 871fd0b500..ca423450ae 100644 --- a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml +++ b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml @@ -275,6 +275,22 @@ resources: get_resource: fixed_subnet + api_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_resource: fixed_subnet} + external_network: {get_param: external_network} + protocol: {get_param: loadbalancing_protocol} + port: {get_param: swarm_port} + + etcd_lb: + type: ../../common/templates/lb.yaml + properties: + fixed_subnet: {get_resource: fixed_subnet} + external_network: {get_param: external_network} + protocol: HTTP + port: 2379 + ###################################################################### # # security groups. we need to permit network traffic of various @@ -289,92 +305,24 @@ resources: - protocol: tcp - protocol: udp - ###################################################################### - # - # load balancers. - # - api_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - api_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: api_loadbalancer} - protocol: {get_param: loadbalancing_protocol} - protocol_port: {get_param: swarm_port} - - api_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: api_listener} - protocol: {get_param: loadbalancing_protocol} - - api_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: api_pool } - - api_pool_floating: - type: Magnum::Optional::Neutron::FloatingIP - depends_on: - - extrouter_inside - properties: - floating_network: {get_param: external_network} - port_id: {get_attr: [api_loadbalancer, vip_port_id]} - - etcd_loadbalancer: - type: Magnum::Optional::Neutron::LBaaS::LoadBalancer - properties: - vip_subnet: {get_resource: fixed_subnet} - - etcd_listener: - type: Magnum::Optional::Neutron::LBaaS::Listener - properties: - loadbalancer: {get_resource: etcd_loadbalancer} - protocol: HTTP - protocol_port: 2379 - - etcd_pool: - type: Magnum::Optional::Neutron::LBaaS::Pool - properties: - lb_algorithm: ROUND_ROBIN - listener: {get_resource: etcd_listener} - protocol: HTTP - - etcd_monitor: - type: Magnum::Optional::Neutron::LBaaS::HealthMonitor - properties: - type: TCP - delay: 5 - max_retries: 5 - timeout: 5 - pool: { get_resource: etcd_pool } - ###################################################################### # # resources that expose the IPs of either the swarm master or a given # LBaaS pool depending on whether LBaaS is enabled for the cluster. # - api_address_switch: + api_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_public_ip: {get_attr: [api_pool_floating, floating_ip_address]} - pool_private_ip: {get_attr: [api_loadbalancer, vip_address]} + pool_public_ip: {get_attr: [api_lb, floating_address]} + pool_private_ip: {get_attr: [api_lb, address]} master_public_ip: {get_attr: [swarm_masters, resource.0.swarm_master_external_ip]} master_private_ip: {get_attr: [swarm_masters, resource.0.swarm_master_ip]} - etcd_address_switch: + etcd_address_lb_switch: type: Magnum::ApiGatewaySwitcher properties: - pool_private_ip: {get_attr: [etcd_loadbalancer, vip_address]} + pool_private_ip: {get_attr: [etcd_lb, address]} master_private_ip: {get_attr: [swarm_masters, resource.0.swarm_master_ip]} ###################################################################### @@ -405,7 +353,7 @@ resources: http_proxy: {get_param: http_proxy} https_proxy: {get_param: https_proxy} no_proxy: {get_param: no_proxy} - swarm_api_ip: {get_attr: [api_loadbalancer, vip_address]} + swarm_api_ip: {get_attr: [api_lb, address]} cluster_uuid: {get_param: cluster_uuid} magnum_url: {get_param: magnum_url} tls_disabled: {get_param: tls_disabled} @@ -415,10 +363,10 @@ resources: flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_backend: {get_param: flannel_backend} swarm_port: {get_param: swarm_port} - api_pool_id: {get_resource: api_pool} - etcd_pool_id: {get_resource: etcd_pool} - etcd_server_ip: {get_attr: [etcd_loadbalancer, vip_address]} - api_ip_address: {get_attr: [api_pool_floating, floating_ip_address]} + api_pool_id: {get_attr: [api_lb, pool_id]} + etcd_pool_id: {get_attr: [etcd_lb, pool_id]} + etcd_server_ip: {get_attr: [etcd_lb, address]} + api_ip_address: {get_attr: [api_lb, floating_address]} swarm_version: {get_param: swarm_version} swarm_strategy: {get_param: swarm_strategy} trustee_user_id: {get_param: trustee_user_id} @@ -448,15 +396,15 @@ resources: http_proxy: {get_param: http_proxy} https_proxy: {get_param: https_proxy} no_proxy: {get_param: no_proxy} - swarm_api_ip: {get_attr: [api_address_switch, private_ip]} + swarm_api_ip: {get_attr: [api_address_lb_switch, private_ip]} cluster_uuid: {get_param: cluster_uuid} magnum_url: {get_param: magnum_url} tls_disabled: {get_param: tls_disabled} secgroup_swarm_node_id: {get_resource: secgroup_manager} flannel_network_cidr: {get_param: flannel_network_cidr} network_driver: {get_param: network_driver} - etcd_server_ip: {get_attr: [etcd_address_switch, private_ip]} - api_ip_address: {get_attr: [api_address_switch, public_ip]} + etcd_server_ip: {get_attr: [etcd_address_lb_switch, private_ip]} + api_ip_address: {get_attr: [api_address_lb_switch, public_ip]} swarm_version: {get_param: swarm_version} trustee_domain_id: {get_param: trustee_domain_id} trustee_user_id: {get_param: trustee_user_id} @@ -480,7 +428,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_lb_switch, public_ip]} description: > This is the API endpoint of the Swarm masters. Use this to access the Swarm API server from outside the cluster.