3 # Copyright 2018 Huawei Technologies Co., Ltd.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
12 if [ "$#" -ne 1 ]; then
13 echo This script generates the HEAT template for X number of k8s VMs
14 echo "$0 <num k8s vms>"
19 if [ -z "$WORKSPACE" ]; then
20 export WORKSPACE=`git rev-parse --show-toplevel`
22 PARTS_DIR=$WORKSPACE/deployment/heat/onap-oom/parts
26 # Generated by scripts/gen-onap-oom-yaml.sh; MANUAL CHANGES WILL BE LOST
30 cat $PARTS_DIR/onap-oom-1.yaml
34 type: OS::Nova::Server
37 list_join: ['-', [{ get_param: 'OS::stack_name' }, 'rancher']]
38 image: { get_param: ubuntu_1604_image }
39 flavor: { get_param: rancher_vm_flavor }
40 key_name: { get_param: key_name }
42 - port: { get_resource: rancher_private_port }
47 get_file: rancher_vm_entrypoint.sh
49 __docker_proxy__: { get_param: docker_proxy }
50 __apt_proxy__: { get_param: apt_proxy }
51 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
52 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
53 __integration_override_yaml__: { get_param: integration_override_yaml }
54 __integration_gerrit_branch__: { get_param: integration_gerrit_branch }
55 __integration_gerrit_refspec__: { get_param: integration_gerrit_refspec }
56 __oom_gerrit_branch__: { get_param: oom_gerrit_branch }
57 __oom_gerrit_refspec__: { get_param: oom_gerrit_refspec }
58 __docker_manifest__: { get_param: docker_manifest }
59 __docker_version__: { get_param: docker_version }
60 __rancher_version__: { get_param: rancher_version }
61 __rancher_agent_version__: { get_param: rancher_agent_version }
62 __kubectl_version__: { get_param: kubectl_version }
63 __helm_version__: { get_param: helm_version }
64 __public_net_id__: { get_param: public_net_id }
65 __oam_network_cidr__: { get_param: oam_network_cidr }
66 __oam_network_id__: { get_resource: oam_network }
67 __oam_subnet_id__: { get_resource: oam_subnet }
68 __sec_group__: { get_resource: onap_sg }
69 __k8s_1_vm_ip__: { get_attr: [k8s_1_floating_ip, floating_ip_address] }
73 for VM_NUM in $(seq $NUM_K8S_VMS); do
74 K8S_VM_NAME=k8s_$VM_NUM
76 get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address],
82 __k8s_private_ips__: [
85 for VM_NUM in $(seq $NUM_K8S_VMS); do
86 K8S_VM_NAME=k8s_$VM_NUM
88 get_attr: [${K8S_VM_NAME}_floating_ip, fixed_ip_address],
96 for VM_NUM in $(seq $NUM_K8S_VMS); do
97 VM_TYPE=k8s HOST_LABEL=compute VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml
100 for VM_NUM in $(seq 3); do
101 VM_TYPE=etcd HOST_LABEL=etcd VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml
104 for VM_NUM in $(seq 1); do
105 VM_TYPE=orch HOST_LABEL=orchestration VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml
109 cat $PARTS_DIR/onap-oom-3.yaml
111 for VM_NUM in $(seq $NUM_K8S_VMS); do
112 K8S_VM_NAME=k8s_$VM_NUM
114 ${K8S_VM_NAME}_vm_ip:
115 description: The IP address of the ${K8S_VM_NAME} instance
116 value: { get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address] }