Instrumental | 69549ce | 2019-08-05 14:28:17 -0500 | [diff] [blame] | 1 | function prop () { |
| 2 | echo $(grep " $1" values.yaml | grep -v "#"| sed -e "s/.*$1: *//") |
| 3 | } |
| 4 | |
| 5 | REPO=$(prop repository) |
| 6 | if [ -z "$REPO" ]; then |
| 7 | REPO="nexus3.onap.org:10001" |
| 8 | fi |
| 9 | |
| 10 | if [ "\"\"" = "$REPO" ]; then |
| 11 | IMAGE="$(prop agentImage)" |
| 12 | else |
| 13 | IMAGE="$REPO/$(prop agentImage)" |
| 14 | fi |
| 15 | |
| 16 | APP_FQI=$(prop fqi) |
| 17 | FQDN=$(prop fqdn) |
| 18 | LATITUDE=$(prop cadi_latitude) |
| 19 | LONGITUDE=$(prop cadi_longitude) |
| 20 | DEPLOY_FQI=$(prop deploy_fqi) |
| 21 | echo "Enter Password for Deployer: $DEPLOY_FQI" |
| 22 | #read DEPLOY_PASSWORD |
| 23 | #if [ -z "$DEPLOY_PASSWORD" ]; then |
| 24 | # ONAP TEST Password. DO NOT PUT REAL PASSWORDS HERE!!! |
| 25 | DEPLOY_PASSWORD='"demo123456!"' |
| 26 | #fi |
| 27 | DEPLOYMENT=$(kubectl -n onap get deployments | grep ${FQDN//\"} | cut -f1 -d' ') |
| 28 | if [ -z "$DEPLOYMENT" ]; then |
| 29 | DEPLOYMENT=$FQDN |
| 30 | fi |
| 31 | echo Running from $IMAGE for Deployment $DEPLOYMENT |
| 32 | |
| 33 | kubectl -n onap run -it --rm aaf-agent-$USER --image=$IMAGE --overrides=' |
| 34 | { |
| 35 | "spec": { |
| 36 | "containers": [ |
| 37 | { |
| 38 | "name": "aaf-agent-'$USER'", |
| 39 | "image": "'$IMAGE'", |
| 40 | "imagePullPolicy": "IfNotPresent", |
| 41 | "command": [ |
| 42 | "bash", |
| 43 | "-c", |
| 44 | "/opt/app/aaf_config/bin/agent.sh && cd /opt/app/osaaf/local && exec bash" |
| 45 | ], |
| 46 | "env": [ |
| 47 | { |
| 48 | "name": "APP_FQI", |
| 49 | "value": '$APP_FQI' |
| 50 | },{ |
| 51 | "name": "APP_FQDN", |
| 52 | "value": '$FQDN' |
| 53 | },{ |
| 54 | "name": "DEPLOY_FQI", |
| 55 | "value": '$DEPLOY_FQI' |
| 56 | },{ |
| 57 | "name": "DEPLOY_PASSWORD", |
| 58 | "value": '$DEPLOY_PASSWORD' |
| 59 | },{ |
| 60 | "name": "aaf_locate_url", |
| 61 | "value": "https://aaf-locate.onap:8095" |
| 62 | },{ |
| 63 | "name": "aaf_locator_container", |
| 64 | "value": "helm" |
| 65 | },{ |
| 66 | "name": "aaf_locator_container_ns", |
| 67 | "value": "onap" |
| 68 | },{ |
| 69 | "name": "aaf_locator_public_fqdn", |
| 70 | "value": "aaf.osaaf.org" |
| 71 | },{ |
| 72 | "name": "aaf_locator_fqdn", |
| 73 | "value": '$FQDN' |
| 74 | },{ |
| 75 | "name": "cadi_latitude", |
| 76 | "value": '$LATITUDE' |
| 77 | },{ |
| 78 | "name": "cadi_longitude", |
| 79 | "value": '$LONGITUDE' |
| 80 | } |
| 81 | ], |
| 82 | "stdin": true, |
| 83 | "stdinOnce": true, |
| 84 | "tty": true, |
| 85 | "volumeMounts": [ |
| 86 | { |
| 87 | "mountPath": "/opt/app/osaaf", |
| 88 | "name": "'${FQDN//\"}'-vol" |
| 89 | } |
| 90 | ] |
| 91 | } |
| 92 | ], |
| 93 | "volumes": [ |
| 94 | { |
| 95 | "name": "'${FQDN//\"}'-vol", |
| 96 | "persistentVolumeClaim": { |
| 97 | "claimName": "'${DEPLOYMENT//\"}'-pvc" |
| 98 | } |
| 99 | } |
| 100 | ] |
| 101 | } |
| 102 | } |
| 103 | ' --restart=Never -- bash |