blob: 53e0660c844a48dddfcf9ee57c0163e0e8a242f0 [file] [log] [blame]
Anton Samoylove2e969e2024-10-03 15:28:31 +04001heat_template_version: queens
2
3parameters:
4
Anton Samoylove2e969e2024-10-03 15:28:31 +04005 k8s_network:
6 type: string
7 k8s_subnet_id:
8 type: string
Anton Samoylovafd066e2025-08-27 10:58:38 +04009 k8s_subnet_ipv6_id:
10 type: string
Anton Samoylove2e969e2024-10-03 15:28:31 +040011 public_net_id:
12 type: string
13 data_network:
14 type: string
Anton Samoylov17e7c032024-10-14 23:55:18 +040015 storage_frontend_network:
16 type: string
Anton Samoylove2e969e2024-10-03 15:28:31 +040017 availability_zone:
18 type: string
19 default: nova
Anton Samoylov17e7c032024-10-14 23:55:18 +040020 boot_timeout:
21 type: number
22 description: Boot timeout for instance
23 default: 600
Anton Samoylove2e969e2024-10-03 15:28:31 +040024 image:
25 type: string
26 description: Name of image to use for servers
27 flavor:
28 type: string
29 description: Flavor to use for servers
30 key_name:
31 type: string
32 description: Name of keypair to assign to servers
33
34resources:
35
36 k8s_network_port:
37 type: OS::Neutron::Port
38 properties:
39 network: { get_param: k8s_network }
40 port_security_enabled: false
41 fixed_ips:
42 - subnet: { get_param: k8s_subnet_id }
Anton Samoylovafd066e2025-08-27 10:58:38 +040043 - subnet: { get_param: k8s_subnet_ipv6_id }
Anton Samoylove2e969e2024-10-03 15:28:31 +040044
45 floating_ip_k8s_net:
46 type: OS::Neutron::FloatingIP
47 properties:
48 floating_network_id: { get_param: public_net_id }
49 port_id: { get_resource: k8s_network_port }
50
Anton Samoylov17e7c032024-10-14 23:55:18 +040051 wait_handle:
52 type: OS::Heat::WaitConditionHandle
53
54 wait_condition:
55 type: OS::Heat::WaitCondition
56 properties:
57 handle: { get_resource: wait_handle }
58 timeout: { get_param: boot_timeout }
59
Anton Samoylov72279102025-03-05 18:52:39 +040060 server:
Anton Samoylove2e969e2024-10-03 15:28:31 +040061 type: OS::Nova::Server
62 properties:
63 availability_zone: { get_param: availability_zone }
64 image: { get_param: image }
65 flavor: { get_param: flavor }
66 key_name: { get_param: key_name }
67 networks:
68 - port: { get_resource: k8s_network_port }
Anton Samoylov17e7c032024-10-14 23:55:18 +040069 - network: { get_param : storage_frontend_network }
Anton Samoylove2e969e2024-10-03 15:28:31 +040070 - network: { get_param : data_network }
Anton Samoylov17e7c032024-10-14 23:55:18 +040071 user_data_format: RAW
72 user_data:
73 str_replace:
74 template: |
75 #!/bin/bash
76
77 set -x
78
79 STATUS="SUCCESS"
80 REASON="The node has been successfully deployed"
81 DATA_BINARY="{\"status\": \"$STATUS\", \"reason\": \"$REASON\"}"
82 echo "Sending notification to wait condition ..."
83
84 WC_EXIT_CODE=1
85 counter=0
86 while (( ${WC_EXIT_CODE} != 0 && ${counter} < 3 )); do
87 wc_notify -k --data-binary "$DATA_BINARY" && WC_EXIT_CODE=0
88 counter=$((counter + 1))
89 sleep 5
90 done
91
92 if (( ${WC_EXIT_CODE} !=0 ))
93 then
94 echo "Cannot send notification to wait condition with a SUCCESS status"
95 exit 1
96 fi
97 params:
98 wc_notify: { get_attr: [wait_handle, curl_cli] }
Anton Samoylove2e969e2024-10-03 15:28:31 +040099
100outputs:
101 server_public_ip:
102 description: Floating IP address of server in public network
103 value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }