| 1 |
heat_template_version: 2014-10-16 |
| 2 |
|
| 3 |
description: > |
| 4 |
This is a nested stack that defines a single Kubernetes minion, This stack is |
| 5 |
included by an AutoScalingGroup 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 |
minion_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 |
kube_allow_priv: |
| 29 |
type: string |
| 30 |
description: > |
| 31 |
whether or not kubernetes should permit privileged containers. |
| 32 |
default: "false" |
| 33 |
constraints: |
| 34 |
- allowed_values: ["true", "false"] |
| 35 |
|
| 36 |
docker_volume_size: |
| 37 |
type: number |
| 38 |
description: > |
| 39 |
size of a cinder volume to allocate to docker for container/image |
| 40 |
storage |
| 41 |
default: 0 |
| 42 |
|
| 43 |
tls_disabled: |
| 44 |
type: boolean |
| 45 |
description: whether or not to enable TLS |
| 46 |
default: False |
| 47 |
|
| 48 |
kubernetes_port: |
| 49 |
type: number |
| 50 |
description: > |
| 51 |
The port which are used by kube-apiserver to provide Kubernetes |
| 52 |
service. |
| 53 |
default: 6443 |
| 54 |
|
| 55 |
cluster_uuid: |
| 56 |
type: string |
| 57 |
description: identifier for the cluster this template is generating |
| 58 |
|
| 59 |
magnum_url: |
| 60 |
type: string |
| 61 |
description: endpoint to retrieve TLS certs from |
| 62 |
|
| 63 |
kube_version: |
| 64 |
type: string |
| 65 |
description: version of kubernetes used for kubernetes cluster |
| 66 |
|
| 67 |
kube_master_ip: |
| 68 |
type: string |
| 69 |
description: IP address of the Kubernetes master server. |
| 70 |
|
| 71 |
etcd_server_ip: |
| 72 |
type: string |
| 73 |
description: IP address of the Etcd server. |
| 74 |
|
| 75 |
fixed_network: |
| 76 |
type: string |
| 77 |
description: Network from which to allocate fixed addresses. |
| 78 |
|
| 79 |
fixed_subnet: |
| 80 |
type: string |
| 81 |
description: Subnet from which to allocate fixed addresses. |
| 82 |
|
| 83 |
network_driver: |
| 84 |
type: string |
| 85 |
description: network driver to use for instantiating container networks |
| 86 |
|
| 87 |
flannel_network_cidr: |
| 88 |
type: string |
| 89 |
description: network range for flannel overlay network |
| 90 |
|
| 91 |
wait_condition_timeout: |
| 92 |
type: number |
| 93 |
description : > |
| 94 |
timeout for the Wait Conditions |
| 95 |
|
| 96 |
http_proxy: |
| 97 |
type: string |
| 98 |
description: http proxy address for docker |
| 99 |
|
| 100 |
https_proxy: |
| 101 |
type: string |
| 102 |
description: https proxy address for docker |
| 103 |
|
| 104 |
no_proxy: |
| 105 |
type: string |
| 106 |
description: no proxies for docker |
| 107 |
|
| 108 |
registry_enabled: |
| 109 |
type: boolean |
| 110 |
description: > |
| 111 |
Indicates whether the docker registry is enabled. |
| 112 |
default: false |
| 113 |
|
| 114 |
registry_port: |
| 115 |
type: number |
| 116 |
description: port of registry service |
| 117 |
default: 5000 |
| 118 |
|
| 119 |
registry_username: |
| 120 |
type: string |
| 121 |
description: username used by docker registry |
| 122 |
default: "username" |
| 123 |
|
| 124 |
registry_password: |
| 125 |
type: string |
| 126 |
description: password used by docker registry |
| 127 |
default: "password" |
| 128 |
|
| 129 |
registry_domain: |
| 130 |
type: string |
| 131 |
description: domain used by docker registry |
| 132 |
default: "domain" |
| 133 |
|
| 134 |
registry_trust_id: |
| 135 |
type: string |
| 136 |
description: trust_id used by docker registry |
| 137 |
default: "trust_id" |
| 138 |
|
| 139 |
registry_auth_url: |
| 140 |
type: string |
| 141 |
description: auth_url for keystone |
| 142 |
default: "auth_url" |
| 143 |
|
| 144 |
registry_region: |
| 145 |
type: string |
| 146 |
description: region of swift service |
| 147 |
default: "region" |
| 148 |
|
| 149 |
registry_container: |
| 150 |
type: string |
| 151 |
description: > |
| 152 |
name of swift container which docker registry stores images in |
| 153 |
default: "container" |
| 154 |
|
| 155 |
registry_insecure: |
| 156 |
type: boolean |
| 157 |
description: > |
| 158 |
indicates whether to skip TLS verification between registry and backend storage |
| 159 |
default: true |
| 160 |
|
| 161 |
registry_chunksize: |
| 162 |
type: number |
| 163 |
description: > |
| 164 |
size fo the data segments for the swift dynamic large objects |
| 165 |
default: 5242880 |
| 166 |
|
| 167 |
secgroup_kube_minion_id: |
| 168 |
type: string |
| 169 |
description: ID of the security group for kubernetes minion. |
| 170 |
|
| 171 |
kube_minion_id: |
| 172 |
type: string |
| 173 |
description: ID of for kubernetes minion. |
| 174 |
|
| 175 |
auth_url: |
| 176 |
type: string |
| 177 |
description: > |
| 178 |
url for kubernetes to authenticate before sending request to neutron |
| 179 |
|
| 180 |
trustee_domain_id: |
| 181 |
type: string |
| 182 |
description: domain id of the trustee |
| 183 |
|
| 184 |
trustee_user_id: |
| 185 |
type: string |
| 186 |
description: user id of the trustee |
| 187 |
|
| 188 |
trustee_username: |
| 189 |
type: string |
| 190 |
description: username of the trustee |
| 191 |
|
| 192 |
trustee_password: |
| 193 |
type: string |
| 194 |
description: password of the trustee |
| 195 |
hidden: true |
| 196 |
|
| 197 |
trust_id: |
| 198 |
type: string |
| 199 |
description: id of the trust which is used by the trustee |
| 200 |
hidden: true |
| 201 |
|
| 202 |
resources: |
| 203 |
|
| 204 |
minion_wait_handle: |
| 205 |
type: OS::Heat::WaitConditionHandle |
| 206 |
|
| 207 |
minion_wait_condition: |
| 208 |
type: OS::Heat::WaitCondition |
| 209 |
depends_on: kube-minion |
| 210 |
properties: |
| 211 |
handle: {get_resource: minion_wait_handle} |
| 212 |
timeout: {get_param: wait_condition_timeout} |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 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-minion.yaml} |
| 227 |
params: |
| 228 |
"$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv} |
| 229 |
"$KUBE_MASTER_IP": {get_param: kube_master_ip} |
| 230 |
"$KUBE_NODE_IP": {get_attr: [kube_minion_eth0, fixed_ips, 0, ip_address]} |
| 231 |
"$KUBE_API_PORT": {get_param: kubernetes_port} |
| 232 |
"$ETCD_SERVER_IP": {get_param: etcd_server_ip} |
| 233 |
"$DOCKER_VOLUME": {get_resource: docker_volume} |
| 234 |
"$NETWORK_DRIVER": {get_param: network_driver} |
| 235 |
"$REGISTRY_ENABLED": {get_param: registry_enabled} |
| 236 |
"$REGISTRY_PORT": {get_param: registry_port} |
| 237 |
"$REGISTRY_AUTH_URL": {get_param: registry_auth_url} |
| 238 |
"$REGISTRY_REGION": {get_param: registry_region} |
| 239 |
"$REGISTRY_USERNAME": {get_param: registry_username} |
| 240 |
"$REGISTRY_PASSWORD": {get_param: registry_password} |
| 241 |
"$REGISTRY_DOMAIN": {get_param: registry_domain} |
| 242 |
"$REGISTRY_TRUST_ID": {get_param: registry_trust_id} |
| 243 |
"$REGISTRY_CONTAINER": {get_param: registry_container} |
| 244 |
"$REGISTRY_INSECURE": {get_param: registry_insecure} |
| 245 |
"$REGISTRY_CHUNKSIZE": {get_param: registry_chunksize} |
| 246 |
"$TLS_DISABLED": {get_param: tls_disabled} |
| 247 |
"$KUBE_VERSION": {get_param: kube_version} |
| 248 |
"$CLUSTER_UUID": {get_param: cluster_uuid} |
| 249 |
"$MAGNUM_URL": {get_param: magnum_url} |
| 250 |
"$HTTP_PROXY": {get_param: http_proxy} |
| 251 |
"$HTTPS_PROXY": {get_param: https_proxy} |
| 252 |
"$NO_PROXY": {get_param: no_proxy} |
| 253 |
"$AUTH_URL": {get_param: auth_url} |
| 254 |
"$TRUSTEE_DOMAIN_ID": {get_param: trustee_domain_id} |
| 255 |
"$TRUSTEE_USER_ID": {get_param: trustee_user_id} |
| 256 |
"$TRUSTEE_USERNAME": {get_param: trustee_username} |
| 257 |
"$TRUSTEE_PASSWORD": {get_param: trustee_password} |
| 258 |
"$TRUST_ID": {get_param: trust_id} |
| 259 |
|
| 260 |
write_kubeconfig: |
| 261 |
type: OS::Heat::SoftwareConfig |
| 262 |
properties: |
| 263 |
group: ungrouped |
| 264 |
config: {get_file: fragments/write-kubeconfig.yaml} |
| 265 |
|
| 266 |
make_cert: |
| 267 |
type: OS::Heat::SoftwareConfig |
| 268 |
properties: |
| 269 |
group: ungrouped |
| 270 |
config: {get_file: fragments/make-cert-client.sh} |
| 271 |
|
| 272 |
configure_flanneld: |
| 273 |
type: OS::Heat::SoftwareConfig |
| 274 |
properties: |
| 275 |
group: ungrouped |
| 276 |
config: {get_file: fragments/configure-flanneld-minion.sh} |
| 277 |
|
| 278 |
configure_docker: |
| 279 |
type: OS::Heat::SoftwareConfig |
| 280 |
properties: |
| 281 |
group: ungrouped |
| 282 |
config: {get_file: fragments/configure-docker.sh} |
| 283 |
|
| 284 |
create_kubernetes_user: |
| 285 |
type: OS::Heat::SoftwareConfig |
| 286 |
properties: |
| 287 |
group: ungrouped |
| 288 |
config: {get_file: fragments/create-kubernetes-user.yaml} |
| 289 |
|
| 290 |
configure_kubernetes: |
| 291 |
type: OS::Heat::SoftwareConfig |
| 292 |
properties: |
| 293 |
group: ungrouped |
| 294 |
config: {get_file: fragments/configure-kubernetes-minion.sh} |
| 295 |
|
| 296 |
add_proxy: |
| 297 |
type: OS::Heat::SoftwareConfig |
| 298 |
properties: |
| 299 |
group: ungrouped |
| 300 |
config: {get_file: fragments/add-proxy.sh} |
| 301 |
|
| 302 |
minion_wc_notify: |
| 303 |
type: OS::Heat::SoftwareConfig |
| 304 |
properties: |
| 305 |
group: ungrouped |
| 306 |
config: |
| 307 |
str_replace: |
| 308 |
template: | |
| 309 |
#!/bin/bash -v |
| 310 |
wc_notify --data-binary '{"status": "SUCCESS"}' |
| 311 |
params: |
| 312 |
wc_notify: {get_attr: [minion_wait_handle, curl_cli]} |
| 313 |
|
| 314 |
kube_minion_init: |
| 315 |
type: OS::Heat::MultipartMime |
| 316 |
properties: |
| 317 |
parts: |
| 318 |
- config: {get_resource: write_heat_params} |
| 319 |
- config: {get_resource: write_kubeconfig} |
| 320 |
- config: {get_resource: make_cert} |
| 321 |
- config: {get_resource: configure_flanneld} |
| 322 |
- config: {get_resource: configure_docker} |
| 323 |
- config: {get_resource: create_kubernetes_user} |
| 324 |
- config: {get_resource: configure_kubernetes} |
| 325 |
- config: {get_resource: add_proxy} |
| 326 |
- config: {get_resource: minion_wc_notify} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
kube-minion: |
| 340 |
type: OS::Nova::Server |
| 341 |
properties: |
| 342 |
name: {get_param: kube_minion_id} |
| 343 |
image: {get_param: server_image} |
| 344 |
flavor: {get_param: minion_flavor} |
| 345 |
key_name: {get_param: ssh_key_name} |
| 346 |
user_data_format: RAW |
| 347 |
user_data: {get_resource: kube_minion_init} |
| 348 |
networks: |
| 349 |
- port: {get_resource: kube_minion_eth0} |
| 350 |
|
| 351 |
kube_minion_eth0: |
| 352 |
type: OS::Neutron::Port |
| 353 |
properties: |
| 354 |
network: {get_param: fixed_network} |
| 355 |
security_groups: |
| 356 |
- get_param: secgroup_kube_minion_id |
| 357 |
fixed_ips: |
| 358 |
- subnet: {get_param: fixed_subnet} |
| 359 |
allowed_address_pairs: |
| 360 |
- ip_address: {get_param: flannel_network_cidr} |
| 361 |
replacement_policy: AUTO |
| 362 |
|
| 363 |
kube_minion_floating: |
| 364 |
type: Magnum::Optional::KubeMinion::Neutron::FloatingIP |
| 365 |
properties: |
| 366 |
floating_network: {get_param: external_network} |
| 367 |
port_id: {get_resource: kube_minion_eth0} |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
docker_volume: |
| 376 |
type: OS::Cinder::Volume |
| 377 |
properties: |
| 378 |
size: {get_param: docker_volume_size} |
| 379 |
|
| 380 |
docker_volume_attach: |
| 381 |
type: OS::Cinder::VolumeAttachment |
| 382 |
properties: |
| 383 |
instance_uuid: {get_resource: kube-minion} |
| 384 |
volume_id: {get_resource: docker_volume} |
| 385 |
mountpoint: /dev/vdb |
| 386 |
|
| 387 |
outputs: |
| 388 |
|
| 389 |
kube_minion_ip: |
| 390 |
value: {get_attr: [kube_minion_eth0, fixed_ips, 0, ip_address]} |
| 391 |
description: > |
| 392 |
This is the "public" IP address of the Kubernetes minion node. |
| 393 |
|
| 394 |
kube_minion_external_ip: |
| 395 |
value: {get_attr: [kube_minion_floating, floating_ip_address]} |
| 396 |
description: > |
| 397 |
This is the "public" IP address of the Kubernetes minion node. |
| 398 |
|
| 399 |
OS::stack_id: |
| 400 |
value: {get_param: "OS::stack_id"} |
| 401 |
description: > |
| 402 |
This is a id of the stack which creates from this template. |