AAF Charts

-PS3-MK
 -renaming charts to remove hyphen
 -refactoring service name configuration.  It wasn't quite correct
  the way it was.  It was taking the chart name as the service name
  and not using the values.yaml from the top level chart as intended.
 -Jonathan asked to name the main app service "aaf-service and cassandra
  to "aaf-cass" as this is what is in the cert
 -squashed https://gerrit.onap.org/r/#/c/45923/1 into this commit.
 -updated robot to the latest settings
 Robot tests are failing but all pods come up.  I think this can be merged
 and the AAF team investigate the robot health issue in a running system

-PS4-MK
 -reverting sms changes and taking the latest from master
 -removing repository from the global section of the aaf values.
  -this was causing all images to be pulled from nexus3.onap.org
   which was failing to pull images that come from docker hub.
   There is supposed to be a proxy through nexus3 to dockerhub but maybe
   we are missing something.

-PS5-MK
 -removing nodeports from non gui related charts.  There are conflicts

-PS6-Kiran
 -Adding imagepullsecrets for aaf-sms-vault subchart
 -updated image repository to pull from nexus3
 -tested and works now and should fix the pull errors

-PS7-Kiran
 -Previous patch picked up a couple of unintended changes
 -Reverting them

-PS8-MK
  -removing names from identities
  -using https for robot test

Issue-ID: OOM-930

Change-Id: I98f40ef5af03dda73aebf12f6fa48d928915ab34
Signed-off-by: Mahendra Raghuwanshi <mahendra.raghuwanshi@amdocs.com>

Add Beijing CQLs into OOM

Issue-ID: AAF-114
Change-Id: I2c2d46738ba0885c41f710997d4b212b6ce4d2de
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Signed-off-by: Mandeep Khinda <mandeep.khinda@amdocs.com>
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
diff --git a/kubernetes/aaf/templates/configmap.yaml b/kubernetes/aaf/templates/configmap.yaml
index c7cf9ae..cfa57f7 100644
--- a/kubernetes/aaf/templates/configmap.yaml
+++ b/kubernetes/aaf/templates/configmap.yaml
@@ -15,7 +15,42 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ include "common.fullname" . }}
+  name: {{ .Release.Name }}-aaf-backup
   namespace: {{ include "common.namespace" . }}
 data:
-{{ (.Files.Glob "resources/config/aaf-data/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/backup/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-aaf-public
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/public/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-aaf-local
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/local/org.osaaf.location.props").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/local/org.osaaf.cm.ca.props").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/local/org.osaaf.cassandra.props").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/local/org.osaaf.aaf.props").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-aaf-etc
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/etc/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-aaf-data
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/data/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/aaf/templates/deployment.yaml b/kubernetes/aaf/templates/deployment.yaml
deleted file mode 100644
index 2a4e7d2..0000000
--- a/kubernetes/aaf/templates/deployment.yaml
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-spec:
-  replicas: {{ .Values.replicaCount }}
-  selector:
-    matchLabels:
-      app: {{ include "common.name" . }}
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-      name: {{ include "common.fullname" . }}
-    spec:
-      initContainers:
-      - command:
-        - /root/ready.py
-        args:
-        - --container-name
-        - aaf-cs
-        env:
-        - name: NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        name: {{ include "common.name" . }}-readiness
-      containers:
-      - env:
-        - name: CASSANDRA_CLUSTER
-          value: cassandra_container
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts:
-        - mountPath: /data
-          name: aaf-data
-        name: {{ include "common.name" . }}
-        # disable liveness probe when breakpoints set in debugger
-        # so K8s doesn't restart unresponsive container
-        {{- if eq .Values.liveness.enabled true }}
-        livenessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
-          initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.liveness.periodSeconds }}
-        {{ end -}}
-        readinessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
-          initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.readiness.periodSeconds }}
-        resources:
-{{ toYaml .Values.resources | indent 12 }}
-      {{- if .Values.nodeSelector }}
-      nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-      {{- end -}}
-      {{- if .Values.affinity }}
-      affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-      {{- end }}
-
-      volumes:
-        - name: aaf-data
-          configMap:
-            name: {{ include "common.fullname" . }}
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/aaf/templates/job.yaml b/kubernetes/aaf/templates/job.yaml
new file mode 100644
index 0000000..7ce871e
--- /dev/null
+++ b/kubernetes/aaf/templates/job.yaml
@@ -0,0 +1,132 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ include "common.fullname" . }}-create-config
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  template:
+    metadata:
+      labels:
+        app: aaf-init-job
+        release: {{ .Release.Name }}
+    spec:
+      containers:
+      - command: ["/bin/bash","-c","if [ ! -d /data/backup ]; then mkdir /data/data && cp -Ra /data1/data/..data/* /data/data/ && mkdir /data/etc && cp -Ra /data1/etc/..data/* data/etc/ && mkdir /data/backup && cp -Ra /data1/backup/..data/* /data/backup/ && cp -Ra /data1/public /data/ && cp -Ra /data1/local /data && mkdir -p /data/logs/oauth && mkdir -p /data/logs/hello && mkdir -p /data/logs/fs && mkdir -p /data/logs/gui && mkdir -p /data/logs/locate && mkdir -p /data/logs/cm && mkdir -p /data/logs/service; fi; exit 0"]
+        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: aaf-init-job
+        volumeMounts:
+        - mountPath: /etc/localtime
+          name: localtime
+          readOnly: true
+        - mountPath: /data
+          name: aaf-persistent-data
+        - mountPath: /data1/etc
+          name: aaf-etc 
+        - mountPath: /data1/data
+          name: aaf-data
+        - mountPath: /data1/public/iframe_denied_test.html
+          name: aaf-public
+          subPath: iframe_denied_test.html
+        - mountPath: /data1/public/aaf_2_0.xsd
+          name: aaf-public
+          subPath: aaf_2_0.xsd
+        - mountPath: /data1/public/truststoreONAP.p12
+          name: aaf-public-secret
+          subPath: truststoreONAP.p12
+        - mountPath: /data1/public/AAF_RootCA.cer
+          name: aaf-public-secret
+          subPath: AAF_RootCA.cer
+        - mountPath: /data1/public/truststoreONAPall.jks
+          name: aaf-public-secret
+          subPath: truststoreONAPall.jks
+        - mountPath: /data1/local/org.osaaf.location.props
+          name: aaf-local
+          subPath: org.osaaf.location.props
+        - mountPath: /data1/local/org.osaaf.cm.ca.props
+          name: aaf-local
+          subPath: org.osaaf.cm.ca.props
+        - mountPath: /data1/local/org.osaaf.cassandra.props
+          name: aaf-local
+          subPath: org.osaaf.cassandra.props
+        - mountPath: /data1/local/org.osaaf.aaf.props
+          name: aaf-local
+          subPath: org.osaaf.aaf.props
+        - mountPath: /data1/local/org.osaaf.aaf.trust.p12
+          name: aaf-local-secret
+          subPath: org.osaaf.aaf.trust.p12
+        - mountPath: /data1/local/org.osaaf.aaf.p12
+          name: aaf-local-secret
+          subPath: org.osaaf.aaf.p12
+        - mountPath: /data1/local/org.osaaf.aaf.keyfile
+          name: aaf-local-secret
+          subPath: org.osaaf.aaf.keyfile
+        - mountPath: /data1/local/org.osaaf.aaf.cm.p12
+          name: aaf-local-secret
+          subPath: org.osaaf.aaf.cm.p12
+        - mountPath: /data1/backup
+          name: aaf-backup
+        resources: 
+{{ toYaml .Values.resources | indent 12 }}
+      {{- if .Values.nodeSelector }}
+      nodeSelector:
+{{ toYaml .Values.nodeSelector | indent 10 }}
+      {{- end -}}
+      {{- if .Values.affinity }}
+      affinity:
+{{ toYaml .Values.affinity | indent 10 }}
+      {{- end }}
+      volumes:
+      - name: localtime
+        hostPath:
+          path: /etc/localtime
+      - name: aaf-local-secret
+        secret:
+          secretName: {{ .Release.Name }}-aaf-local-secret
+      - name: aaf-public-secret
+        secret:
+          secretName: {{ .Release.Name }}-aaf-public-secret
+      - name: aaf-etc
+        configMap:
+          name: {{ .Release.Name }}-aaf-etc
+      - name: aaf-local
+        configMap:
+          name: {{ .Release.Name }}-aaf-local
+      - name: aaf-backup
+        configMap:
+          name: {{ .Release.Name }}-aaf-backup
+      - name: aaf-public
+        configMap:
+          name: {{ .Release.Name }}-aaf-public
+      - name: aaf-data
+        configMap:
+          name: {{ .Release.Name }}-aaf-data
+      - name: aaf-persistent-data
+      {{- if .Values.global.persistence.enabled }}
+        persistentVolumeClaim:
+          claimName: {{ .Release.Name }}-aaf-pvc
+      {{- else }}
+        emptyDir: {}
+      {{- end }}
+      restartPolicy: OnFailure
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/aaf/templates/pv.yaml b/kubernetes/aaf/templates/pv.yaml
new file mode 100644
index 0000000..d9b58f6
--- /dev/null
+++ b/kubernetes/aaf/templates/pv.yaml
@@ -0,0 +1,37 @@
+{{/*
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- if and .Values.global.persistence.enabled (not .Values.persistence.existingClaim) -}}
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: {{ include "common.fullname" . }}
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+    name: {{ include "common.fullname" . }}
+spec:
+  capacity:
+    storage: {{ .Values.persistence.size}}
+  accessModes:
+    - {{ .Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+  hostPath:
+    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
+{{- end -}}
diff --git a/kubernetes/aaf/templates/pvc.yaml b/kubernetes/aaf/templates/pvc.yaml
new file mode 100644
index 0000000..255c277
--- /dev/null
+++ b/kubernetes/aaf/templates/pvc.yaml
@@ -0,0 +1,48 @@
+{{/*
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- if and .Values.global.persistence.enabled (not .Values.persistence.existingClaim) -}}
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: {{ .Release.Name }}-aaf-pvc
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+{{- if .Values.persistence.annotations }}
+  annotations:
+{{ toYaml .Values.persistence.annotations | indent 4 }}
+{{- end }}
+spec:
+  selector:
+    matchLabels:
+      name: {{ include "common.fullname" . }}
+  accessModes:
+    - {{ .Values.persistence.accessMode }}
+  resources:
+    requests:
+      storage: {{ .Values.persistence.size }}
+{{- if .Values.persistence.storageClass }}
+{{- if (eq "-" .Values.persistence.storageClass) }}
+  storageClassName: ""
+{{- else }}
+  storageClassName: "{{ .Values.persistence.storageClass }}"
+{{- end }}
+{{- end }}
+{{- end -}}
diff --git a/kubernetes/aaf/templates/secrets.yaml b/kubernetes/aaf/templates/secrets.yaml
new file mode 100644
index 0000000..d67601c
--- /dev/null
+++ b/kubernetes/aaf/templates/secrets.yaml
@@ -0,0 +1,47 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ .Release.Name}}-aaf-local-secret
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+data:
+{{ (.Files.Glob "resources/config/local/org.osaaf.aaf.trust.p12").AsSecrets | indent 2 }}
+{{ (.Files.Glob "resources/config/local/org.osaaf.aaf.p12").AsSecrets | indent 2 }}
+{{ (.Files.Glob "resources/config/local/org.osaaf.aaf.keyfile").AsSecrets | indent 2 }}
+{{ (.Files.Glob "resources/config/local/org.osaaf.aaf.cm.p12").AsSecrets | indent 2 }}
+type: Opaque
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ .Release.Name}}-aaf-public-secret
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+data:
+{{ (.Files.Glob "resources/config/public/truststoreONAP.p12").AsSecrets | indent 2 }}
+{{ (.Files.Glob "resources/config/public/AAF_RootCA.cer").AsSecrets | indent 2 }}
+{{ (.Files.Glob "resources/config/public/truststoreONAPall.jks").AsSecrets | indent 2 }}
+type: Opaque
+
diff --git a/kubernetes/aaf/templates/service.yaml b/kubernetes/aaf/templates/service.yaml
deleted file mode 100644
index 587e07a..0000000
--- a/kubernetes/aaf/templates/service.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    {{if eq .Values.service.type "NodePort" -}}
-    - port: {{ .Values.service.externalPort }}
-      #Example internal target port if required
-      #targetPort: {{ .Values.service.internalPort }}
-      nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-      name: {{ .Values.service.name }}
-    {{- else -}}
-    - port: {{ .Values.service.externalPort }}
-      targetPort: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.name }}
-    {{- end}}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
-  type: {{ .Values.service.type }}