agent.sh for k8 24/92724/1
authorInstrumental <jonathan.gathman@att.com>
Mon, 5 Aug 2019 19:28:17 +0000 (14:28 -0500)
committerInstrumental <jonathan.gathman@att.com>
Mon, 5 Aug 2019 19:29:44 +0000 (14:29 -0500)
Issue-ID: AAF-917
Change-Id: Ie939808798471b2bfde56515269985d0d44d83be
Signed-off-by: Instrumental <jonathan.gathman@att.com>
auth/helm/aaf-hello/agent.sh [new file with mode: 0644]
auth/helm/aaf-hello/templates/aaf-hello.yaml
auth/helm/aaf-hello/values.yaml
auth/sample/bin/client.sh
pom.xml
releases/2.1.15.yaml

diff --git a/auth/helm/aaf-hello/agent.sh b/auth/helm/aaf-hello/agent.sh
new file mode 100644 (file)
index 0000000..a622686
--- /dev/null
@@ -0,0 +1,103 @@
+function prop () {
+   echo $(grep " $1" values.yaml | grep -v "#"| sed -e "s/.*$1: *//")
+}
+
+REPO=$(prop repository)
+if [ -z "$REPO" ]; then
+  REPO="nexus3.onap.org:10001"
+fi
+
+if [ "\"\"" = "$REPO" ]; then
+    IMAGE="$(prop agentImage)"
+else 
+    IMAGE="$REPO/$(prop agentImage)"
+fi
+
+APP_FQI=$(prop fqi)
+FQDN=$(prop fqdn)
+LATITUDE=$(prop cadi_latitude)
+LONGITUDE=$(prop cadi_longitude)
+DEPLOY_FQI=$(prop deploy_fqi)
+echo "Enter Password for Deployer: $DEPLOY_FQI"
+#read DEPLOY_PASSWORD
+#if [ -z "$DEPLOY_PASSWORD" ]; then
+  # ONAP TEST Password.  DO NOT PUT REAL PASSWORDS HERE!!!
+  DEPLOY_PASSWORD='"demo123456!"'
+#fi
+DEPLOYMENT=$(kubectl -n onap get deployments | grep ${FQDN//\"} | cut -f1 -d' ')
+if [ -z "$DEPLOYMENT" ]; then
+  DEPLOYMENT=$FQDN
+fi
+echo Running from $IMAGE for Deployment $DEPLOYMENT
+
+kubectl -n onap run -it --rm aaf-agent-$USER --image=$IMAGE --overrides='
+{
+    "spec": {
+        "containers": [
+            {
+               "name": "aaf-agent-'$USER'",
+                "image": "'$IMAGE'",
+                "imagePullPolicy": "IfNotPresent",
+                "command": [
+                   "bash",
+                   "-c",
+                   "/opt/app/aaf_config/bin/agent.sh && cd /opt/app/osaaf/local && exec bash"
+                 ],
+                "env": [
+                   {
+                     "name": "APP_FQI",
+                     "value": '$APP_FQI'
+                   },{
+                     "name": "APP_FQDN",
+                     "value": '$FQDN'
+                   },{
+                     "name": "DEPLOY_FQI",
+                     "value": '$DEPLOY_FQI'
+                   },{
+                     "name": "DEPLOY_PASSWORD",
+                     "value": '$DEPLOY_PASSWORD'
+                   },{
+                     "name": "aaf_locate_url",
+                     "value": "https://aaf-locate.onap:8095"
+                   },{
+                     "name": "aaf_locator_container",
+                     "value": "helm"
+                   },{
+                     "name": "aaf_locator_container_ns",
+                     "value": "onap"
+                   },{
+                     "name": "aaf_locator_public_fqdn",
+                     "value": "aaf.osaaf.org"
+                   },{
+                     "name": "aaf_locator_fqdn",
+                     "value": '$FQDN'
+                   },{
+                     "name": "cadi_latitude",
+                     "value": '$LATITUDE'
+                   },{
+                     "name": "cadi_longitude",
+                     "value": '$LONGITUDE'
+                   }
+                ],
+                "stdin": true,
+                "stdinOnce": true,
+                "tty": true,
+                "volumeMounts": [
+                    {
+                        "mountPath": "/opt/app/osaaf",
+                        "name": "'${FQDN//\"}'-vol"
+                    }
+                ]
+            }
+        ],
+        "volumes": [
+            {
+                "name": "'${FQDN//\"}'-vol",
+                "persistentVolumeClaim": {
+                    "claimName": "'${DEPLOYMENT//\"}'-pvc"
+                }
+            }
+         ]
+   }
+}
+' --restart=Never  -- bash
index 7bf35cd..3ff9a57 100644 (file)
@@ -57,7 +57,7 @@ spec:
             claimName: aaf-hello-pvc
       initContainers:
         - name: aaf-hello-config
-          image: "{{ .Values.image.repository }}{{ .Values.service.initImage }}"
+          image: "{{ .Values.image.repository }}{{ .Values.service.agentImage }}"
           imagePullPolicy: IfNotPresent
           volumeMounts:
             - mountPath: "/opt/app/osaaf"
index da37ff6..d72e245 100644 (file)
@@ -37,7 +37,7 @@ image:
   # repository: localhost:5000/
 
 service:
-  initImage: onap/aaf/aaf_agent:2.1.15-SNAPSHOT
+  agentImage: onap/aaf/aaf_agent:2.1.15-SNAPSHOT
   image: onap/aaf/aaf_hello:2.1.15-SNAPSHOT
   app_ns: "org.osaaf.aaf"
   fqi: "aaf@aaf.osaaf.org"
@@ -47,6 +47,7 @@ service:
   public_port: "30086"
   cadi_latitude: "38.0"
   cadi_longitude: "-72.0"
+  deploy_fqi: "deployer@people.osaaf.org"
 
 persistence: 
   # Where on local disk to store
index 0c0d97c..4768d81 100755 (executable)
@@ -70,10 +70,11 @@ fi
 if [ ! -e "$DOT_AAF/keyfile" ]; then
     $JAVA_AGENT cadi keygen $DOT_AAF/keyfile
     chmod 400 $DOT_AAF/keyfile
+    echo "cadi_keyfile=$DOT_AAF/keyfile" > ${SSO}
 
     # Add Deployer Creds to Root's SSO
     DEPLOY_FQI="${DEPLOY_FQI:=$app_id}"
-    echo "aaf_id=${DEPLOY_FQI}" > ${SSO}
+    echo "aaf_id=${DEPLOY_FQI}" >> ${SSO}
     if [ ! "${DEPLOY_PASSWORD}" = "" ]; then
        echo aaf_password=enc:$(sso_encrypt ${DEPLOY_PASSWORD}) >> ${SSO}
     fi
@@ -197,9 +198,13 @@ else
             fi
         fi
         ;;
+    read)
+        echo "## Read Artifacts"
+        $JAVA_AGENT read $APP_FQI $APP_FQDN cadi_prop_files=${SSO} cadi_loglevel=INFO
+        ;;
     showpass)
         echo "## Show Passwords"
-        $JAVA_AGENT showpass $APP_FQI $APP_FQDN cadi_prop_files=${SSO}
+        $JAVA_AGENT showpass $APP_FQI $APP_FQDN cadi_prop_files=${SSO} cadi_loglevel=ERROR
         ;;
     check)
         echo "## Check Certificate"
diff --git a/pom.xml b/pom.xml
index 9937297..f3e6241 100644 (file)
--- a/pom.xml
+++ b/pom.xml
             </build>
 
             <modules>
+                <module>auth-client</module>
+                <module>misc</module>
+                <module>cadi</module>
+                <module>auth</module>
                 <module>auth/docker</module>
             </modules>
         </profile>
index 3283461..c4dbc21 100644 (file)
@@ -1,4 +1,4 @@
 distribution_type: 'maven'
 version: '2.1.15'
 project: 'aaf-authz'
-log_dir: 'aaf-authz-maven-stage-master/59/'
+log_dir: 'aaf-authz-maven-stage-master/63/'