From 1faee45bc2e84c0ceb76a06cf15871e914e934cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Thu, 8 Feb 2018 18:03:06 +0100 Subject: [PATCH] Add load balancer for Neutron LBaaSv2 API --- loadbalancer_dedicated.yaml | 6 + loadbalancer_external.yaml | 6 + loadbalancer_neutron.yaml | 6 + loadbalancer_neutron_v2.yaml | 257 ++++++++++++++++++++++++++++ loadbalancer_neutron_v2_member.yaml | 60 +++++++ loadbalancer_none.yaml | 6 + openshift.yaml | 2 + 7 files changed, 343 insertions(+) create mode 100644 loadbalancer_neutron_v2.yaml create mode 100644 loadbalancer_neutron_v2_member.yaml diff --git a/loadbalancer_dedicated.yaml b/loadbalancer_dedicated.yaml index 83f1e80..5409d60 100644 --- a/loadbalancer_dedicated.yaml +++ b/loadbalancer_dedicated.yaml @@ -108,9 +108,15 @@ parameters: constraints: - custom_constraint: neutron.subnet + member_count: + type: number + members: type: comma_delimited_list + member_ips: + type: comma_delimited_list + master_hostname: type: string diff --git a/loadbalancer_external.yaml b/loadbalancer_external.yaml index 20c19ea..32afd5c 100644 --- a/loadbalancer_external.yaml +++ b/loadbalancer_external.yaml @@ -110,9 +110,15 @@ parameters: constraints: - custom_constraint: neutron.subnet + member_count: + type: number + members: type: comma_delimited_list + member_ips: + type: comma_delimited_list + master_hostname: type: string diff --git a/loadbalancer_neutron.yaml b/loadbalancer_neutron.yaml index 068f4b9..c438298 100644 --- a/loadbalancer_neutron.yaml +++ b/loadbalancer_neutron.yaml @@ -109,9 +109,15 @@ parameters: constraints: - custom_constraint: neutron.subnet + member_count: + type: number + members: type: comma_delimited_list + member_ips: + type: comma_delimited_list + master_hostname: type: string diff --git a/loadbalancer_neutron_v2.yaml b/loadbalancer_neutron_v2.yaml new file mode 100644 index 0000000..258add0 --- /dev/null +++ b/loadbalancer_neutron_v2.yaml @@ -0,0 +1,257 @@ +heat_template_version: 2016-10-14 + +description: > + A template which provides a creates a loadbalancer using neutron's LBaaS. + +parameters: + + # What version of OpenShift Container Platform to install + # This value is used to select the RPM repo for the OCP release to install + ocp_version: + type: string + description: > + The version of OpenShift Container Platform to deploy + + key_name: + description: > + A pre-submitted SSH key to access the VM hosts + type: string + constraints: + - custom_constraint: nova.keypair + + image: + type: string + default: '' + + flavor: + description: > + Define the hardware characteristics for the VMs: CPU, Memory, base disk + type: string + constraints: + - custom_constraint: nova.flavor + + hostname: + description: > + The load balancer hostname portion of the FQDN + type: string + constraints: + - allowed_pattern: '[a-z0-9\-\.]*' + description: Hostname must contain only characters [a-z0-9\-\.]. + + stack_name: + description: Top level stack name. + type: string + + domain_name: + description: > + All VMs will be placed in this domain + type: string + + app_subdomain: + type: string + + rhn_username: + description: > + A valid user with entitlements to RHEL and OpenShift software repos + type: string + + rhn_password: + description: > + The password for the RHN user + type: string + hidden: true + + # Red Hat satellite subscription parameters + sat6_hostname: + type: string + description: > + The hostname of the Satellite 6 server which will provide software updates + default: '' + + sat6_organization: + type: string + description: > + An organization string provided by Sat6 to group subscriptions + default: '' + + sat6_activationkey: + type: string + description: > + An activation key string provided by Sat6 to enable subscriptions + + rhn_pool: + description: > + A subscription pool containing the RHEL and OpenShift software repos + OPTIONAL + type: string + hidden: true + + extra_rhn_pools: + type: comma_delimited_list + description: List of rhn pools which will be installed on each node. + default: '' + + ssh_user: + description: > + The user for SSH access to the VM hosts + type: string + + ansible_public_key: + description: > + The SSH public key that Ansible will use to access master and node hosts + This will be placed on each VM host in /root/.ssh/authorized_keys + type: string + + fixed_subnet: + description: > + The name or ID of the internal IPv4 space + type: string + constraints: + - custom_constraint: neutron.subnet + + member_count: + type: number + + members: + type: comma_delimited_list + + member_ips: + type: comma_delimited_list + + master_hostname: + type: string + + floatingip_id: + type: string + + floatingip: + type: string + + fixed_network: + description: > + The name or ID of the internal network + type: string + constraints: + - custom_constraint: neutron.network + + fixed_subnet: + description: > + The name or ID of the internal IPv4 space + type: string + constraints: + - custom_constraint: neutron.subnet + + extra_repository_urls: + type: comma_delimited_list + description: List of repository URLs which will be installed on each node. + default: '' + + extra_docker_repository_urls: + type: comma_delimited_list + description: List of docker repository URLs which will be installed on each node, if a repo is insecure use '#insecure' suffix. + default: '' + + stack_name: + type: string + default: '' + + bastion_node: + type: string + description: > + The name or ID of the bastion instance. + default: '' + + dns_servers: + type: comma_delimited_list + description: address of dns nameservers reachable in your environment + + dns_update_key: + type: string + hidden: true + + ca_cert: + type: string + description: Certificate Authority Certificate to be added to trust chain + +resources: + lb: + type: OS::Neutron::LBaaS::LoadBalancer + properties: + vip_subnet: {get_param: fixed_subnet} + + lb_listener: + type: OS::Neutron::LBaaS::Listener + properties: + protocol: HTTPS + protocol_port: 8443 + loadbalancer: {get_resource: lb} + + lb_pool: + type: OS::Neutron::LBaaS::Pool + properties: + name: lb_pool + description: Load balancer for OpenShift hosts. + protocol: HTTPS + listener: {get_resource: lb_listener} + lb_algorithm: ROUND_ROBIN + session_persistence: + type: SOURCE_IP + + lb_members: + type: OS::Heat::ResourceGroup + properties: + count: {get_param: member_count} + resource_def: + type: loadbalancer_neutron_v2_member.yaml + properties: + addresses: {get_param: member_ips} + index: "%index%" + pool: {get_resource: lb_pool} + protocol_port: 8443 + subnet: {get_param: fixed_subnet} + + lb_monitor: + type: OS::Neutron::LBaaS::HealthMonitor + properties: + type: TCP + delay: 15 + max_retries: 5 + timeout: 10 + pool: {get_resource: lb_pool} + + floating_ip_assoc: + type: OS::Neutron::FloatingIPAssociation + properties: + port_id: {get_attr: [lb, vip_port_id]} + floatingip_id: {get_param: floatingip_id} + +outputs: + console_url: + description: URL of the OpenShift web console + value: + str_replace: + template: "https://%stack_name%-%hostname%.%domainname%:8443/console/" + params: + '%stack_name%': {get_param: stack_name} + '%hostname%': {get_param: hostname} + '%domainname%': {get_param: domain_name} + + api_url: + description: URL entrypoint to the OpenShift API + value: + str_replace: + template: "https://%stack_name%-%hostname%.%domainname%:8443/" + params: + '%stack_name%': {get_param: stack_name} + '%hostname%': {get_param: hostname} + '%domainname%': {get_param: domain_name} + + hostname: + description: Loadbalancer hostname + value: + str_replace: + template: "%stack_name%-%hostname%.%domainname%" + params: + '%stack_name%': {get_param: stack_name} + '%hostname%': {get_param: hostname} + '%domainname%': {get_param: domain_name} diff --git a/loadbalancer_neutron_v2_member.yaml b/loadbalancer_neutron_v2_member.yaml new file mode 100644 index 0000000..6afbe48 --- /dev/null +++ b/loadbalancer_neutron_v2_member.yaml @@ -0,0 +1,60 @@ +heat_template_version: 2016-10-14 + +description: > + A template which provides a neutron’s LBaaS loadbalancer member + +parameters: + + addresses: + type: comma_delimited_list + + index: + type: number + + pool: + type: string + constraints: + - custom_constraint: neutron.lbaas.pool + + protocol_port: + type: number + constraints: + - range: + min: 1 + max: 65535 + + subnet: + type: string + constraints: + - custom_constraint: neutron.subnet + + weight: + type: number + constraints: + - range: + min: 0 + max: 256 + default: 1 + +resources: + lb_member: + type: OS::Neutron::LBaaS::PoolMember + properties: + address: {get_param: [addresses, {get_param: index}]} + pool: {get_param: pool} + protocol_port: {get_param: protocol_port} + subnet: {get_param: subnet} + weight: {get_param: weight} + +outputs: + address: + description: The IP address of the pool member + value: {get_attr: [lb_member, address]} + + pool_id: + description: The ID of the pool to which the pool member belongs + value: {get_attr: [lb_member, pool_id]} + + show: + description: Detailed information about resource + value: {get_attr: [lb_member, show]} diff --git a/loadbalancer_none.yaml b/loadbalancer_none.yaml index dec5d47..6aa8234 100644 --- a/loadbalancer_none.yaml +++ b/loadbalancer_none.yaml @@ -106,9 +106,15 @@ parameters: constraints: - custom_constraint: neutron.subnet + member_count: + type: number + members: type: comma_delimited_list + member_ips: + type: comma_delimited_list + master_hostname: type: string diff --git a/openshift.yaml b/openshift.yaml index ffba279..9e9a0d0 100644 --- a/openshift.yaml +++ b/openshift.yaml @@ -1012,7 +1012,9 @@ resources: stack_name: {get_param: 'OS::stack_name'} ansible_public_key: {get_attr: [ansible_keys, public_key]} fixed_subnet: {get_resource: fixed_subnet} + member_count: {get_param: master_count} members: {get_attr: [openshift_masters, host]} + member_ips: {get_attr: [openshift_masters, ip_address]} master_hostname: {get_attr: [openshift_masters, resource.0.hostname]} floatingip_id: {get_resource: lb_floating_ip} floatingip: {get_attr: [lb_floating_ip, floating_ip_address]}