Anton Samoylov | e2e969e | 2024-10-03 15:28:31 +0400 | [diff] [blame^] | 1 | heat_template_version: queens |
| 2 | |
| 3 | parameters: |
| 4 | controllers_size: |
| 5 | type: number |
| 6 | description: Number of masters instances to deploy |
| 7 | default: 1 |
| 8 | workers_size: |
| 9 | type: number |
| 10 | description: Number of workers to deploy |
| 11 | default: 3 |
| 12 | image: |
| 13 | type: string |
| 14 | description: Name of image to use for servers |
| 15 | availability_zone: |
| 16 | type: string |
| 17 | default: "nova" |
| 18 | masters_flavor: |
| 19 | type: string |
| 20 | default: 'system.compact.openstack.control' |
| 21 | workers_flavor: |
| 22 | type: string |
| 23 | default: 'system.compact.openstack.control' |
| 24 | cluster_public_key: |
| 25 | type: string |
| 26 | public_net_id: |
| 27 | type: string |
| 28 | default: '' |
| 29 | description: > |
| 30 | UUID of public network |
| 31 | k8s_network_cidr: |
| 32 | type: string |
| 33 | description: The CIDR of k8s network |
| 34 | default: '10.10.0.0/24' |
| 35 | data_network_cidr: |
| 36 | type: string |
| 37 | description: The CIDR of k8s network |
| 38 | default: '10.11.0.0/24' |
| 39 | dns_nameservers: |
| 40 | type: json |
| 41 | default: [] |
| 42 | |
| 43 | resources: |
| 44 | |
| 45 | keypair_name: |
| 46 | type: OS::Heat::RandomString |
| 47 | properties: |
| 48 | character_classes: [{"class": "hexdigits", "min": 1}] |
| 49 | length: 128 |
| 50 | salt: constant |
| 51 | key_pair: |
| 52 | type: OS::Nova::KeyPair |
| 53 | properties: |
| 54 | name: { get_attr: [keypair_name, value] } |
| 55 | public_key: { get_param: cluster_public_key } |
| 56 | save_private_key: false |
| 57 | |
| 58 | k8s_network: |
| 59 | type: OS::Neutron::Net |
| 60 | k8s_subnet: |
| 61 | type: OS::Neutron::Subnet |
| 62 | properties: |
| 63 | network: { get_resource: k8s_network } |
| 64 | enable_dhcp: false |
| 65 | cidr: { get_param: k8s_network_cidr } |
| 66 | dns_nameservers: { get_param: dns_nameservers } |
| 67 | router: |
| 68 | type: OS::Neutron::Router |
| 69 | properties: |
| 70 | external_gateway_info: |
| 71 | network: { get_param: public_net_id } |
| 72 | public_router_iface: |
| 73 | type: OS::Neutron::RouterInterface |
| 74 | properties: |
| 75 | router: { get_resource: router } |
| 76 | subnet: { get_resource: k8s_subnet } |
| 77 | |
| 78 | data_network: |
| 79 | type: OS::Neutron::Net |
| 80 | data_subnet: |
| 81 | type: OS::Neutron::Subnet |
| 82 | properties: |
| 83 | network: { get_resource: data_network } |
| 84 | enable_dhcp: false |
| 85 | cidr: { get_param: data_network_cidr } |
| 86 | |
| 87 | masters: |
| 88 | type: OS::Heat::ResourceGroup |
| 89 | depends_on: |
| 90 | - k8s_network |
| 91 | - data_network |
| 92 | - public_router_iface |
| 93 | properties: |
| 94 | count: { get_param: controllers_size } |
| 95 | resource_def: |
| 96 | type: VMInstances |
| 97 | properties: |
| 98 | node_type: "controller" |
| 99 | k8s_network: { get_resource: k8s_network } |
| 100 | k8s_subnet_id: { get_resource: k8s_subnet } |
| 101 | public_net_id: { get_param: public_net_id } |
| 102 | data_network: { get_resource: data_network } |
| 103 | availability_zone: { get_param: availability_zone } |
| 104 | image: { get_param: image } |
| 105 | flavor: { get_param: masters_flavor } |
| 106 | key_name: { get_attr: [keypair_name, value] } |
| 107 | |
| 108 | workers: |
| 109 | type: OS::Heat::ResourceGroup |
| 110 | depends_on: |
| 111 | - k8s_network |
| 112 | - data_network |
| 113 | - public_router_iface |
| 114 | properties: |
| 115 | count: { get_param: workers_size } |
| 116 | resource_def: |
| 117 | type: VMInstances |
| 118 | properties: |
| 119 | node_type: "worker" |
| 120 | k8s_network: { get_resource: k8s_network } |
| 121 | k8s_subnet_id: { get_resource: k8s_subnet } |
| 122 | public_net_id: { get_param: public_net_id } |
| 123 | data_network: { get_resource: data_network } |
| 124 | availability_zone: { get_param: availability_zone } |
| 125 | image: { get_param: image } |
| 126 | flavor: { get_param: workers_flavor } |
| 127 | key_name: { get_attr: [keypair_name, value] } |
| 128 | |
| 129 | outputs: |
| 130 | masters_ips: |
| 131 | description: Public IP addresses of the deployed masters instances |
| 132 | value: { get_attr: [masters, server_public_ip] } |
| 133 | workers_ips: |
| 134 | description: Public IP addresses of the deployed worker instances |
| 135 | value: { get_attr: [workers, server_public_ip] } |