| 1 |
heat_template_version: 2014-10-16 |
| 2 |
|
| 3 |
description: > |
| 4 |
This is a nested stack that defines a single Kubernetes master, This stack is |
| 5 |
included by an ResourceGroup resource in the parent template |
| 6 |
(kubecluster.yaml). |
| 7 |
|
| 8 |
parameters: |
| 9 |
|
| 10 |
server_image: |
| 11 |
type: string |
| 12 |
description: glance image used to boot the server |
| 13 |
|
| 14 |
master_flavor: |
| 15 |
type: string |
| 16 |
default: m1.small |
| 17 |
description: flavor to use when booting the server |
| 18 |
|
| 19 |
ssh_key_name: |
| 20 |
type: string |
| 21 |
description: name of ssh key to be provisioned on our server |
| 22 |
default: lars |
| 23 |
|
| 24 |
external_network: |
| 25 |
type: string |
| 26 |
description: uuid/name of a network to use for floating ip addresses |
| 27 |
|
| 28 |
portal_network_cidr: |
| 29 |
type: string |
| 30 |
description: > |
| 31 |
address range used by kubernetes for service portals |
| 32 |
|
| 33 |
kube_allow_priv: |
| 34 |
type: string |
| 35 |
description: > |
| 36 |
whether or not kubernetes should permit privileged containers. |
| 37 |
default: "false" |
| 38 |
constraints: |
| 39 |
- allowed_values: ["true", "false"] |
| 40 |
|
| 41 |
flannel_network_cidr: |
| 42 |
type: string |
| 43 |
description: network range for flannel overlay network |
| 44 |
|
| 45 |
flannel_network_subnetlen: |
| 46 |
type: number |
| 47 |
description: size of subnet assigned to each master |
| 48 |
|
| 49 |
flannel_network_subnet_min: |
| 50 |
type: string |
| 51 |
description: minimum subnet |
| 52 |
|
| 53 |
flannel_network_subnet_max: |
| 54 |
type: string |
| 55 |
description: maximum subnet |
| 56 |
|
| 57 |
flannel_backend: |
| 58 |
type: string |
| 59 |
description: > |
| 60 |
specify the backend for flannel, default udp backend |
| 61 |
constraints: |
| 62 |
- allowed_values: ["udp", "vxlan", "host-gw"] |
| 63 |
|
| 64 |
system_pods_initial_delay: |
| 65 |
type: number |
| 66 |
description: > |
| 67 |
health check, time to wait for system pods (podmaster, scheduler) to boot |
| 68 |
(in seconds) |
| 69 |
default: 30 |
| 70 |
|
| 71 |
system_pods_timeout: |
| 72 |
type: number |
| 73 |
description: > |
| 74 |
health check, timeout for system pods (podmaster, scheduler) to answer. |
| 75 |
(in seconds) |
| 76 |
default: 5 |
| 77 |
|
| 78 |
discovery_url: |
| 79 |
type: string |
| 80 |
description: > |
| 81 |
Discovery URL used for bootstrapping the etcd cluster. |
| 82 |
|
| 83 |
tls_disabled: |
| 84 |
type: boolean |
| 85 |
description: whether or not to enable TLS |
| 86 |
|
| 87 |
kubernetes_port: |
| 88 |
type: number |
| 89 |
description: > |
| 90 |
The port which are used by kube-apiserver to provide Kubernetes |
| 91 |
service. |
| 92 |
|
| 93 |
kube_version: |
| 94 |
type: string |
| 95 |
description: version of kubernetes used for kubernetes cluster |
| 96 |
|
| 97 |
cluster_uuid: |
| 98 |
type: string |
| 99 |
description: identifier for the cluster this template is generating |
| 100 |
|
| 101 |
magnum_url: |
| 102 |
type: string |
| 103 |
description: endpoint to retrieve TLS certs from |
| 104 |
|
| 105 |
api_public_address: |
| 106 |
type: string |
| 107 |
description: Public IP address of the Kubernetes master server. |
| 108 |
default: "" |
| 109 |
|
| 110 |
api_private_address: |
| 111 |
type: string |
| 112 |
description: Private IP address of the Kubernetes master server. |
| 113 |
default: "" |
| 114 |
|
| 115 |
http_proxy: |
| 116 |
type: string |
| 117 |
description: http proxy address for docker |
| 118 |
|
| 119 |
https_proxy: |
| 120 |
type: string |
| 121 |
description: https proxy address for docker |
| 122 |
|
| 123 |
no_proxy: |
| 124 |
type: string |
| 125 |
description: no proxies for docker |
| 126 |
|
| 127 |
fixed_network: |
| 128 |
type: string |
| 129 |
description: Network from which to allocate fixed addresses. |
| 130 |
|
| 131 |
fixed_subnet: |
| 132 |
type: string |
| 133 |
description: Subnet from which to allocate fixed addresses. |
| 134 |
|
| 135 |
network_driver: |
| 136 |
type: string |
| 137 |
description: network driver to use for instantiating container networks |
| 138 |
|
| 139 |
wait_condition_timeout: |
| 140 |
type: number |
| 141 |
description : > |
| 142 |
timeout for the Wait Conditions |
| 143 |
|
| 144 |
secgroup_base_id: |
| 145 |
type: string |
| 146 |
description: ID of the security group for base. |
| 147 |
|
| 148 |
secgroup_kube_master_id: |
| 149 |
type: string |
| 150 |
description: ID of the security group for kubernetes master. |
| 151 |
|
| 152 |
api_pool_id: |
| 153 |
type: string |
| 154 |
description: ID of the load balancer pool of k8s API server. |
| 155 |
|
| 156 |
etcd_pool_id: |
| 157 |
type: string |
| 158 |
description: ID of the load balancer pool of etcd server. |
| 159 |
|
| 160 |
auth_url: |
| 161 |
type: string |
| 162 |
description: > |
| 163 |
url for kubernetes to authenticate |
| 164 |
|
| 165 |
username: |
| 166 |
type: string |
| 167 |
description: > |
| 168 |
user account |
| 169 |
|
| 170 |
password: |
| 171 |
type: string |
| 172 |
description: > |
| 173 |
user password |
| 174 |
|
| 175 |
tenant_name: |
| 176 |
type: string |
| 177 |
description: > |
| 178 |
tenant name |
| 179 |
|
| 180 |
kube_master_id: |
| 181 |
type: string |
| 182 |
description: ID of for kubernetes master. |
| 183 |
|
| 184 |
trustee_user_id: |
| 185 |
type: string |
| 186 |
description: user id of the trustee |
| 187 |
|
| 188 |
trustee_password: |
| 189 |
type: string |
| 190 |
description: password of the trustee |
| 191 |
hidden: true |
| 192 |
|
| 193 |
trust_id: |
| 194 |
type: string |
| 195 |
description: id of the trust which is used by the trustee |
| 196 |
hidden: true |
| 197 |
|
| 198 |
domain_name: |
| 199 |
type: string |
| 200 |
description: domain name |
| 201 |
|
| 202 |
resources: |
| 203 |
|
| 204 |
master_wait_handle: |
| 205 |
type: OS::Heat::WaitConditionHandle |
| 206 |
|
| 207 |
master_wait_condition: |
| 208 |
type: OS::Heat::WaitCondition |
| 209 |
depends_on: kube_master |
| 210 |
properties: |
| 211 |
handle: {get_resource: master_wait_handle} |
| 212 |
timeout: {get_param: wait_condition_timeout} |
| 213 |
|
| 214 |
###################################################################### |
| 215 |
# |
| 216 |
# software configs. these are components that are combined into |
| 217 |
# a multipart MIME user-data archive. |
| 218 |
# |
| 219 |
|
| 220 |
write_heat_params: |
| 221 |
type: OS::Heat::SoftwareConfig |
| 222 |
properties: |
| 223 |
group: ungrouped |
| 224 |
config: |
| 225 |
str_replace: |
| 226 |
template: {get_file: fragments/write-heat-params-master.yaml} |
| 227 |
params: |
| 228 |
"$KUBE_NODE_PUBLIC_IP": {get_attr: [kube_master_floating, floating_ip_address]} |
| 229 |
"$KUBE_NODE_IP": {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]} |
| 230 |
"$KUBE_API_PORT": {get_param: kubernetes_port} |
| 231 |
"$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv} |
| 232 |
"$KUBE_MASTER_IPS": {get_param: kube_master_ips_list} |
| 233 |
"$KUBE_MINION_IPS": {get_param: kube_minion_ips_list} |
| 234 |
"$KUBE_NODE_PUBLIC_IP": {get_attr: [kube_master_floating, floating_ip_address]} |
| 235 |
"$KUBE_NODE_IP": { "Fn::Select": [ { get_param: kube_master_index }, { get_param: kube_master_ips} ] } |
| 236 |
"$KUBE_NODE_NAME": {get_param: kube_master_id} |
| 237 |
"$NETWORK_DRIVER": {get_param: network_driver} |
| 238 |
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr} |
| 239 |
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen} |
| 240 |
"$FLANNEL_NETWORK_SUBNET_MIN": {get_param: flannel_network_subnet_min} |
| 241 |
"$FLANNEL_NETWORK_SUBNET_MAX": {get_param: flannel_network_subnet_max} |
| 242 |
"$FLANNEL_BACKEND": {get_param: flannel_backend} |
| 243 |
"$SYSTEM_PODS_INITIAL_DELAY": {get_param: system_pods_initial_delay} |
| 244 |
"$SYSTEM_PODS_TIMEOUT": {get_param: system_pods_timeout} |
| 245 |
"$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr} |
| 246 |
"$ETCD_DISCOVERY_URL": {get_param: discovery_url} |
| 247 |
"$AUTH_URL": {get_param: auth_url} |
| 248 |
"$USERNAME": {get_param: username} |
| 249 |
"$PASSWORD": {get_param: password} |
| 250 |
"$TENANT_NAME": {get_param: tenant_name} |
| 251 |
"$CLUSTER_SUBNET": {get_param: fixed_subnet} |
| 252 |
"$TLS_DISABLED": {get_param: tls_disabled} |
| 253 |
"$KUBE_VERSION": {get_param: kube_version} |
| 254 |
"$CLUSTER_UUID": {get_param: cluster_uuid} |
| 255 |
"$MAGNUM_URL": {get_param: magnum_url} |
| 256 |
"$HTTP_PROXY": {get_param: http_proxy} |
| 257 |
"$HTTPS_PROXY": {get_param: https_proxy} |
| 258 |
"$NO_PROXY": {get_param: no_proxy} |
| 259 |
"$TRUSTEE_USER_ID": {get_param: trustee_user_id} |
| 260 |
"$TRUSTEE_PASSWORD": {get_param: trustee_password} |
| 261 |
"$TRUST_ID": {get_param: trust_id} |
| 262 |
"$DOMAIN_NAME": {get_param: domain_name} |
| 263 |
|
| 264 |
make_cert: |
| 265 |
type: OS::Heat::SoftwareConfig |
| 266 |
properties: |
| 267 |
group: ungrouped |
| 268 |
config: {get_file: fragments/make-cert.sh} |
| 269 |
|
| 270 |
configure_etcd: |
| 271 |
type: OS::Heat::SoftwareConfig |
| 272 |
properties: |
| 273 |
group: ungrouped |
| 274 |
config: {get_file: fragments/configure-etcd.sh} |
| 275 |
|
| 276 |
configure_flanneld: |
| 277 |
type: OS::Heat::SoftwareConfig |
| 278 |
properties: |
| 279 |
group: ungrouped |
| 280 |
config: {get_file: fragments/configure-flanneld-master.sh} |
| 281 |
|
| 282 |
create_kubernetes_user: |
| 283 |
type: OS::Heat::SoftwareConfig |
| 284 |
properties: |
| 285 |
group: ungrouped |
| 286 |
config: {get_file: fragments/create-kubernetes-user.yaml} |
| 287 |
|
| 288 |
configure_kubernetes: |
| 289 |
type: OS::Heat::SoftwareConfig |
| 290 |
properties: |
| 291 |
group: ungrouped |
| 292 |
config: {get_file: fragments/configure-kubernetes-master.sh} |
| 293 |
|
| 294 |
add_proxy: |
| 295 |
type: OS::Heat::SoftwareConfig |
| 296 |
properties: |
| 297 |
group: ungrouped |
| 298 |
config: {get_file: fragments/add-proxy.sh} |
| 299 |
|
| 300 |
master_wc_notify: |
| 301 |
type: OS::Heat::SoftwareConfig |
| 302 |
properties: |
| 303 |
group: ungrouped |
| 304 |
config: |
| 305 |
str_replace: |
| 306 |
template: | |
| 307 |
#!/bin/bash -v |
| 308 |
wc_notify --data-binary '{"status": "SUCCESS"}' |
| 309 |
params: |
| 310 |
wc_notify: {get_attr: [master_wait_handle, curl_cli]} |
| 311 |
|
| 312 |
kube_master_init: |
| 313 |
type: OS::Heat::MultipartMime |
| 314 |
properties: |
| 315 |
parts: |
| 316 |
- config: {get_resource: write_heat_params} |
| 317 |
- config: {get_resource: make_cert} |
| 318 |
- config: {get_resource: configure_etcd} |
| 319 |
- config: {get_resource: configure_flanneld} |
| 320 |
- config: {get_resource: create_kubernetes_user} |
| 321 |
- config: {get_resource: configure_kubernetes} |
| 322 |
- config: {get_resource: add_proxy} |
| 323 |
- config: {get_resource: master_wc_notify} |
| 324 |
|
| 325 |
###################################################################### |
| 326 |
# |
| 327 |
# a single kubernetes master. |
| 328 |
# |
| 329 |
|
| 330 |
kube_master: |
| 331 |
type: OS::Nova::Server |
| 332 |
properties: |
| 333 |
name: {get_param: kube_master_id} |
| 334 |
image: {get_param: server_image} |
| 335 |
flavor: {get_param: master_flavor} |
| 336 |
key_name: {get_param: ssh_key_name} |
| 337 |
user_data_format: RAW |
| 338 |
user_data: {get_resource: kube_master_init} |
| 339 |
config_drive: true |
| 340 |
networks: |
| 341 |
- port: {get_resource: kube_master_eth0} |
| 342 |
|
| 343 |
kube_master_eth0: |
| 344 |
type: OS::Neutron::Port |
| 345 |
properties: |
| 346 |
network: {get_param: fixed_network} |
| 347 |
security_groups: |
| 348 |
- {get_param: secgroup_base_id} |
| 349 |
- {get_param: secgroup_kube_master_id} |
| 350 |
fixed_ips: |
| 351 |
- subnet: {get_param: fixed_subnet} |
| 352 |
allowed_address_pairs: |
| 353 |
- ip_address: {get_param: flannel_network_cidr} |
| 354 |
replacement_policy: AUTO |
| 355 |
|
| 356 |
kube_master_floating: |
| 357 |
type: Magnum::Optional::KubeMaster::Neutron::FloatingIP |
| 358 |
properties: |
| 359 |
floating_network: {get_param: external_network} |
| 360 |
port_id: {get_resource: kube_master_eth0} |
| 361 |
|
| 362 |
api_pool_member: |
| 363 |
type: Magnum::Optional::Neutron::LBaaS::PoolMember |
| 364 |
properties: |
| 365 |
pool: {get_param: api_pool_id} |
| 366 |
address: {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]} |
| 367 |
subnet: { get_param: fixed_subnet } |
| 368 |
protocol_port: {get_param: kubernetes_port} |
| 369 |
|
| 370 |
etcd_pool_member: |
| 371 |
type: Magnum::Optional::Neutron::LBaaS::PoolMember |
| 372 |
properties: |
| 373 |
pool: {get_param: etcd_pool_id} |
| 374 |
address: {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]} |
| 375 |
subnet: { get_param: fixed_subnet } |
| 376 |
protocol_port: 2379 |
| 377 |
|
| 378 |
outputs: |
| 379 |
|
| 380 |
kube_master_ip: |
| 381 |
value: {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]} |
| 382 |
description: > |
| 383 |
This is the "private" IP address of the Kubernetes master node. |
| 384 |
|
| 385 |
kube_master_external_ip: |
| 386 |
value: {get_attr: [kube_master_floating, floating_ip_address]} |
| 387 |
description: > |
| 388 |
This is the "public" IP address of the Kubernetes master node. |