diff options
-rw-r--r-- | deployment/heat/onap-oom/k8s_vm_init.sh | 21 | ||||
-rw-r--r-- | deployment/heat/onap-oom/k8s_vm_init_serv.sh | 98 | ||||
-rw-r--r-- | deployment/heat/onap-oom/k8s_vm_install.sh (renamed from deployment/heat/onap-oom/k8s_vm_entrypoint.sh) | 22 | ||||
-rw-r--r-- | deployment/heat/onap-oom/onap-oom.yaml | 952 | ||||
-rw-r--r-- | deployment/heat/onap-oom/parts/onap-oom-2.yaml | 56 |
5 files changed, 916 insertions, 233 deletions
diff --git a/deployment/heat/onap-oom/k8s_vm_init.sh b/deployment/heat/onap-oom/k8s_vm_init.sh new file mode 100644 index 000000000..5d162cb87 --- /dev/null +++ b/deployment/heat/onap-oom/k8s_vm_init.sh @@ -0,0 +1,21 @@ +#!/bin/bash -x +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +RANCHER_IMAGES=$(docker images | grep rancher | wc -l) +if [ $RANCHER_IMAGES -eq 0 ]; then + while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do + mount /dockerdata-nfs + sleep 10 + done + + cd ~ + cp /dockerdata-nfs/rancher_agent_cmd.sh . + sed -i "s/docker run/docker run -e CATTLE_HOST_LABELS='__host_label__=true' -e CATTLE_AGENT_IP=__host_private_ip_addr__/g" rancher_agent_cmd.sh + source rancher_agent_cmd.sh +fi diff --git a/deployment/heat/onap-oom/k8s_vm_init_serv.sh b/deployment/heat/onap-oom/k8s_vm_init_serv.sh new file mode 100644 index 000000000..153607739 --- /dev/null +++ b/deployment/heat/onap-oom/k8s_vm_init_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: k8s_vm_init.sh +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./k8s_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh b/deployment/heat/onap-oom/k8s_vm_install.sh index 62340c11c..e5b843e5d 100644 --- a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh +++ b/deployment/heat/onap-oom/k8s_vm_install.sh @@ -1,5 +1,4 @@ #!/bin/bash -x -# # Copyright 2018 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -8,16 +7,15 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # - export DEBIAN_FRONTEND=noninteractive -HOST_IP=$(hostname -I) -echo $HOST_IP `hostname` >> /etc/hosts +echo "__host_private_ip_addr__ $(hostname)" >> /etc/hosts printenv mkdir -p /opt/config echo "__docker_version__" > /opt/config/docker_version.txt echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt echo "__rancher_private_ip_addr__" > /opt/config/rancher_private_ip_addr.txt +echo "__host_private_ip_addr__" > /opt/config/host_private_ip_addr.txt mkdir -p /etc/docker if [ ! -z "__docker_proxy__" ]; then @@ -28,7 +26,7 @@ if [ ! -z "__docker_proxy__" ]; then EOF fi if [ ! -z "__apt_proxy__" ]; then - cat > /etc/apt/apt.conf.d/30proxy<<EOF + cat > /etc/apt/apt.conf.d/30proxy <<EOF Acquire::http { Proxy "http://__apt_proxy__"; }; Acquire::https::Proxy "DIRECT"; EOF @@ -58,15 +56,5 @@ while ! hash docker &> /dev/null; do done apt-mark hold docker-ce -while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do - mount /dockerdata-nfs - sleep 10 -done - -cd ~ -cp /dockerdata-nfs/rancher_agent_cmd.sh . -sed -i "s/docker run/docker run -e CATTLE_HOST_LABELS='__host_label__=true' -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh -source rancher_agent_cmd.sh -sleep 1m - -reboot +# Enable autorestart when VM reboots +update-rc.d k8s_vm_init_serv defaults diff --git a/deployment/heat/onap-oom/onap-oom.yaml b/deployment/heat/onap-oom/onap-oom.yaml index f25bf6f76..4699bca13 100644 --- a/deployment/heat/onap-oom/onap-oom.yaml +++ b/deployment/heat/onap-oom/onap-oom.yaml @@ -265,6 +265,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_01_private_port } + k8s_01_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_01_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_01_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_01_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_01_vm_scripts } + k8s_01_vm: type: OS::Nova::Server properties: @@ -275,18 +317,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_01_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_01_vm_config } k8s_02_private_port: type: OS::Neutron::Port @@ -302,6 +334,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_02_private_port } + k8s_02_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_02_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_02_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_02_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_02_vm_scripts } + k8s_02_vm: type: OS::Nova::Server properties: @@ -312,18 +386,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_02_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_02_vm_config } k8s_03_private_port: type: OS::Neutron::Port @@ -339,6 +403,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_03_private_port } + k8s_03_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_03_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_03_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_03_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_03_vm_scripts } + k8s_03_vm: type: OS::Nova::Server properties: @@ -349,18 +455,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_03_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_03_vm_config } k8s_04_private_port: type: OS::Neutron::Port @@ -376,6 +472,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_04_private_port } + k8s_04_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_04_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_04_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_04_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_04_vm_scripts } + k8s_04_vm: type: OS::Nova::Server properties: @@ -386,18 +524,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_04_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_04_vm_config } k8s_05_private_port: type: OS::Neutron::Port @@ -413,6 +541,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_05_private_port } + k8s_05_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_05_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_05_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_05_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_05_vm_scripts } + k8s_05_vm: type: OS::Nova::Server properties: @@ -423,18 +593,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_05_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_05_vm_config } k8s_06_private_port: type: OS::Neutron::Port @@ -450,6 +610,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_06_private_port } + k8s_06_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_06_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_06_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_06_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_06_vm_scripts } + k8s_06_vm: type: OS::Nova::Server properties: @@ -460,18 +662,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_06_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_06_vm_config } k8s_07_private_port: type: OS::Neutron::Port @@ -487,6 +679,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_07_private_port } + k8s_07_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_07_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_07_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_07_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_07_vm_scripts } + k8s_07_vm: type: OS::Nova::Server properties: @@ -497,18 +731,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_07_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_07_vm_config } k8s_08_private_port: type: OS::Neutron::Port @@ -524,6 +748,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_08_private_port } + k8s_08_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_08_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_08_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_08_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_08_vm_scripts } + k8s_08_vm: type: OS::Nova::Server properties: @@ -534,18 +800,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_08_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_08_vm_config } k8s_09_private_port: type: OS::Neutron::Port @@ -561,6 +817,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_09_private_port } + k8s_09_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_09_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_09_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_09_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_09_vm_scripts } + k8s_09_vm: type: OS::Nova::Server properties: @@ -571,18 +869,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_09_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_09_vm_config } k8s_10_private_port: type: OS::Neutron::Port @@ -598,6 +886,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_10_private_port } + k8s_10_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_10_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_10_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_10_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_10_vm_scripts } + k8s_10_vm: type: OS::Nova::Server properties: @@ -608,18 +938,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_10_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_10_vm_config } k8s_11_private_port: type: OS::Neutron::Port @@ -635,6 +955,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_11_private_port } + k8s_11_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_11_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_11_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_11_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_11_vm_scripts } + k8s_11_vm: type: OS::Nova::Server properties: @@ -645,18 +1007,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_11_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_11_vm_config } k8s_12_private_port: type: OS::Neutron::Port @@ -672,6 +1024,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: k8s_12_private_port } + k8s_12_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [k8s_12_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [k8s_12_floating_ip, fixed_ip_address] } + __host_label__: 'compute' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + k8s_12_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: k8s_12_vm_scripts } + k8s_12_vm: type: OS::Nova::Server properties: @@ -682,18 +1076,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: k8s_12_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'compute' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: k8s_12_vm_config } etcd_1_private_port: type: OS::Neutron::Port @@ -709,6 +1093,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: etcd_1_private_port } + etcd_1_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [etcd_1_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [etcd_1_floating_ip, fixed_ip_address] } + __host_label__: 'etcd' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + etcd_1_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: etcd_1_vm_scripts } + etcd_1_vm: type: OS::Nova::Server properties: @@ -719,18 +1145,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: etcd_1_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'etcd' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: etcd_1_vm_config } etcd_2_private_port: type: OS::Neutron::Port @@ -746,6 +1162,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: etcd_2_private_port } + etcd_2_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [etcd_2_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [etcd_2_floating_ip, fixed_ip_address] } + __host_label__: 'etcd' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + etcd_2_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: etcd_2_vm_scripts } + etcd_2_vm: type: OS::Nova::Server properties: @@ -756,18 +1214,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: etcd_2_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'etcd' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: etcd_2_vm_config } etcd_3_private_port: type: OS::Neutron::Port @@ -783,6 +1231,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: etcd_3_private_port } + etcd_3_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [etcd_3_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [etcd_3_floating_ip, fixed_ip_address] } + __host_label__: 'etcd' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + etcd_3_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: etcd_3_vm_scripts } + etcd_3_vm: type: OS::Nova::Server properties: @@ -793,18 +1283,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: etcd_3_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'etcd' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: etcd_3_vm_config } orch_1_private_port: type: OS::Neutron::Port @@ -820,6 +1300,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: orch_1_private_port } + orch_1_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [orch_1_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [orch_1_floating_ip, fixed_ip_address] } + __host_label__: 'orchestration' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + orch_1_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: orch_1_vm_scripts } + orch_1_vm: type: OS::Nova::Server properties: @@ -830,18 +1352,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: orch_1_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'orchestration' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: orch_1_vm_config } orch_2_private_port: type: OS::Neutron::Port @@ -857,6 +1369,48 @@ resources: floating_network_id: { get_param: public_net_id } port_id: { get_resource: orch_2_private_port } + orch_2_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [orch_2_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [orch_2_floating_ip, fixed_ip_address] } + __host_label__: 'orchestration' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + orch_2_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: orch_2_vm_scripts } + orch_2_vm: type: OS::Nova::Server properties: @@ -867,18 +1421,8 @@ resources: key_name: { get_param: key_name } networks: - port: { get_resource: orch_2_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: 'orchestration' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: orch_2_vm_config } outputs: rancher_vm_ip: diff --git a/deployment/heat/onap-oom/parts/onap-oom-2.yaml b/deployment/heat/onap-oom/parts/onap-oom-2.yaml index ff2272d92..34fc0d78f 100644 --- a/deployment/heat/onap-oom/parts/onap-oom-2.yaml +++ b/deployment/heat/onap-oom/parts/onap-oom-2.yaml @@ -12,6 +12,48 @@ floating_network_id: { get_param: public_net_id } port_id: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port } + ${VM_TYPE}_${VM_NUM}_vm_scripts: + type: OS::Heat::CloudConfig + properties: + cloud_config: + power_state: + mode: reboot + runcmd: + - [ /opt/k8s_vm_install.sh ] + write_files: + - path: /opt/k8s_vm_install.sh + permissions: '0755' + content: + str_replace: + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __docker_version__: { get_param: docker_version } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } + __host_private_ip_addr__: { get_attr: [${VM_TYPE}_${VM_NUM}_floating_ip, fixed_ip_address] } + template: + get_file: k8s_vm_install.sh + - path: /opt/k8s_vm_init.sh + permissions: '0755' + content: + str_replace: + params: + __host_private_ip_addr__: { get_attr: [${VM_TYPE}_${VM_NUM}_floating_ip, fixed_ip_address] } + __host_label__: '$HOST_LABEL' + template: + get_file: k8s_vm_init.sh + - path: /etc/init.d/k8s_vm_init_serv + permissions: '0755' + content: + get_file: k8s_vm_init_serv.sh + + ${VM_TYPE}_${VM_NUM}_vm_config: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: ${VM_TYPE}_${VM_NUM}_vm_scripts } + ${VM_TYPE}_${VM_NUM}_vm: type: OS::Nova::Server properties: @@ -22,16 +64,6 @@ key_name: { get_param: key_name } networks: - port: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port } - user_data_format: RAW - user_data: - str_replace: - params: - __docker_proxy__: { get_param: docker_proxy } - __apt_proxy__: { get_param: apt_proxy } - __docker_version__: { get_param: docker_version } - __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } - __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] } - __host_label__: '$HOST_LABEL' - template: - get_file: k8s_vm_entrypoint.sh + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: ${VM_TYPE}_${VM_NUM}_vm_config } |