diff options
Diffstat (limited to 'deployment/heat/onap-oom/scripts')
-rwxr-xr-x | deployment/heat/onap-oom/scripts/deploy.sh | 19 | ||||
-rwxr-xr-x | deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh | 50 |
2 files changed, 59 insertions, 10 deletions
diff --git a/deployment/heat/onap-oom/scripts/deploy.sh b/deployment/heat/onap-oom/scripts/deploy.sh index 056174d28..c4d9bf887 100755 --- a/deployment/heat/onap-oom/scripts/deploy.sh +++ b/deployment/heat/onap-oom/scripts/deploy.sh @@ -21,31 +21,30 @@ for n in $(seq 1 5); do for i in $(seq 1 30); do sleep 30 - K8S_IP=$(openstack stack output show onap-oom k8s_vm_ip -c output_value -f value) RANCHER_IP=$(openstack stack output show onap-oom rancher_vm_ip -c output_value -f value) - timeout 1 ping -c 1 "$K8S_IP" && timeout 1 ping -c 1 "$RANCHER_IP" && break + timeout 1 ping -c 1 "$RANCHER_IP" && break done - timeout 1 ping -c 1 "$K8S_IP" && timeout 1 ping -c 1 "$RANCHER_IP" && break + timeout 1 ping -c 1 "$RANCHER_IP" && break - echo Error: OpenStack infrastructure issue: unable to reach both rancher "$RANCHER_IP" and k8s "$K8S_IP" + echo Error: OpenStack infrastructure issue: unable to reach rancher "$RANCHER_IP" sleep 10 done -if ! timeout 1 ping -c 1 "$K8S_IP" || ! timeout 1 ping -c 1 "$RANCHER_IP"; then +if ! timeout 1 ping -c 1 "$RANCHER_IP"; then exit 2 fi -ssh-keygen -R $K8S_IP +ssh-keygen -R $RANCHER_IP for n in $(seq 1 10); do - timeout 15m ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"' + timeout 15m ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"' RESULT=$? if [ $RESULT -eq 0 ]; then break fi sleep 15m done -ROBOT_POD=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//') -LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP "sudo su -c \"kubectl exec $ROBOT_POD --namespace onap -- ls -1t /share/logs | head -1\"") -wget --user=robot --password=robot -r -np -nH --cut-dirs=2 -R "index.html*" -P $WORKSPACE/archives/ http://$K8S_IP:30209/logs/$LOG_DIR/ +ROBOT_POD=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//') +LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP "sudo su -c \"kubectl exec $ROBOT_POD --namespace onap -- ls -1t /share/logs | head -1\"") +wget --user=robot --password=robot -r -np -nH --cut-dirs=2 -R "index.html*" -P $WORKSPACE/archives/ http://$RANCHER_IP:30209/logs/$LOG_DIR/ exit 0 diff --git a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh new file mode 100755 index 000000000..a63365837 --- /dev/null +++ b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +NUM_K8S_VMS=7 + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi +PARTS_DIR=$WORKSPACE/deployment/heat/onap-oom/parts + +cat $PARTS_DIR/onap-oom-1.yaml + +cat <<EOF + rancher_vm: + type: OS::Nova::Server + properties: + name: rancher + image: { get_param: ubuntu_1604_image } + flavor: { get_param: rancher_vm_flavor } + key_name: onap_key + networks: + - port: { get_resource: rancher_private_port } + user_data_format: RAW + user_data: + str_replace: + template: + get_file: rancher_vm_entrypoint.sh + params: + __lab_name__: { get_param: lab_name } + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __k8s_vm_ips__: [ +EOF + +for VM_NUM in $(seq $NUM_K8S_VMS); do + K8S_VM_NAME=k8s_$VM_NUM + cat <<EOF + get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address], +EOF +done + +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 +done + +cat $PARTS_DIR/onap-oom-3.yaml |