blob: 15dad90e4fe33c813c4e77faaa5f38f616d13e2d [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
9 public_net_id:
10 type: string
11 data_network:
12 type: string
Anton Samoylov17e7c032024-10-14 23:55:18 +040013 storage_frontend_network:
14 type: string
Anton Samoylove2e969e2024-10-03 15:28:31 +040015 availability_zone:
16 type: string
17 default: nova
Anton Samoylov17e7c032024-10-14 23:55:18 +040018 boot_timeout:
19 type: number
20 description: Boot timeout for instance
21 default: 600
Anton Samoylove2e969e2024-10-03 15:28:31 +040022 image:
23 type: string
24 description: Name of image to use for servers
25 flavor:
26 type: string
27 description: Flavor to use for servers
28 key_name:
29 type: string
30 description: Name of keypair to assign to servers
31
32resources:
33
34 k8s_network_port:
35 type: OS::Neutron::Port
36 properties:
37 network: { get_param: k8s_network }
38 port_security_enabled: false
39 fixed_ips:
40 - subnet: { get_param: k8s_subnet_id }
41
42 floating_ip_k8s_net:
43 type: OS::Neutron::FloatingIP
44 properties:
45 floating_network_id: { get_param: public_net_id }
46 port_id: { get_resource: k8s_network_port }
47
Anton Samoylov17e7c032024-10-14 23:55:18 +040048 wait_handle:
49 type: OS::Heat::WaitConditionHandle
50
51 wait_condition:
52 type: OS::Heat::WaitCondition
53 properties:
54 handle: { get_resource: wait_handle }
55 timeout: { get_param: boot_timeout }
56
Anton Samoylove2e969e2024-10-03 15:28:31 +040057 vm_server:
58 type: OS::Nova::Server
59 properties:
60 availability_zone: { get_param: availability_zone }
61 image: { get_param: image }
62 flavor: { get_param: flavor }
63 key_name: { get_param: key_name }
64 networks:
65 - port: { get_resource: k8s_network_port }
Anton Samoylov17e7c032024-10-14 23:55:18 +040066 - network: { get_param : storage_frontend_network }
Anton Samoylove2e969e2024-10-03 15:28:31 +040067 - network: { get_param : data_network }
Anton Samoylov17e7c032024-10-14 23:55:18 +040068 user_data_format: RAW
69 user_data:
70 str_replace:
71 template: |
72 #!/bin/bash
73
74 set -x
75
76 STATUS="SUCCESS"
77 REASON="The node has been successfully deployed"
78 DATA_BINARY="{\"status\": \"$STATUS\", \"reason\": \"$REASON\"}"
79 echo "Sending notification to wait condition ..."
80
81 WC_EXIT_CODE=1
82 counter=0
83 while (( ${WC_EXIT_CODE} != 0 && ${counter} < 3 )); do
84 wc_notify -k --data-binary "$DATA_BINARY" && WC_EXIT_CODE=0
85 counter=$((counter + 1))
86 sleep 5
87 done
88
89 if (( ${WC_EXIT_CODE} !=0 ))
90 then
91 echo "Cannot send notification to wait condition with a SUCCESS status"
92 exit 1
93 fi
94 params:
95 wc_notify: { get_attr: [wait_handle, curl_cli] }
Anton Samoylove2e969e2024-10-03 15:28:31 +040096
97outputs:
98 server_public_ip:
99 description: Floating IP address of server in public network
100 value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }