From 52dfdcb21383776e28a47f78fa04afe469ac78d9 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Thu, 25 Jan 2018 11:02:48 -0800 Subject: Updates to match OOM onap-parameters.yaml changes Change-Id: I76149fa3762221a8c1fc0cee6a44d83238ebdb89 Issue-ID: INT-381 Signed-off-by: Gary Wu --- deployment/heat/onap-oom/k8s_vm_entrypoint.sh | 190 ++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 29 deletions(-) (limited to 'deployment/heat/onap-oom/k8s_vm_entrypoint.sh') diff --git a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh index db2428ba9..216a187af 100644 --- a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh +++ b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh @@ -15,7 +15,7 @@ Acquire::http { Proxy "http://__apt_proxy__"; }; Acquire::https::Proxy "DIRECT"; EOF apt-get -y update -apt-get -y install jq +apt-get -y install linux-image-extra-$(uname -r) jq cd ~ @@ -48,7 +48,7 @@ until curl -s -o projects.json -H "Accept: application/json" http://$RANCHER_IP: 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 | tee apikeys.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 source api-keys-rc @@ -57,28 +57,28 @@ curl -s -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X DELETE -H 'Content-T until [ ! -z "$TEMPLATE_ID" ] && [ "$TEMPLATE_ID" != "null" ]; do sleep 5 - curl -s -H "Accept: application/json" http://$RANCHER_IP:8080/v2-beta/projectTemplates?name=Kubernetes | tee projectTemplatesKubernetes.json + curl -s -H "Accept: application/json" http://$RANCHER_IP:8080/v2-beta/projectTemplates?name=Kubernetes > projectTemplatesKubernetes.json 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" | tee project.json +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 PID=`jq -r '.id' project.json` echo export RANCHER_URL=http://$RANCHER_IP:8080/v1/projects/$PID >> api-keys-rc source api-keys-rc until [ $(jq -r '.state' project.json) == "active" ]; do sleep 5 - curl -s -H "Accept: application/json" http://$RANCHER_IP:8080/v1/projects/$PID | tee project.json + curl -s -H "Accept: application/json" http://$RANCHER_IP:8080/v1/projects/$PID > project.json done TID=$(curl -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" http://$RANCHER_IP:8080/v1/projects/$PID/registrationTokens | jq -r '.id') touch token.json while [ $(jq -r .command token.json | wc -c) -lt 10 ]; do sleep 5 - curl -s -X GET -H "Accept: application/json" http://$RANCHER_IP:8080/v1/projects/$PID/registrationToken/$TID | tee token.json + curl -s -X GET -H "Accept: application/json" http://$RANCHER_IP:8080/v1/projects/$PID/registrationToken/$TID > token.json done -CMD=$(jq -r .command token.json) -eval $CMD +RANCHER_AGENT_CMD=$(jq -r .command token.json) +eval $RANCHER_AGENT_CMD # download rancher CLI wget -q https://github.com/rancher/cli/releases/download/v0.6.7/rancher-linux-amd64-v0.6.7.tar.xz @@ -126,36 +126,166 @@ sed -i "s/kubeMasterAuthToken:.*/kubeMasterAuthToken: $KUBETOKEN/" ~/oom/kuberne # Put your onap_key ssh private key in ~/.ssh/onap_key # Create or edit ~/oom/kubernetes/config/onap-parameters.yaml -cp ~/oom/kubernetes/config/onap-parameters-sample.yaml ~/oom/kubernetes/config/onap-parameters.yaml -cat >> ~/oom/kubernetes/config/onap-parameters.yaml < ~/oom/kubernetes/config/onap-parameters.yaml <