diff options
-rw-r--r-- | deployment/heat/onap-oom/env/tlab/onap-oom.env | 2 | ||||
-rw-r--r-- | deployment/heat/onap-oom/env/windriver/onap-oom.env | 2 | ||||
-rw-r--r-- | deployment/heat/onap-oom/k8s_vm_entrypoint.sh | 14 | ||||
-rw-r--r-- | deployment/heat/onap-oom/onap-oom.yaml | 221 | ||||
-rw-r--r-- | deployment/heat/onap-oom/parts/onap-oom-1.yaml | 16 | ||||
-rw-r--r-- | deployment/heat/onap-oom/parts/onap-oom-2.yaml | 15 | ||||
-rw-r--r-- | deployment/heat/onap-oom/rancher_vm_entrypoint.sh | 34 | ||||
-rwxr-xr-x | deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh | 11 |
8 files changed, 254 insertions, 61 deletions
diff --git a/deployment/heat/onap-oom/env/tlab/onap-oom.env b/deployment/heat/onap-oom/env/tlab/onap-oom.env index 33ba83dda..b1f0da15c 100644 --- a/deployment/heat/onap-oom/env/tlab/onap-oom.env +++ b/deployment/heat/onap-oom/env/tlab/onap-oom.env @@ -7,6 +7,8 @@ parameters: rancher_vm_flavor: m5.xlarge k8s_vm_flavor: m4.xlarge + etcd_vm_flavor: m1.medium + orch_vm_flavor: m1.large public_net_id: fbe8fd92-6636-4e63-ab28-bb6a5b0888a9 diff --git a/deployment/heat/onap-oom/env/windriver/onap-oom.env b/deployment/heat/onap-oom/env/windriver/onap-oom.env index 2f57db646..c768cd245 100644 --- a/deployment/heat/onap-oom/env/windriver/onap-oom.env +++ b/deployment/heat/onap-oom/env/windriver/onap-oom.env @@ -7,6 +7,8 @@ parameters: rancher_vm_flavor: m2.xlarge k8s_vm_flavor: m1.xlarge + etcd_vm_flavor: m1.medium + orch_vm_flavor: m1.large public_net_id: 971040b2-7059-49dc-b220-4fab50cb2ad4 diff --git a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh index 6311dfbff..b93eab3f8 100644 --- a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh +++ b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh @@ -9,6 +9,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 # +export DEBIAN_FRONTEND=noninteractive printenv mkdir -p /opt/config @@ -36,16 +37,13 @@ fi mkdir -p /dockerdata-nfs echo "__rancher_private_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs noauto,noatime,fg,retry=1,x-systemd.automount,_netdev,soft,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab -# Fix virtual memory allocation for onap-log:elasticsearch: -echo "vm.max_map_count=262144" >> /etc/sysctl.conf -sysctl -p - # workaround for OpenStack intermittent failure to change default apt mirrors sed -i 's|http://archive.ubuntu.com|http://nova.clouds.archive.ubuntu.com|g' /etc/apt/sources.list while ! hash jq &> /dev/null; do apt-get -y update - apt-get -y install apt-transport-https ca-certificates curl software-properties-common linux-image-extra-$(uname -r) jq nfs-common + apt-get -y dist-upgrade + apt-get -y install linux-image-extra-$(uname -r) apt-transport-https ca-certificates curl software-properties-common jq nfs-common sleep 10 done @@ -55,6 +53,7 @@ while ! hash docker &> /dev/null; do usermod -aG docker ubuntu sleep 10 done +apt-mark hold docker-ce while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do mount /dockerdata-nfs @@ -63,5 +62,8 @@ done cd ~ cp /dockerdata-nfs/rancher_agent_cmd.sh . -sed -i "s/docker run/docker run -e CATTLE_AGENT_IP=${HOST_IP}/g" 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 diff --git a/deployment/heat/onap-oom/onap-oom.yaml b/deployment/heat/onap-oom/onap-oom.yaml index f6449b943..609af910b 100644 --- a/deployment/heat/onap-oom/onap-oom.yaml +++ b/deployment/heat/onap-oom/onap-oom.yaml @@ -31,6 +31,14 @@ parameters: type: string description: VM flavor for k8s hosts + etcd_vm_flavor: + type: string + description: VM flavor for etcd hosts + + orch_vm_flavor: + type: string + description: VM flavor for orch hosts + integration_override_yaml: type: string description: Content for integration_override.yaml @@ -61,19 +69,19 @@ parameters: docker_version: type: string - default: "17.03" + default: "17.03.2" rancher_version: type: string - default: "1.6.18" + default: "1.6.22" rancher_agent_version: type: string - default: "1.2.10" + default: "1.2.11" kubectl_version: type: string - default: "1.8.10" + default: "1.11.2" helm_version: type: string @@ -213,7 +221,6 @@ resources: get_attr: [k8s_10_floating_ip, floating_ip_address], get_attr: [k8s_11_floating_ip, floating_ip_address], get_attr: [k8s_12_floating_ip, floating_ip_address], - get_attr: [k8s_13_floating_ip, floating_ip_address], ] __k8s_private_ips__: [ get_attr: [k8s_1_floating_ip, fixed_ip_address], @@ -228,7 +235,6 @@ resources: get_attr: [k8s_10_floating_ip, fixed_ip_address], get_attr: [k8s_11_floating_ip, fixed_ip_address], get_attr: [k8s_12_floating_ip, fixed_ip_address], - get_attr: [k8s_13_floating_ip, fixed_ip_address], ] k8s_1_private_port: type: OS::Neutron::Port @@ -248,7 +254,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_1']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '1' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -263,6 +269,7 @@ resources: __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 @@ -284,7 +291,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_2']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '2' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -299,6 +306,7 @@ resources: __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 @@ -320,7 +328,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_3']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '3' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -335,6 +343,7 @@ resources: __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 @@ -356,7 +365,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_4']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '4' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -371,6 +380,7 @@ resources: __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 @@ -392,7 +402,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_5']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '5' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -407,6 +417,7 @@ resources: __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 @@ -428,7 +439,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_6']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '6' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -443,6 +454,7 @@ resources: __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 @@ -464,7 +476,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_7']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '7' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -479,6 +491,7 @@ resources: __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 @@ -500,7 +513,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_8']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '8' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -515,6 +528,7 @@ resources: __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 @@ -536,7 +550,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_9']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '9' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -551,6 +565,7 @@ resources: __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 @@ -572,7 +587,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_10']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '10' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -587,6 +602,7 @@ resources: __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 @@ -608,7 +624,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_11']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '11' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -623,6 +639,7 @@ resources: __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 @@ -644,7 +661,7 @@ resources: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_12']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '12' ] ] image: { get_param: ubuntu_1604_image } flavor: { get_param: k8s_vm_flavor } key_name: { get_param: key_name } @@ -659,10 +676,11 @@ resources: __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 - k8s_13_private_port: + etcd_1_private_port: type: OS::Neutron::Port properties: network: { get_resource: oam_network } @@ -670,22 +688,133 @@ resources: security_groups: - { get_resource: onap_sg } - k8s_13_floating_ip: + etcd_1_floating_ip: type: OS::Neutron::FloatingIP properties: floating_network_id: { get_param: public_net_id } - port_id: { get_resource: k8s_13_private_port } + port_id: { get_resource: etcd_1_private_port } - k8s_13_vm: + etcd_1_vm: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_13']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'etcd', '1' ] ] image: { get_param: ubuntu_1604_image } - flavor: { get_param: k8s_vm_flavor } + flavor: { get_param: etcd_vm_flavor } + 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 + + etcd_2_private_port: + type: OS::Neutron::Port + properties: + network: { get_resource: oam_network } + fixed_ips: [{"subnet": { get_resource: oam_subnet }}] + security_groups: + - { get_resource: onap_sg } + + etcd_2_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: public_net_id } + port_id: { get_resource: etcd_2_private_port } + + etcd_2_vm: + type: OS::Nova::Server + properties: + name: + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'etcd', '2' ] ] + image: { get_param: ubuntu_1604_image } + flavor: { get_param: etcd_vm_flavor } + 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 + + etcd_3_private_port: + type: OS::Neutron::Port + properties: + network: { get_resource: oam_network } + fixed_ips: [{"subnet": { get_resource: oam_subnet }}] + security_groups: + - { get_resource: onap_sg } + + etcd_3_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: public_net_id } + port_id: { get_resource: etcd_3_private_port } + + etcd_3_vm: + type: OS::Nova::Server + properties: + name: + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'etcd', '3' ] ] + image: { get_param: ubuntu_1604_image } + flavor: { get_param: etcd_vm_flavor } + 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 + + orch_1_private_port: + type: OS::Neutron::Port + properties: + network: { get_resource: oam_network } + fixed_ips: [{"subnet": { get_resource: oam_subnet }}] + security_groups: + - { get_resource: onap_sg } + + orch_1_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: public_net_id } + port_id: { get_resource: orch_1_private_port } + + orch_1_vm: + type: OS::Nova::Server + properties: + name: + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'orch', '1' ] ] + image: { get_param: ubuntu_1604_image } + flavor: { get_param: orch_vm_flavor } key_name: { get_param: key_name } networks: - - port: { get_resource: k8s_13_private_port } + - port: { get_resource: orch_1_private_port } user_data_format: RAW user_data: str_replace: @@ -695,6 +824,44 @@ resources: __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 + + orch_2_private_port: + type: OS::Neutron::Port + properties: + network: { get_resource: oam_network } + fixed_ips: [{"subnet": { get_resource: oam_subnet }}] + security_groups: + - { get_resource: onap_sg } + + orch_2_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: public_net_id } + port_id: { get_resource: orch_2_private_port } + + orch_2_vm: + type: OS::Nova::Server + properties: + name: + list_join: ['-', [ { get_param: 'OS::stack_name' }, 'orch', '2' ] ] + image: { get_param: ubuntu_1604_image } + flavor: { get_param: orch_vm_flavor } + 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 @@ -751,7 +918,3 @@ outputs: description: The IP address of the k8s_12 instance value: { get_attr: [k8s_12_floating_ip, floating_ip_address] } - k8s_13_vm_ip: - description: The IP address of the k8s_13 instance - value: { get_attr: [k8s_13_floating_ip, floating_ip_address] } - diff --git a/deployment/heat/onap-oom/parts/onap-oom-1.yaml b/deployment/heat/onap-oom/parts/onap-oom-1.yaml index ab79b1ed5..3c34f7544 100644 --- a/deployment/heat/onap-oom/parts/onap-oom-1.yaml +++ b/deployment/heat/onap-oom/parts/onap-oom-1.yaml @@ -28,6 +28,14 @@ parameters: type: string description: VM flavor for k8s hosts + etcd_vm_flavor: + type: string + description: VM flavor for etcd hosts + + orch_vm_flavor: + type: string + description: VM flavor for orch hosts + integration_override_yaml: type: string description: Content for integration_override.yaml @@ -58,19 +66,19 @@ parameters: docker_version: type: string - default: "17.03" + default: "17.03.2" rancher_version: type: string - default: "1.6.18" + default: "1.6.22" rancher_agent_version: type: string - default: "1.2.10" + default: "1.2.11" kubectl_version: type: string - default: "1.8.10" + default: "1.11.2" helm_version: type: string diff --git a/deployment/heat/onap-oom/parts/onap-oom-2.yaml b/deployment/heat/onap-oom/parts/onap-oom-2.yaml index e01ba132d..ff2272d92 100644 --- a/deployment/heat/onap-oom/parts/onap-oom-2.yaml +++ b/deployment/heat/onap-oom/parts/onap-oom-2.yaml @@ -1,4 +1,4 @@ - ${K8S_VM_NAME}_private_port: + ${VM_TYPE}_${VM_NUM}_private_port: type: OS::Neutron::Port properties: network: { get_resource: oam_network } @@ -6,22 +6,22 @@ security_groups: - { get_resource: onap_sg } - ${K8S_VM_NAME}_floating_ip: + ${VM_TYPE}_${VM_NUM}_floating_ip: type: OS::Neutron::FloatingIP properties: floating_network_id: { get_param: public_net_id } - port_id: { get_resource: ${K8S_VM_NAME}_private_port } + port_id: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port } - ${K8S_VM_NAME}_vm: + ${VM_TYPE}_${VM_NUM}_vm: type: OS::Nova::Server properties: name: - list_join: ['-', [ { get_param: 'OS::stack_name' }, '${K8S_VM_NAME}']] + list_join: ['-', [ { get_param: 'OS::stack_name' }, '${VM_TYPE}', '${VM_NUM}' ] ] image: { get_param: ubuntu_1604_image } - flavor: { get_param: k8s_vm_flavor } + flavor: { get_param: ${VM_TYPE}_vm_flavor } key_name: { get_param: key_name } networks: - - port: { get_resource: ${K8S_VM_NAME}_private_port } + - port: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port } user_data_format: RAW user_data: str_replace: @@ -31,6 +31,7 @@ __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 diff --git a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh index 18951d937..3bc811b8f 100644 --- a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh +++ b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh @@ -9,6 +9,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 # +export DEBIAN_FRONTEND=noninteractive printenv mkdir -p /opt/config @@ -87,11 +88,7 @@ git add -A git commit -m "initial commit" # export NFS mount -NFS_EXP="" -for K8S_VM_IP in $(tr -d ',[]' < /opt/config/k8s_private_ips.txt); do - NFS_EXP+="$K8S_VM_IP(rw,fsid=1,async,no_root_squash,no_subtree_check) " -done -echo "/dockerdata-nfs $NFS_EXP" | tee /etc/exports +echo "/dockerdata-nfs *(rw,fsid=1,async,no_root_squash,no_subtree_check)" | tee /etc/exports exportfs -a @@ -105,9 +102,10 @@ while ! hash docker &> /dev/null; do usermod -aG docker ubuntu sleep 10 done +apt-mark hold docker-ce # install rancher __rancher_version__ -docker run --restart unless-stopped -d -p 8080:8080 -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v__rancher_agent_version__ __docker_proxy__/rancher/server:v__rancher_version__ +docker run --name rancher-server --restart unless-stopped -d -p 8080:8080 -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v__rancher_agent_version__ __docker_proxy__/rancher/server:v__rancher_version__ # install kubectl __kubectl_version__ curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v__kubectl_version__/bin/linux/amd64/kubectl @@ -129,14 +127,14 @@ done OLD_PID=$(jq -r '.data[0].id' projects.json) curl -s -H "Accept: application/json" -H "Content-Type: application/json" -d '{"accountId":"1a1"}' http://$RANCHER_IP:8080/v2-beta/apikeys > apikeys.json -echo export RANCHER_ACCESS_KEY=`jq -r '.publicValue' apikeys.json` >> api-keys-rc -echo export RANCHER_SECRET_KEY=`jq -r '.secretValue' apikeys.json` >> api-keys-rc +echo export CATTLE_ACCESS_KEY=`jq -r '.publicValue' apikeys.json` >> api-keys-rc +echo export CATTLE_SECRET_KEY=`jq -r '.secretValue' apikeys.json` >> api-keys-rc source api-keys-rc -curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"id":"registry.default","type":"activeSetting","baseType":"setting","name":"registry.default","activeValue":"__docker_proxy__","inDb":true,"source":"Database","value":"__docker_proxy__"}' http://$RANCHER_IP:8080/v2-beta/settings/registry.default +curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"id":"registry.default","type":"activeSetting","baseType":"setting","name":"registry.default","activeValue":"__docker_proxy__","inDb":true,"source":"Database","value":"__docker_proxy__"}' http://$RANCHER_IP:8080/v2-beta/settings/registry.default -curl -s -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X DELETE -H 'Content-Type: application/json' "http://$RANCHER_IP:8080/v2-beta/projects/$OLD_PID" +curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X DELETE -H 'Content-Type: application/json' "http://$RANCHER_IP:8080/v2-beta/projects/$OLD_PID" until [ ! -z "$TEMPLATE_ID" ] && [ "$TEMPLATE_ID" != "null" ]; do sleep 5 @@ -144,7 +142,15 @@ until [ ! -z "$TEMPLATE_ID" ] && [ "$TEMPLATE_ID" != "null" ]; do TEMPLATE_ID=$(jq -r '.data[0].id' projectTemplatesKubernetes.json) done -curl -s -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" > project.json + +curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \ +-X PUT \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-d '{"stacks":[{"type":"catalogTemplate", "answers":{"CONSTRAINT_TYPE":"required"}, "name":"kubernetes", "templateVersionId":"library:infra*k8s:52"}, {"type":"catalogTemplate", "name":"network-services", "templateId":"library:infra*network-services"}, {"type":"catalogTemplate", "name":"ipsec", "templateId":"library:infra*ipsec"}, {"type":"catalogTemplate", "name":"healthcheck", "templateId":"library:infra*healthcheck"}]}' \ +"http://$RANCHER_IP:8080/v2-beta/projecttemplates/$TEMPLATE_ID" + +curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" > project.json PID=`jq -r '.id' project.json` echo export RANCHER_URL=http://$RANCHER_IP:8080/v1/projects/$PID >> api-keys-rc source api-keys-rc @@ -155,11 +161,11 @@ until [ $(jq -r '.state' project.json) == "active" ]; do done -curl -s -u $RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"docker-proxy", "serverAddress":"__docker_proxy__"}' $RANCHER_URL/registries > registry.json +curl -s -u $CATTLE_ACCESS_KEY:$CATTLE_SECRET_KEY -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"docker-proxy", "serverAddress":"__docker_proxy__"}' $RANCHER_URL/registries > registry.json RID=$(jq -r '.id' registry.json) -curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"publicValue":"docker", "registryId":"'$RID'", "secretValue":"docker", "type":"registryCredential"}' "http://$RANCHER_IP:8080/v2-beta/projects/$PID/registrycredential" +curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"publicValue":"docker", "registryId":"'$RID'", "secretValue":"docker", "type":"registryCredential"}' "http://$RANCHER_IP:8080/v2-beta/projects/$PID/registrycredential" @@ -178,7 +184,7 @@ git commit -a -m "Add rancher agent command file" cd ~ -KUBETOKEN=$(echo -n 'Basic '$(echo -n "$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | base64 -w 0) | base64 -w 0) +KUBETOKEN=$(echo -n 'Basic '$(echo -n "$CATTLE_ACCESS_KEY:$CATTLE_SECRET_KEY" | base64 -w 0) | base64 -w 0) # create .kube/config cat > ~/.kube/config <<EOF diff --git a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh index 81cfbe3d1..0afd48085 100755 --- a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh +++ b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh @@ -94,9 +94,18 @@ cat <<EOF EOF for VM_NUM in $(seq $NUM_K8S_VMS); do - K8S_VM_NAME=k8s_$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml + VM_TYPE=k8s HOST_LABEL=compute VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml done +for VM_NUM in $(seq 3); do + VM_TYPE=etcd HOST_LABEL=etcd VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml +done + +for VM_NUM in $(seq 2); do + VM_TYPE=orch HOST_LABEL=orchestration VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml +done + + cat $PARTS_DIR/onap-oom-3.yaml for VM_NUM in $(seq $NUM_K8S_VMS); do |