+# yamllint disable-line rule:document-start
+heat_template_version: 2016-10-14
+
+description: "K8 slaves VM"
+
+parameters:
+ key_name:
+ type: string
+ description: management ssh key
+ default: 'ak-key'
+
+ k8s_slave0_hostname:
+ type: string
+ description: Hostname of the K8s slave0 node
+ default: "k8s-slave0"
+
+ k8s_slave1_hostname:
+ type: string
+ description: Hostname of the K8s slave0 node
+ default: "k8s-slave1"
+
+ k8s_mgmt_net:
+ type: string
+ description: management network
+ default: "k8s_mgmt_net"
+
+ k8s_int_net:
+ type: string
+ description: Kubernetes service network
+ default: "k8s_int_net"
+
+ k8s_master_ip:
+ type: string
+ description: k8s_master management IP (fixed)
+
+ k8s_slave0_ip:
+ type: string
+ description: k8s_master management IP (fixed)
+ default: "172.16.10.37"
+
+ k8s_slave1_ip:
+ type: string
+ description: k8s_master management IP (fixed)
+ default: "172.16.10.38"
+
+ k8s_pod_net_cidr:
+ type: string
+ description: k8 pod_net cidr used for setting up k8s cluster
+
+ k8s_svc_net_cidr:
+ type: string
+ description: k8 pod_net cidr used for setting up k8s cluster
+
+ k8s_cluster_ip:
+ type: string
+ description: k8 service IP addr used for setting up k8s cluster
+
+ k8s_user:
+ type: string
+ description: User id to connect to the VMs (ssh)
+ default: "ubuntu"
+
+ k8s_password:
+ type: string
+ description: Access password for the user to connect to the VMs (ssh)
+ default: "ubuntu"
+
+ public_ip_pool:
+ type: string
+ description: Public IP pool
+ default: "external"
+
+ enable_floating_ip:
+ type: boolean
+ default: true
+
+ has_dpdk:
+ type: boolean
+ default: false
+
+conditions:
+ cond_floating_ip: {equals: [{get_param: enable_floating_ip}, true]}
+ has_dpdk: {equals: [{get_param: has_dpdk}, true]}
+
+resources:
+ flavor:
+ type: OS::Nova::Flavor
+ properties:
+ ram: 10240
+ vcpus: 4
+ disk: 10
+
+ flavor_dpdk:
+ type: OS::Nova::Flavor
+ properties:
+ ram: 10240
+ vcpus: 8
+ disk: 40
+ extra_specs:
+ "hw:mem_page_size": large
+ "hw:cpu_policy": dedicated
+ "aggregate_instance_extra_specs:pinned": "true"
+ "hw:numa_node.0": 0
+ "hw:numa_nodes": 1
+
+ server_cloudinit_config:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ password: ubuntu
+ chpasswd: {expire: false}
+ ssh_pwauth: true
+ manage_etc_hosts: true
+ disable_root: false
+
+ server_config0:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ config:
+ str_replace:
+ template: {get_file: k8s_slaves_init.sh}
+ params:
+ k8s_slave_hostname: {get_param: k8s_slave0_hostname}
+ k8s_master_ip: {get_param: k8s_master_ip}
+ k8s_slave_ip: {get_param: k8s_slave0_ip}
+ k8s_pod_net_cidr: {get_param: k8s_pod_net_cidr}
+ k8s_svc_net_cidr: {get_param: k8s_svc_net_cidr}
+ k8s_cluster_ip: {get_param: k8s_cluster_ip}
+ k8s_user: {get_param: k8s_user}
+ k8s_password: {get_param: k8s_password}
+
+ server_user_data0:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config: {get_resource: server_cloudinit_config}
+ - config: {get_resource: server_config0}
+
+ server_config1:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ config:
+ str_replace:
+ template: {get_file: k8s_slaves_init.sh}
+ params:
+ k8s_slave_hostname: {get_param: k8s_slave1_hostname}
+ k8s_master_ip: {get_param: k8s_master_ip}
+ k8s_slave_ip: {get_param: k8s_slave1_ip}
+ k8s_pod_net_cidr: {get_param: k8s_pod_net_cidr}
+ k8s_svc_net_cidr: {get_param: k8s_svc_net_cidr}
+ k8s_cluster_ip: {get_param: k8s_cluster_ip}
+ k8s_user: {get_param: k8s_user}
+ k8s_password: {get_param: k8s_password}
+
+ server_user_data1:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config: {get_resource: server_cloudinit_config}
+ - config: {get_resource: server_config1}
+
+ server_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ description: Security group for ssh and icmp
+ name: test-security-group
+ rules: [
+ {remote_ip_prefix: 0.0.0.0/0,
+ protocol: tcp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {remote_ip_prefix: 0.0.0.0/0,
+ protocol: udp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}
+ ]
+
+ slave_fip0:
+ type: OS::Nova::FloatingIP
+ condition: cond_floating_ip
+ properties:
+ pool: {get_param: public_ip_pool}
+
+ server_association_fip0:
+ type: OS::Nova::FloatingIPAssociation
+ condition: cond_floating_ip
+ properties:
+ floating_ip: {get_resource: slave_fip0}
+ server_id: {get_resource: slave0}
+
+ slave_fip1:
+ type: OS::Nova::FloatingIP
+ condition: cond_floating_ip
+ properties:
+ pool: {get_param: public_ip_pool}
+
+ server_association_fip1:
+ type: OS::Nova::FloatingIPAssociation
+ condition: cond_floating_ip
+ properties:
+ floating_ip: {get_resource: slave_fip1}
+ server_id: {get_resource: slave1}
+
+ mgmt_port0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: k8s_mgmt_net}
+ port_security_enabled: false
+ # security_groups:
+ # - {get_resource: server_security_group}
+
+ int_net_port0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: k8s_int_net}
+ port_security_enabled: false
+ # security_groups:
+ # - {get_resource: server_security_group}
+ fixed_ips: [{"ip_address": {get_param: k8s_slave0_ip}}]
+
+ mgmt_port1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: k8s_mgmt_net}
+ port_security_enabled: false
+ # security_groups:
+ # - {get_resource: server_security_group}
+
+ int_net_port1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: k8s_int_net}
+ port_security_enabled: false
+ # security_groups:
+ # - {get_resource: server_security_group}
+ fixed_ips: [{"ip_address": {get_param: k8s_slave1_ip}}]
+
+ slave0:
+ type: OS::Nova::Server
+ properties:
+ name: "k8s-slave0"
+ key_name: {get_param: key_name}
+ flavor: {get_resource: {if: ["has_dpdk", "flavor_dpdk", "flavor"]}}
+ image: "xenial"
+ user_data: {get_resource: server_user_data0}
+ user_data_format: RAW
+ # security_groups:
+ # - {get_resource: server_security_group}
+ networks:
+ - port: {get_resource: mgmt_port0}
+ - port: {get_resource: int_net_port0}
+
+ slave1:
+ type: OS::Nova::Server
+ properties:
+ name: "k8s-slave1"
+ key_name: {get_param: key_name}
+ flavor: {get_resource: {if: ["has_dpdk", "flavor_dpdk", "flavor"]}}
+ image: "xenial"
+ user_data: {get_resource: server_user_data1}
+ user_data_format: RAW
+ # security_groups:
+ # - {get_resource: server_security_group}
+ networks:
+ - port: {get_resource: mgmt_port1}
+ - port: {get_resource: int_net_port1}