Add timeout to kubectl get node
[iec.git] / src / foundation / hot / k8s_master.yaml
1 # yamllint disable-line rule:document-start
2 heat_template_version: 2016-10-14
3
4 description: "K8 master VM"
5
6 parameters:
7   key_name:
8     type: string
9     description: management ssh key
10     default: 'ak-key'
11
12   k8s_master_hostname:
13     type: string
14     description: Hostname of the K8s master node
15     default: "k8s-master"
16
17   k8s_master_vol:
18     type: string
19     default: "k8s_master_vol"
20
21   k8s_mgmt_net:
22     type: string
23     description: management network
24     default: "k8s_mgmt_net"
25
26   k8s_int_net:
27     type: string
28     description: Kubernetes service network
29     default: "k8s_int_net"
30
31   k8s_master_ip:
32     type: string
33     description: k8s_master management IP (fixed)
34
35   k8s_pod_net_cidr:
36     type: string
37     description: k8 pod_net cidr used for setting up k8s cluster
38
39   k8s_svc_net_cidr:
40     type: string
41     description: k8 pod_net cidr used for setting up k8s cluster
42
43   k8s_cluster_ip:
44     type: string
45     description: k8 service IP addr used for setting up k8s cluster
46
47   k8s_user:
48     type: string
49     description: User id to connect to the VMs (ssh)
50     default: "ubuntu"
51
52   k8s_password:
53     type: string
54     description: Access password for the user to connect to the VMs (ssh)
55     default: "ubuntu"
56
57   public_ip_pool:
58     type: string
59     description: Public IP pool
60     default: "external"
61
62   enable_floating_ip:
63     type: boolean
64     default: true
65
66   has_dpdk:
67     type: boolean
68     default: false
69
70 conditions:
71   cond_floating_ip: {equals: [{get_param: enable_floating_ip}, true]}
72   has_dpdk: {equals: [{get_param: has_dpdk}, true]}
73
74 resources:
75   flavor:
76     type: OS::Nova::Flavor
77     properties:
78       ram: 16384
79       vcpus: 4
80       disk: 10
81
82   flavor_dpdk:
83     type: OS::Nova::Flavor
84     properties:
85       ram: 16384
86       vcpus: 8
87       disk: 40
88       extra_specs:
89         "hw:mem_page_size": large
90         "hw:cpu_policy": dedicated
91         "aggregate_instance_extra_specs:pinned": "true"
92         "hw:numa_node.0": 0
93         "hw:numa_nodes": 1
94
95   server_fip:
96     type: OS::Nova::FloatingIP
97     condition: cond_floating_ip
98     properties:
99       pool: {get_param: public_ip_pool}
100
101   server_association_fip:
102     type: OS::Nova::FloatingIPAssociation
103     condition: cond_floating_ip
104     properties:
105       floating_ip: {get_resource: server_fip}
106       server_id: {get_resource: server}
107
108   mgmt_port:
109     type: OS::Neutron::Port
110     properties:
111       network: {get_param: k8s_mgmt_net}
112       port_security_enabled: false
113       # security_groups:
114       #   - {get_resource: server_security_group}
115
116   int_net_port:
117     type: OS::Neutron::Port
118     properties:
119       network: {get_param: k8s_int_net}
120       port_security_enabled: false
121       # security_groups:
122       #   - {get_resource: server_security_group}
123       fixed_ips: [{"ip_address": {get_param: k8s_master_ip}}]
124
125   server_cloudinit_config:
126     type: OS::Heat::CloudConfig
127     properties:
128       cloud_config:
129         password: ubuntu
130         chpasswd: {expire: false}
131         ssh_pwauth: true
132         manage_etc_hosts: true
133         disable_root: false
134
135   server_config:
136     type: OS::Heat::SoftwareConfig
137     properties:
138       config:
139         str_replace:
140           template: {get_file: k8s_master_init.sh}
141           params:
142             k8s_master_hostname: {get_param: k8s_master_hostname}
143             k8s_master_ip: {get_param: k8s_master_ip}
144             k8s_pod_net_cidr: {get_param: k8s_pod_net_cidr}
145             k8s_svc_net_cidr: {get_param: k8s_svc_net_cidr}
146             k8s_cluster_ip: {get_param: k8s_cluster_ip}
147             k8s_user: {get_param: k8s_user}
148
149   server_user_data:
150     type: OS::Heat::MultipartMime
151     properties:
152       parts:
153         - config: {get_resource: server_cloudinit_config}
154         - config: {get_resource: server_config}
155
156   server_security_group:
157     type: OS::Neutron::SecurityGroup
158     properties:
159       description: Security group for ssh and icmp
160       name: test-security-group
161       rules: [
162         {remote_ip_prefix: 0.0.0.0/0,
163          protocol: tcp,
164          port_range_min: 1,
165          port_range_max: 65535},
166         {remote_ip_prefix: 0.0.0.0/0,
167          protocol: udp,
168          port_range_min: 1,
169          port_range_max: 65535},
170         {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}
171       ]
172
173   # k8s_master_volume:
174   #   type: OS::Cinder::Volume
175   #   properties:
176   #     description: 'user: Volume for Node1'
177   #     image: "xenial"
178   #     name: {get_param: k8s_master_vol}
179   #     size: 20
180   #     availability_zone: nova
181
182   server:
183     type: OS::Nova::Server
184     properties:
185       name: k8s-master
186       key_name: {get_param: key_name}
187       flavor: {get_resource: {if: ["has_dpdk", "flavor_dpdk", "flavor"]}}
188       image: "xenial"
189       # block_device_mapping: [
190       #   {device_name: "vda",
191       #    volume_id:
192       #      {get_resource: k8s_master_volume},
193       #    delete_on_termination: true
194       #   }
195       # ]
196       user_data: {get_resource: server_user_data}
197       user_data_format: RAW
198       networks:
199         - port: {get_resource: mgmt_port}
200         - port: {get_resource: int_net_port}