onap on kubernetes source files

Change-Id: I4de34baf90979651223a28323010deb7aef21946
Signed-off-by: Mandeep Khinda <Mandeep.Khinda@amdocs.com>
diff --git a/kubernetes/portal/all-services.yaml b/kubernetes/portal/all-services.yaml
new file mode 100644
index 0000000..cb7c9e2
--- /dev/null
+++ b/kubernetes/portal/all-services.yaml
@@ -0,0 +1,57 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: portaldb
+  labels:
+    app: portaldb
+spec:
+  ports:
+  - name: portaldb
+    port: 3306
+  selector:
+    app: portaldb
+  clusterIP: None
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: portalapps
+  name: portalapps
+spec:
+  ports:
+  - name: portal-1
+    nodePort: 30213
+    port: 8006
+    targetPort: 8005
+  - name: portal-2
+    nodePort: 30214
+    port: 8010
+    targetPort: 8009
+  - name: portal-3
+    nodePort: 30215
+    port: 8989
+    targetPort: 8080
+  selector:
+    app: portalapps
+  type: NodePort
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: vnc-portal
+  name: vnc-portal
+spec:
+  ports:
+  - name: tcp-1
+    port: 6080
+    targetPort: 80
+    nodePort: 30211
+  - name: tcp-2
+    port: 5900
+    targetPort: 5900
+    nodePort: 30212
+  selector:
+    app: vnc-portal
+  type: NodePort
diff --git a/kubernetes/portal/docker/init/mariadb-client/Dockerfile b/kubernetes/portal/docker/init/mariadb-client/Dockerfile
new file mode 100644
index 0000000..416633a
--- /dev/null
+++ b/kubernetes/portal/docker/init/mariadb-client/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:16.04
+
+ENV no_proxy "localhost,127.0.0.1,.cluster.local,$KUBERNETES_SERVICE_HOST"
+# Setup Corporate proxy
+ENV https_proxy http://genproxy.amdocs.com:8080/
+ENV http_proxy http://genproxy.amdocs.com:8080/
+
+RUN apt-get update
+RUN apt-get install -y mariadb-client-10.0
+
+VOLUME /portal-mysql
diff --git a/kubernetes/portal/docker/init/ubuntu/Dockerfile b/kubernetes/portal/docker/init/ubuntu/Dockerfile
new file mode 100644
index 0000000..f4a8d55
--- /dev/null
+++ b/kubernetes/portal/docker/init/ubuntu/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:16.04
+
+ENV no_proxy "localhost,127.0.0.1,.cluster.local,$KUBERNETES_SERVICE_HOST"
+# Setup Corporate proxy
+ENV https_proxy http://genproxy.amdocs.com:8080/
+ENV http_proxy http://genproxy.amdocs.com:8080/
+
+RUN apt-get update
+RUN apt-get install -y host dnsutils
+
+VOLUME /ubuntu-init
diff --git a/kubernetes/portal/portal-apps-deployment.yaml b/kubernetes/portal/portal-apps-deployment.yaml
new file mode 100755
index 0000000..0d39e23
--- /dev/null
+++ b/kubernetes/portal/portal-apps-deployment.yaml
@@ -0,0 +1,132 @@
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  name: portalapps
+spec:
+  selector:
+    matchLabels:
+      app: portalapps
+  template:
+    metadata:
+       labels:
+         app: portalapps
+       name: portalapps
+       annotations:
+         pod.beta.kubernetes.io/init-containers: '[
+           {
+               "args": [
+                   "--container-name",
+                   "portaldb"
+               ],
+               "command": [
+                   "/root/ready.py"
+               ],
+               "env": [
+                   {
+                       "name": "NAMESPACE",
+                       "valueFrom": {
+                           "fieldRef": {
+                               "apiVersion": "v1",
+                               "fieldPath": "metadata.namespace"
+                           }
+                       }
+                   }
+               ],
+               "image": "oomk8s/readiness-check:1.0.0",
+               "imagePullPolicy": "Always",
+               "name": "portalapps-readiness"
+           },
+           {
+               "command": ["/bin/bash", "-c", "if [ ! -e /portal_root/boot.txt ]; then mysql -u root -ppassword -h portaldb < /portal-mysql/Apps_Users_OnBoarding_Script.sql; fi"],
+               "volumeMounts": [
+                 {
+                   "mountPath": "/portal-mysql/Apps_Users_OnBoarding_Script.sql",
+                   "name": "portal-mariadb-onboarding-sql"
+                 },
+                 {
+                   "mountPath": "/portal_root/",
+                   "name": "portal-root"
+                 }
+               ],
+               "image": "oomk8s/mariadb-client-init:1.0.0",
+               "imagePullPolicy": "Always",
+               "name": "provision-portaldb-users"
+           }
+           ]'
+    spec:
+      containers:
+      - image: nexus3.onap.org:10001/openecomp/portalapps:1.0-STAGING-latest
+        lifecycle:
+          postStart:
+            exec:
+              command: ["/bin/sh", "-c", "echo yes > /portal_root/boot.txt"]
+        name: portalapps
+        volumeMounts:
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPPORTALAPP/WEB-INF/fusion/conf/fusion.properties
+          name: portal-fusion-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPPORTALAPP/WEB-INF/classes/openid-connect.properties
+          name: portal-openid-connect-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPPORTALAPP/WEB-INF/conf/system.properties
+          name: portal-system-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPPORTALAPP/WEB-INF/classes/portal.properties
+          name: portal-portal-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPDBCAPP/WEB-INF/fusion/fusion.properties
+          name: dbcapp-fusion-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPDBCAPP/WEB-INF/conf/system.properties
+          name: dbcapp-system-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPDBCAPP/WEB-INF/classes/portal.properties
+          name: dbcapp-portal-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPDBCAPP/WEB-INF/dbcapp/dbcapp.properties
+          name: dbcapp-dbcapp-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPSDKAPP/WEB-INF/conf/system.properties
+          name: sdkapp-system-properties
+        - mountPath: /PROJECT/APPS/ECOMPPORTAL/ECOMPSDKAPP/WEB-INF/classes/portal.properties
+          name: sdkapp-portal-properties
+        - mountPath: /portal_root/
+          name: portal-root
+        ports:
+        - containerPort: 8005
+        - containerPort: 8009
+        - containerPort: 8080
+        readinessProbe:
+          tcpSocket:
+            port: 8080
+          initialDelaySeconds: 5
+          periodSeconds: 10
+      volumes:
+        - name: portal-fusion-properties
+          hostPath:
+            path:  /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/fusion.properties
+        - name: portal-openid-connect-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/openid-connect.properties
+        - name: portal-system-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/system.properties
+        - name: portal-portal-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/portal.properties
+        - name: dbcapp-fusion-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPDBCAPP/fusion.properties
+        - name: dbcapp-system-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPDBCAPP/system.properties
+        - name: dbcapp-portal-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPDBCAPP/portal.properties
+        - name: dbcapp-dbcapp-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPDBCAPP/dbcapp.properties
+        - name: sdkapp-system-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPSDKAPP/system.properties
+        - name: sdkapp-portal-properties
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/portal-fe/webapps/etc/ECOMPSDKAPP/portal.properties
+        - name: portal-mariadb-onboarding-sql
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal/mariadb/Apps_Users_OnBoarding_Script.sql
+        - name: portal-root
+          hostPath:
+            path: /dockerdata-nfs/onapdemo/portal
diff --git a/kubernetes/portal/portal-mariadb-deployment.yaml b/kubernetes/portal/portal-mariadb-deployment.yaml
new file mode 100755
index 0000000..f25e65b
--- /dev/null
+++ b/kubernetes/portal/portal-mariadb-deployment.yaml
@@ -0,0 +1,37 @@
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  name: portaldb
+spec:
+  selector:
+    matchLabels:
+      app: portaldb
+  template:
+    metadata:
+      labels:
+        app: portaldb
+      name: portaldb
+    spec:
+      containers:
+      - image: nexus3.onap.org:10001/openecomp/portaldb:1.0-STAGING-latest
+        name: "portaldb"
+        env:
+        - name: MYSQL_HOST
+          value: portaldb.onap-portal
+        - name: MYSQL_ROOT_PASSWORD
+          value: password
+        volumeMounts:
+        - mountPath: /var/lib/mysql
+          name: portal-mariadb-data
+        ports:
+        - containerPort: 3306
+          name: portaldb
+        readinessProbe:
+          tcpSocket:
+            port: 3306
+          initialDelaySeconds: 5
+          periodSeconds: 10
+      volumes:
+      - name: portal-mariadb-data
+        hostPath:
+          path: /dockerdata-nfs/onapdemo/portal/mariadb/data
diff --git a/kubernetes/portal/portal-vnc-dep.yaml b/kubernetes/portal/portal-vnc-dep.yaml
new file mode 100644
index 0000000..3ad51cc
--- /dev/null
+++ b/kubernetes/portal/portal-vnc-dep.yaml
@@ -0,0 +1,129 @@
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  labels:
+    app: vnc-portal
+  name: vnc-portal
+spec:
+  selector:
+    matchLabels:
+      app: vnc-portal
+  template:
+    metadata:
+      labels:
+        app: vnc-portal
+      name: vnc-portal
+      annotations:
+        pod.beta.kubernetes.io/init-containers: '[
+          {
+              "args": [
+                  "--container-name",
+                  "portalapps"
+              ],
+              "command": [
+                  "/root/ready.py"
+              ],
+              "env": [
+                  {
+                      "name": "NAMESPACE",
+                      "valueFrom": {
+                          "fieldRef": {
+                              "apiVersion": "v1",
+                              "fieldPath": "metadata.namespace"
+                          }
+                      }
+                  }
+              ],
+              "image": "oomk8s/readiness-check:1.0.0",
+              "imagePullPolicy": "Always",
+              "name": "vnc-portal-readiness"
+          },
+          {
+              "args": [
+                  "--container-name",
+                  "pap"
+              ],
+              "command": [
+                  "/root/ready.py"
+              ],
+              "env": [
+                  {
+                      "name": "NAMESPACE",
+                      "value": "onap-policy"
+                  }
+              ],
+              "image": "oomk8s/readiness-check:1.0.0",
+              "imagePullPolicy": "Always",
+              "name": "vnc-pap-readiness"
+          },
+          {
+              "args": [
+                  "--container-name",
+                  "sdc-fe"
+              ],
+              "command": [
+                  "/root/ready.py"
+              ],
+              "env": [
+                  {
+                      "name": "NAMESPACE",
+                      "value": "onap-sdc"
+                  }
+              ],
+              "image": "oomk8s/readiness-check:1.0.0",
+              "imagePullPolicy": "Always",
+              "name": "vnc-sdc-readiness"
+          },
+          {
+              "args": [
+                  "--container-name",
+                  "vid-server"
+              ],
+              "command": [
+                  "/root/ready.py"
+              ],
+              "env": [
+                  {
+                      "name": "NAMESPACE",
+                      "value": "onap-vid"
+                  }
+              ],
+              "image": "oomk8s/readiness-check:1.0.0",
+              "imagePullPolicy": "Always",
+              "name": "vnc-vid-readiness"
+          },
+          {
+              "command": ["/bin/sh","-c"],
+              "args": ["echo `host sdc-be.onap-sdc | awk ''{print$4}''` sdc.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host portalapps.onap-portal | awk ''{print$4}''` portal.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host pap.onap-policy | awk ''{print$4}''` policy.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host sdc-fe.onap-sdc | awk ''{print$4}''` sdc.ui.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host vid-server.onap-vid | awk ''{print$4}''` vid.api.simpledemo.openecomp.org >> /ubuntu-init/hosts"],
+              "image": "oomk8s/ubuntu-init:1.0.0",
+              "imagePullPolicy": "Always",
+              "name": "vnc-init-hosts",
+              "volumeMounts": [
+                {
+                  "name": "ubuntu-init",
+                  "mountPath": "/ubuntu-init/"
+                }
+              ]
+          }
+          ]'
+    spec:
+      containers:
+      - image: dorowu/ubuntu-desktop-lxde-vnc
+        lifecycle:
+          postStart:
+            exec:
+              command: ["/bin/sh", "-c", "cat /ubuntu-init/hosts >> /etc/hosts"]
+        env:
+        - name: VNC_PASSWORD
+          value: password
+        imagePullPolicy: IfNotPresent
+        name: vnc-portal
+        volumeMounts:
+        - mountPath: /ubuntu-init/
+          name: ubuntu-init
+        securityContext:
+          privileged: true
+      securityContext: {}
+      volumes:
+        - name: ubuntu-init
+          emptyDir: {}