Add standardized helm chart for aai

Issue-ID: OOM-734

Change-Id: I6b1a85017d79b92afcae44cf823ab000a10ce4be
Signed-off-by: kj <keren.joseph@amdocs.com>
diff --git a/kubernetes/aai/charts/aai-modelloader/.helmignore b/kubernetes/aai/charts/aai-modelloader/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/kubernetes/aai/charts/aai-modelloader/Chart.yaml b/kubernetes/aai/charts/aai-modelloader/Chart.yaml
new file mode 100644
index 0000000..33558f2
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/Chart.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+description: ONAP AAI modelloader
+name: aai-modelloader
+version: 2.0.0
diff --git a/kubernetes/aai/charts/aai-modelloader/resources/config/auth/aai-os-cert.p12 b/kubernetes/aai/charts/aai-modelloader/resources/config/auth/aai-os-cert.p12
new file mode 100644
index 0000000..ee57120
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/resources/config/auth/aai-os-cert.p12
Binary files differ
diff --git a/kubernetes/aai/charts/aai-modelloader/resources/config/log/logback.xml b/kubernetes/aai/charts/aai-modelloader/resources/config/log/logback.xml
new file mode 100644
index 0000000..d512d3b
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/resources/config/log/logback.xml
@@ -0,0 +1,161 @@
+<configuration debug="false" scan="true" scanPeriod="3 seconds">
+    <!--<jmxConfigurator /> -->
+    <!-- directory path for all other type logs -->
+    <property name="logDir" value="/var/log/onap" />
+    <property name="componentName" value="aai"></property>
+    <property name="subComponentName" value="aai-ml"></property>
+    <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
+    <!--  default eelf log file names -->
+    <property name="generalLogName" value="error" />
+    <property name="metricsLogName" value="metrics" />
+    <property name="auditLogName" value="audit" />
+    <property name="debugLogName" value="debug" />
+    <property name="queueSize" value="256" />
+    <property name="maxFileSize" value="50MB" />
+    <property name="maxHistory" value="30" />
+    <property name="totalSizeCap" value="10GB" />
+    <property name="pattern" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}\t[%thread]\t%-5level\t%logger\t%replace(%replace(%replace(%mdc){'\t','\\\\t'}){', ','\t'}){'\n', '\\\\n'}\t%replace(%replace(%msg){'\n', '\\\\n'}){'\t','\\\\t'}%n" />
+    <!-- Example evaluator filter applied against console appender -->
+    <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+    <!-- ============================================================================ -->
+    <!-- EELF Appenders -->
+    <!-- ============================================================================ -->
+    <!-- The EELFAppender is used to record events to the general application 
+                log -->
+    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELF">
+        <file>${logDirectory}/${generalLogName}.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${maxFileSize}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <maxHistory>${maxHistory}</maxHistory>
+            <totalSizeCap>${totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+    <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELF">
+        <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>INFO</level>
+        </filter>
+        <queueSize>${queueSize}</queueSize>
+        <appender-ref ref="EELF" />
+    </appender>
+    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFAudit">
+        <file>${logDirectory}/${auditLogName}.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${maxFileSize}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <maxHistory>${maxHistory}</maxHistory>
+            <totalSizeCap>${totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+    <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFAudit">
+        <queueSize>${queueSize}</queueSize>
+        <appender-ref ref="EELFAudit" />
+    </appender>
+    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFMetrics">
+        <file>${logDirectory}/${metricsLogName}.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${maxFileSize}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <maxHistory>${maxHistory}</maxHistory>
+            <totalSizeCap>${totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+    <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFMetrics">
+        <queueSize>${queueSize}</queueSize>
+        <appender-ref ref="EELFMetrics" />
+    </appender>
+    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFDebug">
+        <file>${logDirectory}/${debugLogName}.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${maxFileSize}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <maxHistory>${maxHistory}</maxHistory>
+            <totalSizeCap>${totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+    <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFDebug">
+        <queueSize>${queueSize}</queueSize>
+        <appender-ref ref="EELFDebug" />
+        <includeCallerData>true</includeCallerData>
+    </appender>
+    <!-- ============================================================================ -->
+    <!-- EELF loggers -->
+    <!-- ============================================================================ -->
+    <logger additivity="false" level="info" name="com.att.eelf">
+        <appender-ref ref="asyncEELF" />
+        <appender-ref ref="asyncEELFDebug" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.security">
+        <appender-ref ref="asyncEELFSecurity" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.perf">
+        <appender-ref ref="asyncEELFPerformance" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.server">
+        <appender-ref ref="asyncEELFServer" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.policy">
+        <appender-ref ref="asyncEELFPolicy" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.audit">
+        <appender-ref ref="asyncEELFAudit" />
+    </logger>
+    <logger additivity="false" level="info" name="com.att.eelf.metrics">
+        <appender-ref ref="asyncEELFMetrics" />
+    </logger>
+    <!-- Spring related loggers -->
+    <logger level="WARN" name="org.springframework" />
+    <logger level="WARN" name="org.springframework.beans" />
+    <logger level="WARN" name="org.springframework.web" />
+    <logger level="WARN" name="com.blog.spring.jms" />
+    <logger level="INFO" name="com.att" />
+    <!-- Model Loader loggers -->
+    <logger level="INFO" name="org.openecomp.modelloader" />
+    <!-- Other Loggers that may help troubleshoot -->
+    <logger level="WARN" name="net.sf" />
+    <logger level="WARN" name="org.apache.commons.httpclient" />
+    <logger level="WARN" name="org.apache.commons" />
+    <logger level="WARN" name="org.apache.coyote" />
+    <logger level="WARN" name="org.apache.jasper" />
+    <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging. 
+                May aid in troubleshooting) -->
+    <logger level="WARN" name="org.apache.camel" />
+    <logger level="WARN" name="org.apache.cxf" />
+    <logger level="WARN" name="org.apache.camel.processor.interceptor" />
+    <logger level="WARN" name="org.apache.cxf.jaxrs.interceptor" />
+    <logger level="WARN" name="org.apache.cxf.service" />
+    <logger level="WARN" name="org.restlet" />
+    <logger level="WARN" name="org.apache.camel.component.restlet" />
+    <!-- logback internals logging -->
+    <logger level="WARN" name="ch.qos.logback.classic" />
+    <logger level="WARN" name="ch.qos.logback.core" />
+    <root>
+        <appender-ref ref="asyncEELF" />
+        <!-- <appender-ref ref="asyncEELFDebug" /> -->
+    </root>
+</configuration>
diff --git a/kubernetes/aai/charts/aai-modelloader/resources/config/model-loader.properties b/kubernetes/aai/charts/aai-modelloader/resources/config/model-loader.properties
new file mode 100644
index 0000000..5604c1f
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/resources/config/model-loader.properties
@@ -0,0 +1,23 @@
+# Model Loader Distribution Client Configuration
+ml.distribution.ACTIVE_SERVER_TLS_AUTH=false
+ml.distribution.ASDC_ADDRESS=sdc-be.{{.Release.Namespace}}:8443
+ml.distribution.CONSUMER_GROUP=aai-ml-group
+ml.distribution.CONSUMER_ID=aai-ml
+ml.distribution.ENVIRONMENT_NAME=AUTO
+ml.distribution.KEYSTORE_PASSWORD=
+ml.distribution.KEYSTORE_FILE=asdc-client.jks
+ml.distribution.PASSWORD=OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp
+ml.distribution.POLLING_INTERVAL=30
+ml.distribution.POLLING_TIMEOUT=20
+ml.distribution.USER=aai
+ml.distribution.ARTIFACT_TYPES=MODEL_INVENTORY_PROFILE,MODEL_QUERY_SPEC,VNF_CATALOG
+
+# Model Loader AAI REST Client Configuration
+ml.aai.BASE_URL=https://aai.{{.Release.Namespace}}:8443
+ml.aai.MODEL_URL=/aai/v10/service-design-and-creation/models/model/
+ml.aai.NAMED_QUERY_URL=/aai/v10/service-design-and-creation/named-queries/named-query/
+ml.aai.VNF_IMAGE_URL=/aai/v8/service-design-and-creation/vnf-images
+ml.aai.KEYSTORE_FILE=aai-os-cert.p12
+ml.aai.KEYSTORE_PASSWORD=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o
+ml.aai.AUTH_USER=ModelLoader
+ml.aai.AUTH_PASSWORD=OBF:1qvu1v2h1sov1sar1wfw1j7j1wg21saj1sov1v1x1qxw
diff --git a/kubernetes/aai/charts/aai-modelloader/templates/configmap.yaml b/kubernetes/aai/charts/aai-modelloader/templates/configmap.yaml
new file mode 100644
index 0000000..8b63cfa
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/templates/configmap.yaml
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-prop
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/model-loader.properties").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-log
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/log/logback.xml").AsConfig . | indent 2 }}
diff --git a/kubernetes/aai/charts/aai-modelloader/templates/deployment.yaml b/kubernetes/aai/charts/aai-modelloader/templates/deployment.yaml
new file mode 100644
index 0000000..38ebe76
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/templates/deployment.yaml
@@ -0,0 +1,97 @@
+# 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:
+  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 }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}
+  template:
+    metadata:
+      labels:
+        app: {{ include "common.name" . }}
+        release: {{ .Release.Name }}
+      name: {{ include "common.name" . }}
+    spec:
+      containers:
+      - name: {{ include "common.name" . }}
+        image: {{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        env:
+        - name: CONFIG_HOME
+          value: /opt/app/model-loader/config/
+        volumeMounts:
+        - mountPath: /etc/localtime
+          name: localtime
+          readOnly: true
+        - mountPath: /opt/app/model-loader/config/model-loader.properties
+          subPath: model-loader.properties
+          name: {{ include "common.fullname" . }}-prop-config
+        - mountPath: /opt/app/model-loader/config/auth/
+          name: {{ include "common.fullname" . }}-auth-config
+        - mountPath: /var/log/onap
+          name: {{ include "common.fullname" . }}-logs
+        - mountPath: /opt/app/model-loader/bundleconfig/etc/logback.xml
+          name: {{ include "common.fullname" . }}-log-conf
+          subPath: logback.xml
+        ports:
+        - containerPort: {{ .Values.service.internalPort }}
+        - containerPort: {{ .Values.service.internalPort2 }}
+
+      # side car containers
+      - name: filebeat-onap
+        image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - mountPath: /usr/share/filebeat/filebeat.yml
+          subPath: filebeat.yml
+          name: filebeat-conf
+        - mountPath: /var/log/onap
+          name: {{ include "common.fullname" . }}-logs
+        - mountPath: /usr/share/filebeat/data
+          name: aai-filebeat
+
+      volumes:
+      - name: localtime
+        hostPath:
+          path: /etc/localtime
+      - name: {{ include "common.fullname" . }}-prop-config
+        configMap:
+          name: {{ include "common.fullname" . }}-prop
+      - name: {{ include "common.fullname" . }}-auth-config
+        secret:
+          secretName: {{ include "common.fullname" . }}
+      - name: filebeat-conf
+        configMap:
+          name: aai-filebeat
+      - name: {{ include "common.fullname" . }}-logs
+        emptyDir: {}
+      - name: aai-filebeat
+        emptyDir: {}
+      - name: {{ include "common.fullname" . }}-log-conf
+        configMap:
+         name: {{ include "common.fullname" . }}-log
+      restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/aai/charts/aai-modelloader/templates/secret.yaml b/kubernetes/aai/charts/aai-modelloader/templates/secret.yaml
new file mode 100644
index 0000000..69bd3f8
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/templates/secret.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "common.fullname" . }}
+  namespace: {{ include "common.namespace" . }}
+type: Opaque
+data:
+{{ tpl (.Files.Glob "resources/config/auth/*").AsSecrets . | indent 2 }}
diff --git a/kubernetes/aai/charts/aai-modelloader/templates/service.yaml b/kubernetes/aai/charts/aai-modelloader/templates/service.yaml
new file mode 100644
index 0000000..bd59edb
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/templates/service.yaml
@@ -0,0 +1,29 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "common.name" . }}
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  type: {{ .Values.service.type }}
+  ports:
+  {{if eq .Values.service.type "NodePort" -}}
+  - port: {{ .Values.service.internalPort }}
+    nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
+    name: {{ .Values.service.name }}
+  - port: {{ .Values.service.internalPort2 }}
+    nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
+    name: {{ .Values.service.name }}2
+  {{- else -}}
+  - port: {{ .Values.service.internalPort }}
+    name: {{ .Values.service.name }}
+  - port: {{ .Values.service.internalPort2 }}
+    name: {{ .Values.service.name }}2
+  {{- end}}
+  selector:
+    app: {{ include "common.name" . }}
+    release: {{ .Release.Name }}
diff --git a/kubernetes/aai/charts/aai-modelloader/values.yaml b/kubernetes/aai/charts/aai-modelloader/values.yaml
new file mode 100644
index 0000000..f44d524
--- /dev/null
+++ b/kubernetes/aai/charts/aai-modelloader/values.yaml
@@ -0,0 +1,67 @@
+# Default values for modelloader.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+global: # global defaults
+  nodePortPrefix: 302
+  repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
+
+
+# application image
+repository: nexus3.onap.org:10001
+image: onap/model-loader:v1.1.0
+pullPolicy: Always
+restartPolicy: Always
+
+# application configuration
+config: {}
+
+# default number of instances
+replicaCount: 1
+
+nodeSelector: {}
+
+affinity: {}
+
+# probe configuration parameters
+liveness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+  # necessary to disable liveness probe when setting breakpoints
+  # in debugger so K8s doesn't restart unresponsive container
+  enabled: true
+
+readiness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+
+service:
+  type: NodePort
+  name: aai-modelloader
+  externalPort: 8080
+  internalPort: 8080
+  nodePort: 10
+  externalPort2: 8443
+  internalPort2: 8443
+  nodePort2: 29
+
+ingress:
+  enabled: false
+
+resources: {}
+  # We usually recommend not to specify default resources and to leave this as a conscious
+  # choice for the user. This also increases chances charts run on environments with little
+  # resources, such as Minikube. If you do want to specify resources, uncomment the following
+  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+  #
+  # Example:
+  # Configure resource requests and limits
+  # ref: http://kubernetes.io/docs/user-guide/compute-resources/
+  # Minimum memory for development is 2 CPU cores and 4GB memory
+  # Minimum memory for production is 4 CPU cores and 8GB memory
+#resources:
+#  limits:
+#    cpu: 2
+#    memory: 4Gi
+#  requests:
+#    cpu: 2
+#    memory: 4Gi