blob: a622686a4fc750016b8b7d68e372eca6c2d1be26 [file] [log] [blame]
Instrumental69549ce2019-08-05 14:28:17 -05001function prop () {
2 echo $(grep " $1" values.yaml | grep -v "#"| sed -e "s/.*$1: *//")
3}
4
5REPO=$(prop repository)
6if [ -z "$REPO" ]; then
7 REPO="nexus3.onap.org:10001"
8fi
9
10if [ "\"\"" = "$REPO" ]; then
11 IMAGE="$(prop agentImage)"
12else
13 IMAGE="$REPO/$(prop agentImage)"
14fi
15
16APP_FQI=$(prop fqi)
17FQDN=$(prop fqdn)
18LATITUDE=$(prop cadi_latitude)
19LONGITUDE=$(prop cadi_longitude)
20DEPLOY_FQI=$(prop deploy_fqi)
21echo "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
27DEPLOYMENT=$(kubectl -n onap get deployments | grep ${FQDN//\"} | cut -f1 -d' ')
28if [ -z "$DEPLOYMENT" ]; then
29 DEPLOYMENT=$FQDN
30fi
31echo Running from $IMAGE for Deployment $DEPLOYMENT
32
33kubectl -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