| heat_template_version: queens |
| |
| parameters: |
| |
| k8s_network: |
| type: string |
| k8s_subnet_id: |
| type: string |
| public_net_id: |
| type: string |
| availability_zone: |
| type: string |
| default: nova |
| boot_timeout: |
| type: number |
| description: Boot timeout for instance |
| default: 450 |
| image: |
| type: string |
| description: Name of image to use for servers |
| flavor: |
| type: string |
| description: Flavor to use for servers |
| key_name: |
| type: string |
| description: Name of keypair to assign to servers |
| k8s_vip: |
| type: string |
| description: VIP of kubernetes (child cluster) |
| k8s_svc_network_cidr: |
| type: string |
| description: CIDR of kubernetes service network |
| |
| resources: |
| |
| k8s_network_port: |
| type: OS::Neutron::Port |
| properties: |
| network: { get_param: k8s_network } |
| port_security_enabled: false |
| fixed_ips: |
| - subnet: { get_param: k8s_subnet_id } |
| |
| floating_ip_k8s_net: |
| type: OS::Neutron::FloatingIP |
| properties: |
| floating_network_id: { get_param: public_net_id } |
| port_id: { get_resource: k8s_network_port } |
| |
| wait_handle: |
| type: OS::Heat::WaitConditionHandle |
| |
| wait_condition: |
| type: OS::Heat::WaitCondition |
| properties: |
| handle: { get_resource: wait_handle } |
| timeout: { get_param: boot_timeout } |
| |
| server_init: |
| type: OS::Heat::CloudConfig |
| properties: |
| cloud_config: |
| password: 'r00tme' |
| chpasswd: |
| expire: false |
| ssh_pwauth: true |
| packages: |
| - python3 |
| - docker.io |
| write_files: |
| - path: /etc/netplan/98-custom.yaml |
| permissions: '0600' |
| content: |
| str_replace: |
| template: | |
| network: |
| version: 2 |
| ethernets: |
| ens3: |
| routes: |
| - to: k8s_svc_network_cidr |
| via: k8s_vip |
| params: |
| k8s_vip: { get_param: k8s_vip } |
| k8s_svc_network_cidr: { get_param: k8s_svc_network_cidr } |
| runcmd: |
| - str_replace: |
| template: | |
| #!/bin/bash |
| set +x |
| netplan apply |
| # Simple success signal |
| wc_notify --data-binary '{"status": "SUCCESS"}' |
| params: |
| wc_notify: { get_attr: [ wait_handle, curl_cli ] } |
| |
| server: |
| type: OS::Nova::Server |
| properties: |
| availability_zone: { get_param: availability_zone } |
| image: { get_param: image } |
| flavor: { get_param: flavor } |
| key_name: { get_param: key_name } |
| networks: |
| - port: { get_resource: k8s_network_port } |
| user_data_format: RAW |
| user_data: { get_resource: server_init } |
| |
| outputs: |
| server_public_ip: |
| description: Floating IP address of server in public network |
| value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] } |