blob: a0562312ec4288e71375f323927068142418fe93 [file] [log] [blame]
Ilya Bumarskov9ccf2272025-12-01 12:47:14 +01001heat_template_version: queens
2
3parameters:
4
5 k8s_network:
6 type: string
7 k8s_subnet_id:
8 type: string
9 public_net_id:
10 type: string
11 availability_zone:
12 type: string
13 default: nova
14 boot_timeout:
15 type: number
16 description: Boot timeout for instance
17 default: 450
18 image:
19 type: string
20 description: Name of image to use for servers
21 flavor:
22 type: string
23 description: Flavor to use for servers
24 key_name:
25 type: string
26 description: Name of keypair to assign to servers
27 k8s_vip:
28 type: string
29 description: VIP of kubernetes (child cluster)
30 k8s_svc_network_cidr:
31 type: string
32 description: CIDR of kubernetes service network
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 }
43
44 floating_ip_k8s_net:
45 type: OS::Neutron::FloatingIP
46 properties:
47 floating_network_id: { get_param: public_net_id }
48 port_id: { get_resource: k8s_network_port }
49
50 wait_handle:
51 type: OS::Heat::WaitConditionHandle
52
53 wait_condition:
54 type: OS::Heat::WaitCondition
55 properties:
56 handle: { get_resource: wait_handle }
57 timeout: { get_param: boot_timeout }
58
59 server_init:
60 type: OS::Heat::CloudConfig
61 properties:
62 cloud_config:
63 password: 'r00tme'
64 chpasswd:
65 expire: false
66 ssh_pwauth: true
67 packages:
68 - python3
69 - docker.io
70 write_files:
71 - path: /etc/netplan/98-custom.yaml
72 permissions: '0600'
73 content:
74 str_replace:
75 template: |
76 network:
77 version: 2
78 ethernets:
79 ens3:
80 routes:
81 - to: k8s_svc_network_cidr
82 via: k8s_vip
83 params:
84 k8s_vip: { get_param: k8s_vip }
85 k8s_svc_network_cidr: { get_param: k8s_svc_network_cidr }
86 runcmd:
87 - str_replace:
88 template: |
89 #!/bin/bash
90 set +x
91 netplan apply
92 # Simple success signal
93 wc_notify --data-binary '{"status": "SUCCESS"}'
94 params:
95 wc_notify: { get_attr: [ wait_handle, curl_cli ] }
96
97 server:
98 type: OS::Nova::Server
99 properties:
100 availability_zone: { get_param: availability_zone }
101 image: { get_param: image }
102 flavor: { get_param: flavor }
103 key_name: { get_param: key_name }
104 networks:
105 - port: { get_resource: k8s_network_port }
106 user_data_format: RAW
107 user_data: { get_resource: server_init }
108
109outputs:
110 server_public_ip:
111 description: Floating IP address of server in public network
112 value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }