Add Network Discovery Charts to OOM

Issue-ID: LOG-397

Change-Id: I9b830fbf399492f317990790cddb44699bec329b
Signed-off-by: Mohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>
diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/Chart.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/Chart.yaml
new file mode 100644
index 0000000..13c1a6b
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/Chart.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2018 Amdocs

+#

+# 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

+description: ONAP POMBA Network Discovery

+name: pomba-networkdiscovery

+version: 2.0.0

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/requirements.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/requirements.yaml
new file mode 100644
index 0000000..9bae031
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/requirements.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2018 Amdocs

+#

+# 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.

+

+dependencies:

+  - name: common

+    version: ~2.0.0

+    repository: '@local'

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/application.properties b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/application.properties
new file mode 100644
index 0000000..9246aca
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/application.properties
@@ -0,0 +1,48 @@
+# Copyright © 2018 Amdocs
+#
+# 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
+
+spring.jersey.type=filter
+spring.mvc.urls=swagger,docs,prometheus,auditevents,info,heapdump,autoconfig,beans,loggers,dump,env,trace,health,configprops,mappings,metrics,webjars
+
+
+server.contextPath=/network-discovery
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+#This property is used to set the Tomcat connector attributes.developers can define multiple attributes separated by comma
+#tomcat.connector.attributes=allowTrace-true
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+#The minimum number of threads always kept alive
+server.tomcat.min-Spare-Threads=25
+#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
+server.tomcat.max-idle-time=60000
+
+#Servlet context parameters
+server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
+
+# Basic Authentication
+basicAuth.username={{ .Values.config.networkDiscoveryUserId }}
+basicAuth.password={{ .Values.config.networkDiscoveryPassword }}
+
+# A&AI Enircher REST Client Configuration
+enricher.url=https://<enricher_host_or_IP>:<port>
+enricher.connectionTimeout=5000
+enricher.readTimeout=60000
+enricher.keyStorePath=config/auth/enricher-client-cert.p12
+enricher.keyStorePassword=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o
+
+enricher.types = vserver, l3-network
+enricher.type.vserver.url    = /enricher/v11/cloud-infrastructure/vservers/vserver/{0}?sot=!aai
+enricher.type.l3-network.url = /enricher/v11/network/l3-networks/l3-network/{0}?sot=!aai
+
diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/auth/enricher-client-cert.p12 b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/auth/enricher-client-cert.p12
new file mode 100644
index 0000000..12e0ae9
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/auth/enricher-client-cert.p12
Binary files differ
diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/log/logback.xml b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/log/logback.xml
new file mode 100644
index 0000000..1f00cbd
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/resources/config/log/logback.xml
@@ -0,0 +1,30 @@
+<configuration>

+    <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>

+    <property name="p_lvl" value="%level"/>

+    <property name="p_log" value="%logger"/>

+    <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>

+    <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>

+    <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>

+    <!-- tabs -->

+    <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>

+    <property name="p_thr" value="%thread"/>

+    <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>

+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

+        <encoder>

+            <pattern>${pattern}</pattern>

+        </encoder>

+    </appender>

+    <appender name="FILE" class="ch.qos.logback.core.FileAppender">

+        <file>output.log</file>

+        <encoder>

+            <pattern>${pattern}</pattern>

+        </encoder>

+    </appender>

+    <logger level="INFO" name="org.onap.logging.ref.slf4j" additivity="false">

+        <appender-ref ref="STDOUT" />

+        <appender-ref ref="FILE" />

+    </logger>

+    <root level="INFO">

+        <appender-ref ref="STDOUT" />

+    </root>

+</configuration>

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/templates/configmap.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/configmap.yaml
new file mode 100644
index 0000000..1e377b9
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/configmap.yaml
@@ -0,0 +1,30 @@
+# Copyright © 2018 Amdocs

+#

+# 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: ConfigMap

+metadata:

+  name: {{ include "common.fullname" . }}-log

+  namespace: {{ include "common.namespace" . }}

+data:

+{{ tpl (.Files.Glob "resources/config/log/logback.xml").AsConfig . | indent 2 }}

+---

+apiVersion: v1

+kind: ConfigMap

+metadata:

+  name: {{ include "common.fullname" . }}-configmap

+  namespace: {{ include "common.namespace" . }}

+data:

+{{ tpl (.Files.Glob "resources/config/application.properties").AsConfig . | indent 2 }}

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/templates/deployment.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/deployment.yaml
new file mode 100644
index 0000000..1bd0309
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/deployment.yaml
@@ -0,0 +1,118 @@
+# Copyright © 2018 Amdocs

+#

+# 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 }}

+  template:

+    metadata:

+      labels:

+        app: {{ include "common.name" . }}

+        release: {{ .Release.Name }}

+    spec:

+      containers:

+        - name: {{ include "common.name" . }}

+          image: "{{ include "common.repository" . }}/{{ .Values.image }}"

+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}

+          ports:

+          - containerPort: {{ .Values.service.internalPort }}

+          # disable liveness probe when breakpoints set in debugger

+          # so K8s doesn't restart unresponsive container

+          {{ if .Values.liveness.enabled }}

+          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 }}

+          env:

+          volumeMounts:

+          - mountPath: /etc/localtime

+            name: localtime

+            readOnly: true

+          - name: {{ include "common.fullname" . }}-logs

+            mountPath: /var/log/onap

+          - mountPath: /opt/app/config/logback.xml

+            name: {{ include "common.fullname" . }}-log-conf

+            subPath: logback.xml

+          - mountPath: /opt/app/config/application.properties

+            name: {{ include "common.fullname" . }}-config

+            subPath: application.properties

+            readOnly: true

+          - mountPath: /opt/app/config/auth/enricher-client-cert.p12

+            name: {{ include "common.fullname" . }}-auth-secret

+            subPath: enricher-client-cert.p12

+            readOnly: true

+

+          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 }}

+

+        # Filebeat sidecar container

+        - name: {{ include "common.name" . }}-filebeat-onap

+          image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"

+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}

+          volumeMounts:

+          - name: {{ include "common.fullname" . }}-filebeat-conf

+            mountPath: /usr/share/filebeat/filebeat.yml

+            subPath: filebeat.yml

+          - name: {{ include "common.fullname" . }}-data-filebeat

+            mountPath: /usr/share/filebeat/data

+          - name: {{ include "common.fullname" . }}-logs

+            mountPath: /var/log/onap

+

+      volumes:

+        - name: localtime

+          hostPath:

+            path: /etc/localtime

+        - name:  {{ include "common.fullname" . }}-logs

+          emptyDir: {}

+        - name: {{ include "common.fullname" . }}-log-conf

+          configMap:

+            name: {{ include "common.fullname" . }}-log

+        - name: {{ include "common.fullname" . }}-config

+          configMap:

+            name: {{ include "common.fullname" . }}-configmap

+        - name: {{ include "common.fullname" . }}-auth-secret

+          secret:

+            secretName: {{ include "common.fullname" . }}-auth

+        - name: {{ include "common.fullname" . }}-filebeat-conf

+          configMap:

+            name: {{ .Release.Name }}-pomba-filebeat-configmap

+        - name: {{ include "common.fullname" . }}-data-filebeat

+          emptyDir: {}

+

+      imagePullSecrets:

+      - name: "{{ include "common.namespace" . }}-docker-registry-key"

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/templates/secrets.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/secrets.yaml
new file mode 100644
index 0000000..3015811
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/secrets.yaml
@@ -0,0 +1,26 @@
+# Copyright © 2018 Amdocs, AT&T

+#

+# 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: {{ include "common.fullname" . }}-auth

+  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/auth/*").AsSecrets | indent 2 }}

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/templates/service.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/service.yaml
new file mode 100644
index 0000000..2b54def
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/templates/service.yaml
@@ -0,0 +1,41 @@
+# Copyright © 2018 Amdocs

+#

+# 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:

+  type: {{ .Values.service.type }}

+  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.portName | default "http" }}

+    {{- else -}}

+    - port: {{ .Values.service.externalPort }}

+      targetPort: {{ .Values.service.internalPort }}

+      name: {{ .Values.service.portName | default "http" }}

+    {{- end}}

+  selector:

+    app: {{ include "common.name" . }}

+    release: {{ .Release.Name }}

diff --git a/kubernetes/pomba/charts/pomba-networkdiscovery/values.yaml b/kubernetes/pomba/charts/pomba-networkdiscovery/values.yaml
new file mode 100644
index 0000000..b65f3be
--- /dev/null
+++ b/kubernetes/pomba/charts/pomba-networkdiscovery/values.yaml
@@ -0,0 +1,96 @@
+# Copyright © 2018 Amdocs

+#

+# 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.

+

+#################################################################

+# Global configuration defaults.

+#################################################################

+global:

+  nodePortPrefix: 302

+  repository: nexus3.onap.org:10001

+

+#################################################################

+# Application configuration defaults.

+#################################################################

+# application image

+repository: nexus3.onap.org:10001

+image:  onap/network-discovery:latest

+pullPolicy: Always

+

+# flag to enable debugging - application support required

+debugEnabled: false

+

+# application configuration

+# Example:

+config:

+  # Network Discovery Micro Service REST Client Configuration

+  # Basic Authorization credentials for Network Discovery Micro Service Rest Service

+  networkDiscoveryUserId: admin

+  networkDiscoveryPassword: OBF:1u2a1toa1w8v1tok1u30

+

+# 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

+

+#Example service definition with external, internal and node ports.

+service:

+  # The default service name (exposed in the service.yaml) will be the same

+  # name as the chart. If the service name needs to be overriden (such as

+  # when a subchart is shared), uncomment the value below.

+  #name: <service-name-override>

+

+  #Services may use any combination of ports depending on the 'type' of

+  #service being defined.

+  type: ClusterIP

+  externalPort: 9531

+  internalPort: 8080

+#  nodePort: <replace with unused node port suffix eg. 23>

+  # optional port name override - default can be defined in service.yaml

+  #portName: http

+

+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