blob: 15dad90e4fe33c813c4e77faaa5f38f616d13e2d [file] [log] [blame]
heat_template_version: queens
parameters:
k8s_network:
type: string
k8s_subnet_id:
type: string
public_net_id:
type: string
data_network:
type: string
storage_frontend_network:
type: string
availability_zone:
type: string
default: nova
boot_timeout:
type: number
description: Boot timeout for instance
default: 600
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
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 }
vm_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 }
- network: { get_param : storage_frontend_network }
- network: { get_param : data_network }
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/bash
set -x
STATUS="SUCCESS"
REASON="The node has been successfully deployed"
DATA_BINARY="{\"status\": \"$STATUS\", \"reason\": \"$REASON\"}"
echo "Sending notification to wait condition ..."
WC_EXIT_CODE=1
counter=0
while (( ${WC_EXIT_CODE} != 0 && ${counter} < 3 )); do
wc_notify -k --data-binary "$DATA_BINARY" && WC_EXIT_CODE=0
counter=$((counter + 1))
sleep 5
done
if (( ${WC_EXIT_CODE} !=0 ))
then
echo "Cannot send notification to wait condition with a SUCCESS status"
exit 1
fi
params:
wc_notify: { get_attr: [wait_handle, curl_cli] }
outputs:
server_public_ip:
description: Floating IP address of server in public network
value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }