From 7c43467d0238e9427690d42762925f43b039763b Mon Sep 17 00:00:00 2001 From: jmac Date: Fri, 11 May 2018 20:14:17 +0000 Subject: Add OOM chart for SDNC ansible server pod Change-Id: I0b62374a635b3f64c4d15b74eca8924c86082e92 Signed-off-by: jmac Issue-ID: SDNC-312 --- .../sdnc/charts/sdnc-ansible-server/.helmignore | 21 +++++ .../sdnc/charts/sdnc-ansible-server/Chart.yaml | 18 ++++ .../charts/sdnc-ansible-server/requirements.yaml | 18 ++++ .../resources/config/RestServer_config | 45 ++++++++++ .../sdnc-ansible-server/templates/configmap.yaml | 21 +++++ .../sdnc-ansible-server/templates/deployment.yaml | 96 ++++++++++++++++++++++ .../sdnc-ansible-server/templates/service.yaml | 33 ++++++++ .../sdnc/charts/sdnc-ansible-server/values.yaml | 79 ++++++++++++++++++ .../sdnc/resources/config/conf/lcm-dg.properties | 18 ++++ kubernetes/sdnc/templates/statefulset.yaml | 3 + kubernetes/sdnc/values.yaml | 10 +++ 11 files changed, 362 insertions(+) create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/.helmignore create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/Chart.yaml create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/requirements.yaml create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/resources/config/RestServer_config create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/templates/configmap.yaml create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/templates/service.yaml create mode 100644 kubernetes/sdnc/charts/sdnc-ansible-server/values.yaml create mode 100644 kubernetes/sdnc/resources/config/conf/lcm-dg.properties (limited to 'kubernetes/sdnc') diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/.helmignore b/kubernetes/sdnc/charts/sdnc-ansible-server/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/.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/sdnc/charts/sdnc-ansible-server/Chart.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/Chart.yaml new file mode 100644 index 0000000000..82b9fc5f89 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/Chart.yaml @@ -0,0 +1,18 @@ +# 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 +description: SDN-C Ansible Server +name: sdnc-ansible-server +version: 2.0.0 \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/requirements.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/requirements.yaml new file mode 100644 index 0000000000..1e8f788318 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/requirements.yaml @@ -0,0 +1,18 @@ +# 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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/resources/config/RestServer_config b/kubernetes/sdnc/charts/sdnc-ansible-server/resources/config/RestServer_config new file mode 100644 index 0000000000..f63fe211f6 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/resources/config/RestServer_config @@ -0,0 +1,45 @@ +# Copyright © 2017 AT&T, 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. + +# Host definition +ip: 0.0.0.0 +port: {{.Values.service.internalPort}} + +# Security (controls use of TLS encrypton and RestServer authentication) +tls: no +auth: no + +# TLS certificates (must be built on application host) +priv: provide_privated_key.pem +pub: provide_public_key.pem + +# RestServer authentication +id: sdnc +psswd: sdnc + +# Mysql +host: {{.Values.config.mysqlServiceName}} +user: sdnc +passwd: sdnc +db: ansible + +# Playbooks +from_files: yes +ansible_path: /opt/onap/sdnc/Playbooks +ansible_inv: Ansible_inventory +ansible_temp: PlaybooksTemp +timeout_seconds: 60 + +# Blocking on GetResults +getresults_block: yes diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/templates/configmap.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/configmap.yaml new file mode 100644 index 0000000000..f57dc78107 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/configmap.yaml @@ -0,0 +1,21 @@ +# 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: ConfigMap +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml new file mode 100644 index 0000000000..a19c33a7c6 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml @@ -0,0 +1,96 @@ +# 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 }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - {{ .Values.config.sdncChartName }} + 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: + - name: {{ include "common.name" . }} + command: ["/bin/bash"] + args: ["-c", "cd /opt/onap/sdnc && ./startAnsibleServer.sh"] + 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 }} + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: {{ .Values.config.configDir }}/RestServer_config + name: config + subPath: RestServer_config + 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: config + configMap: + name: {{ include "common.fullname" . }} + defaultMode: 0644 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/templates/service.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/service.yaml new file mode 100644 index 0000000000..3325d6bc0f --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/service.yaml @@ -0,0 +1,33 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# 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: {{ .Values.service.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: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/values.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/values.yaml new file mode 100644 index 0000000000..088008bf7e --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-ansible-server/values.yaml @@ -0,0 +1,79 @@ +# 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. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + readinessRepository: oomk8s + readinessImage: readiness-check:2.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/sdnc-ansible-server-image:1.3-STAGING-latest +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + sdncChartName: sdnc + configDir: /opt/onap/sdnc + mysqlServiceName: sdnc-dbhost + + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 60 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 60 + periodSeconds: 10 + +service: + type: ClusterIP + name: sdnc-ansible-server + portName: sdnc-ansible-server + internalPort: 8000 + externalPort: 8000 + +ingress: + enabled: false + +resources: {} +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/sdnc/resources/config/conf/lcm-dg.properties b/kubernetes/sdnc/resources/config/conf/lcm-dg.properties new file mode 100644 index 0000000000..625cf63e03 --- /dev/null +++ b/kubernetes/sdnc/resources/config/conf/lcm-dg.properties @@ -0,0 +1,18 @@ +ansible.agenturl=http://{{.Values.config.ansibleServiceName}}:{{.Values.config.ansiblePort}}/Dispatch +ansible.user=sdnc +ansible.password=sdnc +ansible.lcm.localparameters= +ansible.nodelist= +ansible.timeout=60 +ansible.version=0.00 +lcm.upgrade-pre-check.playbookname=ansible_precheck +lcm.upgrade-post-check.playbookname=ansible_postcheck +lcm.upgrade-software.playbookname=ansible_upgradesw +restapi.templateDir=/opt/onap/sdnc/restapi/templates +restapi.lcm.dmaap.publish.templatefile=lcm-dmaap-publish-template.json +lcm.dmaap.url=http://message-router.{{.Release.Namespace}}:{{.Values.config.dmaapPort}}/events/SDNC-LCM-WRITE +lcm.dmaap.user=admin +lcm.dmaap.password=admin +lcm.dmaap.version=1.0 +lcm.dmaap.partition=SDNC-LCM-WRITE +lcm.dmaap.type=response \ No newline at end of file diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml index 63175c4c4b..f648d07c1f 100644 --- a/kubernetes/sdnc/templates/statefulset.yaml +++ b/kubernetes/sdnc/templates/statefulset.yaml @@ -101,6 +101,9 @@ spec: - mountPath: {{ .Values.config.configDir }}/dblib.properties name: properties subPath: dblib.properties + - mountPath: {{ .Values.config.configDir }}/lcm-dg.properties + name: properties + subPath: lcm-dg.properties - mountPath: {{ .Values.config.configDir }}/svclogic.properties name: properties subPath: svclogic.properties diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index f077f94bb0..daefe4e74c 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -49,6 +49,9 @@ config: dmaapPort: 3904 logstashServiceName: log-ls logstashPort: 5044 + ansibleServiceName: sdnc-ansible-server + ansiblePort: 8000 + # dependency / sub-chart configuration dmaap-listener: @@ -78,6 +81,13 @@ sdnc-portal: dbRootPassword: openECOMP1.0 odlPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +sdnc-ansible-server: + service: + name: sdnc-ansible-server + internalPort: 8000 + config: + mysqlServiceName: sdnc-dbhost + mysql: nameOverride: sdnc-db service: -- cgit 1.2.3-korg