From 589ecb93f9cd18bd42349243214e965f193c6286 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Thu, 19 Nov 2020 17:19:06 +0100 Subject: [COMMON][MUSIC] Uses new tpls for repos / images This commit makes music template to use the new generator for repositories and images. As new templates doesn't work well with "sub charts", we move also subcharts to components folder. Issue-ID: OOM-2364 Signed-off-by: Sylvain Desbureaux Change-Id: Icd5caef12b28cbcc246cf30a13426d6eb11cfe20 --- kubernetes/common/music/Makefile | 51 ++++ .../music/charts/music-cassandra-job/.helmignore | 21 -- .../music/charts/music-cassandra-job/Chart.yaml | 19 -- .../music-cassandra-job/resources/LICENSE.txt | 13 - .../music-cassandra-job/resources/cql/admin.cql | 19 -- .../music-cassandra-job/resources/cql/admin_pw.cql | 8 - .../resources/cql/extra/check.cql | 23 -- .../music-cassandra-job/templates/configmap.yaml | 24 -- .../templates/configmap_extra.yaml | 24 -- .../charts/music-cassandra-job/templates/job.yaml | 90 ------ .../music/charts/music-cassandra-job/values.yaml | 71 ----- .../music/charts/music-cassandra/.helmignore | 21 -- .../common/music/charts/music-cassandra/Chart.yaml | 19 -- .../music/charts/music-cassandra/requirements.yaml | 18 -- .../music/charts/music-cassandra/templates/pv.yaml | 46 ---- .../charts/music-cassandra/templates/service.yaml | 54 ---- .../music-cassandra/templates/statefulset.yaml | 124 --------- .../music/charts/music-cassandra/values.yaml | 128 --------- kubernetes/common/music/charts/music/Chart.yaml | 18 -- .../charts/music/resources/config/logback.xml | 302 --------------------- .../music/resources/config/music-sb.properties | 13 - .../charts/music/resources/config/music.properties | 24 -- .../music/charts/music/resources/config/startup.sh | 69 ----- .../charts/music/resources/keys/org.onap.music.jks | Bin 3635 -> 0 bytes .../music/resources/keys/truststoreONAPall.jks | Bin 117990 -> 0 bytes .../music/charts/music/templates/configmap.yaml | 21 -- .../music/charts/music/templates/deployment.yaml | 121 --------- .../music/charts/music/templates/secrets.yaml | 17 -- .../music/charts/music/templates/service.yaml | 17 -- kubernetes/common/music/charts/music/values.yaml | 177 ------------ kubernetes/common/music/components/Makefile | 51 ++++ .../music/components/music-cassandra/.helmignore | 21 ++ .../music/components/music-cassandra/Chart.yaml | 19 ++ .../components/music-cassandra/requirements.yaml | 21 ++ .../music-cassandra/resources/LICENSE.txt | 13 + .../music-cassandra/resources/cql/admin.cql | 19 ++ .../music-cassandra/resources/cql/admin_pw.cql | 8 + .../music-cassandra/resources/cql/extra/check.cql | 23 ++ .../music-cassandra/templates/configmap.yaml | 24 ++ .../music-cassandra/templates/configmap_extra.yaml | 24 ++ .../components/music-cassandra/templates/job.yaml | 90 ++++++ .../components/music-cassandra/templates/pv.yaml | 46 ++++ .../music-cassandra/templates/service.yaml | 54 ++++ .../music-cassandra/templates/statefulset.yaml | 124 +++++++++ .../music/components/music-cassandra/values.yaml | 136 ++++++++++ kubernetes/common/music/requirements.yaml | 6 + .../common/music/resources/config/logback.xml | 302 +++++++++++++++++++++ .../music/resources/config/music-sb.properties | 13 + .../common/music/resources/config/music.properties | 24 ++ .../common/music/resources/config/startup.sh | 69 +++++ .../common/music/resources/keys/org.onap.music.jks | Bin 0 -> 3635 bytes .../music/resources/keys/truststoreONAPall.jks | Bin 0 -> 117990 bytes kubernetes/common/music/templates/configmap.yaml | 21 ++ kubernetes/common/music/templates/deployment.yaml | 121 +++++++++ kubernetes/common/music/templates/secrets.yaml | 17 ++ kubernetes/common/music/templates/service.yaml | 17 ++ kubernetes/common/music/values.yaml | 139 +++++++++- 57 files changed, 1440 insertions(+), 1514 deletions(-) create mode 100644 kubernetes/common/music/Makefile delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/.helmignore delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/Chart.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/resources/LICENSE.txt delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin.cql delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin_pw.cql delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/resources/cql/extra/check.cql delete mode 100755 kubernetes/common/music/charts/music-cassandra-job/templates/configmap.yaml delete mode 100755 kubernetes/common/music/charts/music-cassandra-job/templates/configmap_extra.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra-job/values.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/.helmignore delete mode 100644 kubernetes/common/music/charts/music-cassandra/Chart.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/requirements.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/templates/pv.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/templates/service.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml delete mode 100644 kubernetes/common/music/charts/music-cassandra/values.yaml delete mode 100644 kubernetes/common/music/charts/music/Chart.yaml delete mode 100755 kubernetes/common/music/charts/music/resources/config/logback.xml delete mode 100755 kubernetes/common/music/charts/music/resources/config/music-sb.properties delete mode 100755 kubernetes/common/music/charts/music/resources/config/music.properties delete mode 100755 kubernetes/common/music/charts/music/resources/config/startup.sh delete mode 100644 kubernetes/common/music/charts/music/resources/keys/org.onap.music.jks delete mode 100644 kubernetes/common/music/charts/music/resources/keys/truststoreONAPall.jks delete mode 100644 kubernetes/common/music/charts/music/templates/configmap.yaml delete mode 100644 kubernetes/common/music/charts/music/templates/deployment.yaml delete mode 100644 kubernetes/common/music/charts/music/templates/secrets.yaml delete mode 100644 kubernetes/common/music/charts/music/templates/service.yaml delete mode 100644 kubernetes/common/music/charts/music/values.yaml create mode 100644 kubernetes/common/music/components/Makefile create mode 100644 kubernetes/common/music/components/music-cassandra/.helmignore create mode 100644 kubernetes/common/music/components/music-cassandra/Chart.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/requirements.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/resources/LICENSE.txt create mode 100644 kubernetes/common/music/components/music-cassandra/resources/cql/admin.cql create mode 100644 kubernetes/common/music/components/music-cassandra/resources/cql/admin_pw.cql create mode 100644 kubernetes/common/music/components/music-cassandra/resources/cql/extra/check.cql create mode 100755 kubernetes/common/music/components/music-cassandra/templates/configmap.yaml create mode 100755 kubernetes/common/music/components/music-cassandra/templates/configmap_extra.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/templates/job.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/templates/pv.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/templates/service.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/templates/statefulset.yaml create mode 100644 kubernetes/common/music/components/music-cassandra/values.yaml create mode 100755 kubernetes/common/music/resources/config/logback.xml create mode 100755 kubernetes/common/music/resources/config/music-sb.properties create mode 100755 kubernetes/common/music/resources/config/music.properties create mode 100755 kubernetes/common/music/resources/config/startup.sh create mode 100644 kubernetes/common/music/resources/keys/org.onap.music.jks create mode 100644 kubernetes/common/music/resources/keys/truststoreONAPall.jks create mode 100644 kubernetes/common/music/templates/configmap.yaml create mode 100644 kubernetes/common/music/templates/deployment.yaml create mode 100644 kubernetes/common/music/templates/secrets.yaml create mode 100644 kubernetes/common/music/templates/service.yaml (limited to 'kubernetes/common') diff --git a/kubernetes/common/music/Makefile b/kubernetes/common/music/Makefile new file mode 100644 index 0000000000..4c79718d02 --- /dev/null +++ b/kubernetes/common/music/Makefile @@ -0,0 +1,51 @@ +# Copyright © 2020 Samsung Electronics +# +# 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. + +ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +OUTPUT_DIR := $(ROOT_DIR)/../dist +PACKAGE_DIR := $(OUTPUT_DIR)/packages +SECRET_DIR := $(OUTPUT_DIR)/secrets + +EXCLUDES := dist resources templates charts docker +HELM_BIN := helm +HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.)))) + +.PHONY: $(EXCLUDES) $(HELM_CHARTS) + +all: $(HELM_CHARTS) + +$(HELM_CHARTS): + @echo "\n[$@]" + @make package-$@ + +make-%: + @if [ -f $*/Makefile ]; then make -C $*; fi + +dep-%: make-% + @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi + +lint-%: dep-% + @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) lint $*; fi + +package-%: lint-% + @mkdir -p $(PACKAGE_DIR) + @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi + @$(HELM_BIN) repo index $(PACKAGE_DIR) + +clean: + @rm -f */requirements.lock + @rm -f *tgz */charts/*tgz + @rm -rf $(PACKAGE_DIR) +%: + @: diff --git a/kubernetes/common/music/charts/music-cassandra-job/.helmignore b/kubernetes/common/music/charts/music-cassandra-job/.helmignore deleted file mode 100644 index f0c1319444..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/.helmignore +++ /dev/null @@ -1,21 +0,0 @@ -# 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/common/music/charts/music-cassandra-job/Chart.yaml b/kubernetes/common/music/charts/music-cassandra-job/Chart.yaml deleted file mode 100644 index b4feb7114b..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/Chart.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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 -description: Cassandra Job - Run CQL Scripts after Cassandra Starts. -name: music-cassandra-job -version: 7.0.0 - diff --git a/kubernetes/common/music/charts/music-cassandra-job/resources/LICENSE.txt b/kubernetes/common/music/charts/music-cassandra-job/resources/LICENSE.txt deleted file mode 100644 index 7f60913d26..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/resources/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. \ No newline at end of file diff --git a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin.cql b/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin.cql deleted file mode 100644 index a76d774bd3..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin.cql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE KEYSPACE IF NOT EXISTS admin - WITH REPLICATION = { - 'class' : '{{.Values.cql.keyspace.replicationClass}}', - 'replication_factor': {{.Values.cql.keyspace.replicationFactor}} - } - AND DURABLE_WRITES = true; - -CREATE TABLE IF NOT EXISTS admin.keyspace_master ( - uuid uuid, - keyspace_name text, - application_name text, - is_api boolean, - password text, - username text, - is_aaf boolean, - PRIMARY KEY (uuid) -); - -describe keyspaces; diff --git a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin_pw.cql b/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin_pw.cql deleted file mode 100644 index 24f2ad77f7..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/admin_pw.cql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE ROLE IF NOT EXISTS {{.Values.cql.adminUser.username}} -WITH PASSWORD = '{{.Values.cql.adminUser.password}}' -AND SUPERUSER = true -AND LOGIN = true; - -ALTER ROLE cassandra -WITH PASSWORD = '{{.Values.cql.adminUser.passwordReplace}}'; - diff --git a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/extra/check.cql b/kubernetes/common/music/charts/music-cassandra-job/resources/cql/extra/check.cql deleted file mode 100644 index a516be857b..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/resources/cql/extra/check.cql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE KEYSPACE testks - WITH REPLICATION = { - 'class' : '{{.Values.cql.keyspace.replicationClass}}', - 'replication_factor': {{.Values.cql.keyspace.replicationFactor}} - } - AND DURABLE_WRITES = true; - -CREATE TABLE testks.keyspace_master_table ( - uuid uuid, - keyspace_name text, - application_name text, - is_api boolean, - password text, - username text, - is_aaf boolean, - PRIMARY KEY (uuid) -); - -DESCRIBE KEYSPACES; -DESCRIBE keyspace testks; -SELECT * FROM system_auth.roles; -DROP keyspace testks; - diff --git a/kubernetes/common/music/charts/music-cassandra-job/templates/configmap.yaml b/kubernetes/common/music/charts/music-cassandra-job/templates/configmap.yaml deleted file mode 100755 index 011dccda25..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/templates/configmap.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{/* -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-cql - namespace: {{ include "common.namespace" . }} -data: -{{ tpl (.Files.Glob "resources/cql/*").AsConfig . | indent 2 }} - diff --git a/kubernetes/common/music/charts/music-cassandra-job/templates/configmap_extra.yaml b/kubernetes/common/music/charts/music-cassandra-job/templates/configmap_extra.yaml deleted file mode 100755 index 72733b3088..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/templates/configmap_extra.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{/* -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-extra-cql - namespace: {{ include "common.namespace" . }} -data: -{{ tpl (.Files.Glob "resources/cql/extra/*").AsConfig . | indent 2 }} - diff --git a/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml b/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml deleted file mode 100644 index 2c6c3379c2..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml +++ /dev/null @@ -1,90 +0,0 @@ -{{/* -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: batch/v1 -kind: Job -metadata: - name: {{ include "common.fullname" . }}-config - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }}-job - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ include "common.release" . }} - heritage: {{ .Release.Service }} -spec: - template: - metadata: - labels: - app: {{ include "common.name" . }}-job - release: {{ include "common.release" . }} - spec: - restartPolicy: Never - initContainers: - - name: {{ include "common.name" . }}-readiness - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - command: - - /app/ready.py - args: - - --timeout - - "{{ .Values.global.readinessTimeout }}" - - --container-name - - music-cassandra - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - containers: - - name: {{ include "common.name" . }}-update-job - image: "{{ .Values.global.repository }}/{{ .Values.job.cassandra.image }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - env: - - name: CASS_HOSTNAME - value: "{{ .Values.job.host }}" - - name: USERNAME - value: "{{ .Values.cql.adminUser.username }}" - - name: PORT - value: "{{ .Values.job.port }}" - - name: PASSWORD - value: "{{ .Values.cql.adminUser.password }}" - - name: TIMEOUT - value: "{{ .Values.job.timeout }}" - - name: DELAY - value: "{{ .Values.job.delay }}" - volumeMounts: - # Admin cql Files that setup Admin Keyspace and Change Admin user. - - name: {{ include "common.name" . }}-cql - mountPath: /cql/admin.cql - subPath: admin.cql - - name: {{ include "common.name" . }}-cql - mountPath: /cql/admin_pw.cql - subPath: admin_pw.cql - # This is where Apps or MISC will put any of their own startup cql scripts. - - name: {{ include "common.name" . }}-extra-cql - mountPath: /cql/extra - volumes: - - name: {{ include "common.name" . }}-cql - configMap: - name: {{ include "common.fullname" . }}-cql - - name: {{ include "common.name" . }}-extra-cql - configMap: - name: {{ include "common.fullname" . }}-extra-cql - restartPolicy: Never - imagePullSecrets: - - name: "{{ include "common.namespace" . }}-docker-registry-key" - diff --git a/kubernetes/common/music/charts/music-cassandra-job/values.yaml b/kubernetes/common/music/charts/music-cassandra-job/values.yaml deleted file mode 100644 index eee1a3a522..0000000000 --- a/kubernetes/common/music/charts/music-cassandra-job/values.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. - -# Default values for cassandra. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -global: - pullPolicy: Always - repository: nexus3.onap.org:10001 - - # readiness check - readinessImage: onap/oom/readiness:3.0.1 - # Set default to 4 hrs. - # On slow environments dealys this long have been seen. - readinessTimeout: 240 - # logging agent - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 - - replicaCount: 3 - -job: - host: music-cassandra - port: 9042 - busybox: - image: library/busybox:latest - cassandra: - image: onap/music/cassandra_job:3.0.24 - timeout: 30 - delay: 120 -cql: - keyspace: - replicationClass: "SimpleStrategy" - replicationFactor: 3 - adminUser: - username: nelson24 - password: nelson24 - passwordReplace: A2C4E6G8I0J2L4O6Q8S0U2W4Y6 - -podManagementPolicy: OrderedReady -updateStrategy: - type: OnDelete - -ingress: - enabled: false - -tolerations: [] - -affinity: {} - -persistence: - enabled: true - -resources: - limits: - cpu: 1 - memory: 1Gi - requests: - cpu: 1 - memory: 1Gi diff --git a/kubernetes/common/music/charts/music-cassandra/.helmignore b/kubernetes/common/music/charts/music-cassandra/.helmignore deleted file mode 100644 index f0c1319444..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/.helmignore +++ /dev/null @@ -1,21 +0,0 @@ -# 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/common/music/charts/music-cassandra/Chart.yaml b/kubernetes/common/music/charts/music-cassandra/Chart.yaml deleted file mode 100644 index ed2488cc36..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/Chart.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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 -description: ONAP - Cassandra Database -name: music-cassandra -version: 7.0.0 - diff --git a/kubernetes/common/music/charts/music-cassandra/requirements.yaml b/kubernetes/common/music/charts/music-cassandra/requirements.yaml deleted file mode 100644 index 58fe07b90b..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/requirements.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. - -dependencies: - - name: common - version: ~7.x-0 - repository: 'file://../../../common' diff --git a/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml b/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml deleted file mode 100644 index 8399bff77d..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml +++ /dev/null @@ -1,46 +0,0 @@ -{{/* -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. -*/}} - -{{- $global := . }} -{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }} -{{- if eq "True" (include "common.needPV" .) -}} -{{- range $i := until (int $global.Values.replicaCount)}} -kind: PersistentVolume -apiVersion: v1 -metadata: - name: {{ include "common.fullname" $global }}-data-{{ $i }} - namespace: {{ include "common.namespace" $global }} - labels: - app: {{ include "common.fullname" $global }} - chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ include "common.release" $global }}" - heritage: "{{ $global.Release.Service }}" - name: {{ include "common.fullname" $global }} -spec: - capacity: - storage: {{ $global.Values.persistence.size}} - accessModes: - - {{ $global.Values.persistence.accessMode }} - persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} - storageClassName: "{{ include "common.fullname" $global }}-data" - hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} -{{if ne $i (int $global.Values.replicaCount) }} ---- -{{- end -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/kubernetes/common/music/charts/music-cassandra/templates/service.yaml b/kubernetes/common/music/charts/music-cassandra/templates/service.yaml deleted file mode 100644 index 5a26d6701c..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/templates/service.yaml +++ /dev/null @@ -1,54 +0,0 @@ -{{/* -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: {{ include "common.servicename" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ include "common.release" . }} - heritage: {{ .Release.Service }} - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" -spec: - type: {{ .Values.service.type }} - # Not working, open k8s bug: https://github.com/kubernetes/kubernetes/issues/58662 - publishNotReadyAddresses: true - ports: - {{if eq .Values.service.type "NodePort" -}} - - port: {{ .Values.service.internalPort }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} - name: {{ .Values.service.portName }} - - port: {{ .Values.service.internalPort2 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} - name: {{ .Values.service.portName3 }} - - port: {{ .Values.service.internalPort3 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort3 }} - name: {{ .Values.service.portName3 }} - {{- else -}} - - port: {{ .Values.service.internalPort }} - name: {{ .Values.service.portName }} - - port: {{ .Values.service.internalPort2 }} - name: {{ .Values.service.portName2 }} - - port: {{ .Values.service.internalPort3 }} - name: {{ .Values.service.portName3 }} - {{- end}} - selector: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} - clusterIP: None diff --git a/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml b/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml deleted file mode 100644 index 5ae944a568..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml +++ /dev/null @@ -1,124 +0,0 @@ -{{/* -# Copyright © 2019 AT&T, Amdocs, Bell Canada, Orange -# -# 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: apps/v1 -kind: StatefulSet -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ include "common.release" . }} - heritage: {{ .Release.Service }} -spec: - serviceName: {{ include "common.servicename" . }} - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ include "common.name" . }} - podManagementPolicy: {{ .Values.podManagementPolicy }} - updateStrategy: - type: {{ .Values.updateStrategy.type }} - template: - metadata: - labels: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} - name: {{ include "common.name" . }} - spec: - containers: - - name: {{ include "common.name" . }} - image: "{{ .Values.global.repository }}/{{ .Values.image.image }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - ports: - - containerPort: {{ .Values.service.internalPort }} - - containerPort: {{ .Values.service.internalPort2 }} - - containerPort: {{ .Values.service.internalPort3 }} - {{- if eq .Values.liveness.enabled true }} - livenessProbe: - exec: - command: - - /bin/bash - - -c - - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' - initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} - periodSeconds: {{ .Values.liveness.periodSeconds }} - {{ end -}} - readinessProbe: - exec: - command: - - /bin/bash - - -c - - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' - initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} - periodSeconds: {{ .Values.readiness.periodSeconds }} - lifecycle: - preStop: - exec: - command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] - env: - {{- $seed_size := default 1 .Values.replicaCount | int -}} - {{- $global := . }} - - name: MAX_HEAP_SIZE - value: {{ .Values.config.heap.max }} - - name: HEAP_NEWSIZE - value: {{ .Values.config.heap.min }} - - name: CASSANDRA_SEEDS - value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }}{{- if (lt ( add 1 $i ) $seed_size ) }},{{- end }}{{- end }}" - - name: JVM_OPTS - value: {{ .Values.config.jvmOpts | quote }} - - name: CASSANDRA_CLUSTER_NAME - value: {{ .Values.config.clusterName | quote }} - - name: CASSANDRA_DC - value: {{ .Values.config.dataCenter | quote }} - - name: CASSANDRA_RACK - value: {{ .Values.config.rackName | quote }} - - name: CASSANDRA_AUTO_BOOTSTRAP - value: {{ .Values.config.autoBootstrap | quote }} - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP -{{- if .Values.persistence.enabled }} - volumeMounts: - - name: {{ include "common.fullname" . }}-data - mountPath: /var/lib/cassandra -{{- end }} - resources: -{{ include "common.resources" . | indent 12 }} - volumes: - - name: localtime - hostPath: - path: /etc/localtime -{{- if .Values.persistence.enabled }} - volumeClaimTemplates: - - metadata: - name: {{ include "common.fullname" . }}-data - labels: - name: {{ include "common.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ include "common.release" . }}" - heritage: "{{ .Release.Service }}" - spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - storageClassName: {{ include "common.storageClass" . }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- end }} diff --git a/kubernetes/common/music/charts/music-cassandra/values.yaml b/kubernetes/common/music/charts/music-cassandra/values.yaml deleted file mode 100644 index 0402a3207c..0000000000 --- a/kubernetes/common/music/charts/music-cassandra/values.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. - -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -global: - nodePortPrefix: 302 - - pullPolicy: Always - repository: nexus3.onap.org:10001 - - # readiness check - readinessImage: onap/oom/readiness:3.0.1 - - # logging agent - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 - -replicaCount: 3 - -# Cassandra Image - This image is modified from the original on -# Docker Hub where the Security has been turned on. -# When logging into DB the default username and password are 'cassandra' -# kubectl exec -it -n cqlsh -u cassandra -p cassandra -image: - image: onap/music/cassandra_3_11:3.0.24 - pullPolicy: Always - -# Cassandra ENV configuration -config: - heap: - max: 512M - min: 100M - jvmOpts: -Dcassandra.consistent.rangemovement=false - clusterName: music-cluster - dataCenter: onap-1 - rackName: Rack1 - autoBootstrap: true - ports: - cql: 9042 - thrift: 9160 - # If a JVM Agent is in place - # agent: 61621 - -service: - expose: true - type: ClusterIP - name: music-cassandra - internalPort: 9042 - portName: cql - internalPort2: 9160 - portName2: thrift - internalPort3: 61621 - portName3: agent - -# probe configuration parameters -liveness: - initialDelaySeconds: 120 - 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 - -podManagementPolicy: OrderedReady -updateStrategy: - type: OnDelete - -ingress: - enabled: false - -tolerations: [] - -persistence: - enabled: true - - ## A manually managed Persistent Volume and Claim - ## Requires persistence.enabled: true - ## If defined, PVC must be created manually before volume will be bound - # existingClaim: - volumeReclaimPolicy: Retain - - ## database data Persistent Volume Storage Class - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - ## storageClass: "-" - accessMode: ReadWriteOnce - size: 2Gi - mountPath: /dockerdata-nfs/ - mountSubPath: common/cassandra/data - -# Resource Limit flavor -By Default using small -flavor: small -# Segregation for Different environment (Small and Large) -resources: - small: - limits: - cpu: 500m - memory: 1.2Gi - requests: - cpu: 160m - memory: 900Mi - large: - limits: - cpu: 4 - memory: 10Gi - requests: - cpu: 2 - memory: 6Gi - unlimited: {} diff --git a/kubernetes/common/music/charts/music/Chart.yaml b/kubernetes/common/music/charts/music/Chart.yaml deleted file mode 100644 index 105f447bd3..0000000000 --- a/kubernetes/common/music/charts/music/Chart.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright © 2018 AT&T, Amdocs, Bell Canada 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 -description: MUSIC api as a Service API Spring boot container. -name: music -version: 7.0.0 diff --git a/kubernetes/common/music/charts/music/resources/config/logback.xml b/kubernetes/common/music/charts/music/resources/config/logback.xml deleted file mode 100755 index 51423e547d..0000000000 --- a/kubernetes/common/music/charts/music/resources/config/logback.xml +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %X{keyspace} %msg%n - - - - - - - - - ${logDirectory}/${generalLogName}.log - - ${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log.zip - 1GB - 5 - 5GB - - - ${applicationLoggerPattern} - - - - - 256 - true - - - - - - - - keyspace - unknown - - - - ${logDirectory}/${generalLogName}-keyspace.log - - ${logDirectory}/${generalLogName}-${keyspace}.%d{yyyy-MM-dd}.%i.log.zip - 30 - - - ${applicationLoggerPattern} - - - - - - - 256 - true - - - - - - - - - - - ${logDirectory}/${securityLogName}.log - - ${logDirectory}/${securityLogName}.%i.log.zip - 1 - 9 - - - 5MB - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n - - - - - 256 - 0 - - - - - - - - - - ${logDirectory}/${auditLogName}.log - - ${logDirectory}/${auditLogName}.%i.log.zip - 1 - 9 - - - 5MB - - - ${auditLoggerPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}.log - - ${logDirectory}/${metricsLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - - ${metricsLoggerPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}.log - - ${logDirectory}/${errorLogName}.%i.log.zip - 1 - 9 - - - 5MB - - - ${errorLoggerPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}.log - - ${debugLogDirectory}/${debugLogName}.%i.log.zip - 1 - 9 - - - 5MB - - - ${debugLoggerPattern} - - - - - 256 - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kubernetes/common/music/charts/music/resources/config/music-sb.properties b/kubernetes/common/music/charts/music/resources/config/music-sb.properties deleted file mode 100755 index 751a351737..0000000000 --- a/kubernetes/common/music/charts/music/resources/config/music-sb.properties +++ /dev/null @@ -1,13 +0,0 @@ -server.port=8443 -server.servlet.context-path=/MUSIC/rest -spring.jackson.mapper.ACCEPT_CASE_INSENSITIVE_ENUMS=true -#server.ssl.enabled=false -server.tomcat.max-threads=100 -#logging.file=/opt/app/music/logs/MUSIC/music-app.log -#logging.config=file:/opt/app/music/etc/logback.xml -security.require-ssl=true -server.ssl.key-store=/opt/app/aafcertman/org.onap.music.jks -server.ssl.key-store-password=${KEYSTORE_PASSWORD} -server.ssl.key-store-provider=SUN -server.ssl.key-store-type=JKS - diff --git a/kubernetes/common/music/charts/music/resources/config/music.properties b/kubernetes/common/music/charts/music/resources/config/music.properties deleted file mode 100755 index a7681d0a02..0000000000 --- a/kubernetes/common/music/charts/music/resources/config/music.properties +++ /dev/null @@ -1,24 +0,0 @@ -lock.using={{.Values.properties.lockUsing}} -cassandra.host={{.Values.properties.cassandraHost}} -cassandra.port={{ .Values.properties.cassandraPort }} -lock.lease.period={{.Values.properties.lockLeasePeriod}} -cassandra.user=${CASSA_USER} -cassandra.password=${CASSA_PASSWORD} -cassandra.connecttimeoutms={{.Values.properties.cassandraConnecttimeoutms}} -cassandra.readtimeoutms={{.Values.properties.cassandraReadtimeoutms}} -cadi={{.Values.properties.cadi}} -music.aaf.ns={{.Values.properties.musicAafNs}} -keyspace.active={{.Values.properties.keyspaceActive}} -transId.header.required={{.Values.properties.transIdRequired}} -transId.header.prefix={{.Values.properties.transIdPrefix}} -conversation.header.required={{.Values.properties.conversationRequired}} -conversation.header.prefix={{.Values.properties.conversationPrefix}} -clientId.header.required={{.Values.properties.clientIdRequired}} -clientId.header.prefix={{.Values.properties.clientIdPrefix}} -messageId.header.required={{.Values.properties.messageIdRequired}} -messageId.header.prefix={{.Values.properties.messageIdPrefix}} -retry.count={{.Values.properties.retryCount}} -lock.daemon.sleeptime.ms={{.Values.properties.lockDaemonSleeptimeMs}} -keyspaces.for.lock.cleanup={{.Values.properties.keyspaceForLockCleanup}} -create.lock.wait.period.ms=0 -create.lock.wait.increment.ms=0 diff --git a/kubernetes/common/music/charts/music/resources/config/startup.sh b/kubernetes/common/music/charts/music/resources/config/startup.sh deleted file mode 100755 index 37bb84de8b..0000000000 --- a/kubernetes/common/music/charts/music/resources/config/startup.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -{{/* -# -# ============LICENSE_START========================================== -# org.onap.music -# =================================================================== -# Copyright (c) 2019 AT&T Intellectual Property -# =================================================================== -# 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. -# -# ============LICENSE_END============================================= -# ==================================================================== -*/}} - -echo "Running startup script to get password from certman" -PWFILE=/opt/app/aafcertman/.password -LOGFILE=/opt/app/music/logs/MUSIC/music-sb.log -PROPS=/opt/app/music/etc/music-sb.properties -LOGBACK=/opt/app/music/etc/logback.xml -LOGGING= -DEBUG_PROP= -# Debug Setup. Uses env variables -# DEBUG and DEBUG_PORT -# DEBUG=true/false | DEBUG_PORT= -if [ "${DEBUG}" == "true" ]; then - if [ "${DEBUG_PORT}" == "" ]; then - DEBUG_PORT=8000 - fi - echo "Debug mode on" - DEBUG_PROP="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n" -fi - -# LOGBACK file: if /opt/app/music/etc/logback.xml exists thenuse that. -if [ -f $LOGBACK ]; then - LOGGING="--logging.config=file:${LOGBACK}" -fi - -# Get Passwords from /opt/app/aafcertman -if [ -f $PWFILE ]; then - echo "Found ${PWFILE}" >> $LOGFILE - PASSWORD=$(cat ${PWFILE}) -else - PASSWORD=changeit - echo "#### Using Default Password for Certs" >> ${LOGFILE} -fi - -# If music-sb.properties exists in /opt/app/music/etc then use that to override the application.properties -if [ -f $PROPS ]; then - # Run with different Property file - #echo "java ${DEBUG_PROP} -jar MUSIC.jar --spring.config.location=file:${PROPS} ${LOGGING} 2>&1 | tee ${LOGFILE}" - java ${DEBUG_PROP} ${JAVA_OPTS} -jar MUSIC-SB.jar ${SPRING_OPTS} --spring.config.location=file:${PROPS} ${LOGGING} 2>&1 | tee ${LOGFILE} -else - #echo "java ${DEBUG_PROP} -jar MUSIC.jar --server.ssl.key-store-password=${PASSWORD} ${LOGGING} 2>&1 | tee ${LOGFILE}" - java ${DEBUG_PROP} ${JAVA_OPTS} -jar MUSIC-SB.jar ${SPRING_OPTS} --server.ssl.key-store-password="${PASSWORD}" ${LOGGING} 2>&1 | tee ${LOGFILE} -fi - - - - diff --git a/kubernetes/common/music/charts/music/resources/keys/org.onap.music.jks b/kubernetes/common/music/charts/music/resources/keys/org.onap.music.jks deleted file mode 100644 index 35d27c3ef7..0000000000 Binary files a/kubernetes/common/music/charts/music/resources/keys/org.onap.music.jks and /dev/null differ diff --git a/kubernetes/common/music/charts/music/resources/keys/truststoreONAPall.jks b/kubernetes/common/music/charts/music/resources/keys/truststoreONAPall.jks deleted file mode 100644 index ff844b109d..0000000000 Binary files a/kubernetes/common/music/charts/music/resources/keys/truststoreONAPall.jks and /dev/null differ diff --git a/kubernetes/common/music/charts/music/templates/configmap.yaml b/kubernetes/common/music/charts/music/templates/configmap.yaml deleted file mode 100644 index d42cf2e7e0..0000000000 --- a/kubernetes/common/music/charts/music/templates/configmap.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{/* -# Copyright © 2017-2020 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. -*/}} - -apiVersion: v1 -kind: ConfigMap -metadata: {{- include "common.resourceMetadata" . | nindent 2 }} -data: -{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/music/charts/music/templates/deployment.yaml b/kubernetes/common/music/charts/music/templates/deployment.yaml deleted file mode 100644 index 63b5ab0974..0000000000 --- a/kubernetes/common/music/charts/music/templates/deployment.yaml +++ /dev/null @@ -1,121 +0,0 @@ -{{/* -# Copyright © 2017-2020 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. -*/}} - -apiVersion: apps/v1 -kind: Deployment -metadata: {{- include "common.resourceMetadata" . | nindent 2 }} -spec: - selector: {{- include "common.selectors" . | nindent 4 }} - replicas: {{ .Values.replicaCount }} - template: - metadata: {{- include "common.templateMetadata" . | nindent 6 }} - spec: - initContainers: - - name: {{ include "common.name" . }}-cassandra-readiness - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - command: - - /app/ready.py - args: - - -j - - "{{ include "common.release" . }}-music-cassandra-job-config" - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - - command: - - sh - args: - - -c - - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" - env: - - name: KEYSTORE_PASSWORD - {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-keystore-pw" "key" "password") | indent 12}} - - name: CASSA_USER - {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "login") | indent 12 }} - - name: CASSA_PASSWORD - {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "password") | indent 12 }} - volumeMounts: - - mountPath: /config-input - name: properties-music-scrubbed - - mountPath: /config - name: properties-music - image: "{{ .Values.global.envsubstImage }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - name: {{ include "common.name" . }}-update-config - containers: - # MUSIC Container - - name: "{{ include "common.name" . }}-springboot" - image: "{{ .Values.repository }}/{{ .Values.image }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - ports: {{ include "common.containerPorts" . | nindent 12 }} - # 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.liveness.port }} - initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} - periodSeconds: {{ .Values.liveness.periodSeconds }} - {{ end -}} - readinessProbe: - tcpSocket: - port: {{ .Values.readiness.port }} - initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} - periodSeconds: {{ .Values.readiness.periodSeconds }} - resources: -{{ include "common.resources" . | indent 12 }} - env: - - name: SPRING_OPTS - value: "{{ .Values.springOpts }}" - - name: JAVA_OPTS - value: "{{ .Values.javaOpts }}" - - name: DEBUG - value: "{{ .Values.debug }}" - volumeMounts: - - name: localtime - mountPath: /etc/localtime - readOnly: true - - name: properties-music - mountPath: /opt/app/music/etc/music.properties - subPath: music.properties - - name: properties-music - mountPath: /opt/app/music/etc/music-sb.properties - subPath: music-sb.properties - - name: properties-music-scrubbed - mountPath: /opt/app/music/etc/logback.xml - subPath: logback.xml - - name: certs-aaf - mountPath: /opt/app/aafcertman/ - volumes: - - name: shared-data - emptyDir: {} - - name: certificate-vol - emptyDir: {} - - name: localtime - hostPath: - path: /etc/localtime - - name: properties-music-scrubbed - configMap: - name: {{ include "common.fullname" . }} - - name: properties-music - emptyDir: - medium: Memory - - name: certs-aaf - secret: - secretName: {{ include "common.secret.getSecretNameFast" (dict "global" . "uid" "music-certs") }} diff --git a/kubernetes/common/music/charts/music/templates/secrets.yaml b/kubernetes/common/music/charts/music/templates/secrets.yaml deleted file mode 100644 index 15791a85d7..0000000000 --- a/kubernetes/common/music/charts/music/templates/secrets.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -# Copyright © 2020 AT&T, 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. -*/}} - -{{ include "common.secretFast" . }} diff --git a/kubernetes/common/music/charts/music/templates/service.yaml b/kubernetes/common/music/charts/music/templates/service.yaml deleted file mode 100644 index 3bd32a9419..0000000000 --- a/kubernetes/common/music/charts/music/templates/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -# Copyright © 2017-2020 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. -*/}} - -{{ include "common.service" . }} diff --git a/kubernetes/common/music/charts/music/values.yaml b/kubernetes/common/music/charts/music/values.yaml deleted file mode 100644 index bf3ad2279c..0000000000 --- a/kubernetes/common/music/charts/music/values.yaml +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright © 2020 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. - -################################################################# -# Global configuration defaults. -################################################################# -global: - nodePortPrefix: 302 - nodePortPrefixExt: 304 - repository: nexus3.onap.org:10001 - - envsubstImage: dibi/envsubst - - # readiness check - readinessImage: onap/oom/readiness:3.0.1 - - # logging agent - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 - - truststore: truststoreONAPall.jks - - -################################################################# -# Secrets metaconfig -################################################################# -secrets: - - uid: music-certs - name: keystore.jks - type: generic - filePaths: - - resources/keys/org.onap.music.jks - - uid: music-keystore-pw - name: keystore-pw - type: password - password: '{{ .Values.keystorePassword }}' - passwordPolicy: required - - uid: cassa-secret - type: basicAuth - login: '{{ .Values.properties.cassandraUser }}' - password: '{{ .Values.properties.cassandraPassword }}' - passwordPolicy: required - - -################################################################# -# Application configuration defaults. -################################################################# -# application image -repository: nexus3.onap.org:10001 -image: onap/music/music_sb:3.2.40 -pullPolicy: Always - -job: - host: cassandra - port: 9042 - busybox: - image: library/busybox:latest - - -# default number of instances -replicaCount: 1 - -nodeSelector: {} - -affinity: {} - -# probe configuration parameters -liveness: - initialDelaySeconds: 30 - periodSeconds: 6 - # necessary to disable liveness probe when setting breakpoints - # in debugger so K8s doesn't restart unresponsive container - enabled: false - port: 8443 - - -# Java options that need to be passed to jave on CLI -#javaOpts: -Xms256m -Xmx2048m -javaOpts: -# Options that need to be passed to CLI for Sprngboot, pw is a secret passed in through ENV -springOpts: --spring.config.location=file:/opt/app/music/etc/music-sb.properties -# Resource Limit flavor -By Default using small -flavor: large -# Segregation for Different environment (Small and Large) -resources: - small: - limits: - cpu: 1000m - memory: 1G - requests: - cpu: 300m - memory: 512Mi - large: - limits: - cpu: 1500m - memory: 3Gi - requests: - cpu: 1000m - memory: 2Gi - unlimited: {} - -readiness: - initialDelaySeconds: 350 - periodSeconds: 120 - port: 8443 - -service: - useNodePortExt: true - type: NodePort - name: music - ports: - - name: https-api - port: 8443 - nodePort: '07' - -# Turn on Debugging true/false -debug: false -ingress: - enabled: false - -keystorePassword: "ysF9CVS+xvuXr0vf&fRa5lew" - -properties: - lockUsing: "cassandra" - # Comma dilimited list of hosts - cassandraHost: "music-cassandra" - cassandraUser: "nelson24" - cassandraPassword: "nelson24" - cassandraConnecttimeoutms: 12000 - cassandraPort: 9042 - # Connection Timeout for Cassandra in ms - # Read Timeout for Cassandra in ms - cassandraReadtimeoutms: 12000 - keyspaceActive: true - # Enable CADI - cadi: false - # Special headers that may be passed and if they are required. - # With the ability to add a Prefix if required. - transIdRequired: false - transIdPrefix: X-ATT- - conversationRequired: false - conversationPrefix: X-CSI- - clientIdRequired: false - clientIdPrefix: - messageIdRequired: false - messageIdPrefix: - - # sleep time for lock cleanup daemon, negative values turn off daemon -##### Lock settings - retryCount: 3 - lockLeasePeriod: 6000 - # sleep time for lock cleanup daemon, negative values turn off daemon - lockDaemonSleeptimeMs: 30000 - #comma separated list of keyspace names - keyspaceForLockCleanup: - - -logback: - errorLogLevel: info - securityLogLevel: info - applicationLogLevel: info - metricsLogLevel: info - auditLogLevel: info - # Values must be uppercase: INFO, WARN, CRITICAL,DEBUG etc.. - rootLogLevel: INFO - diff --git a/kubernetes/common/music/components/Makefile b/kubernetes/common/music/components/Makefile new file mode 100644 index 0000000000..bf267b7720 --- /dev/null +++ b/kubernetes/common/music/components/Makefile @@ -0,0 +1,51 @@ +# Copyright © 2020 Samsung Electronics +# +# 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. + +ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +OUTPUT_DIR := $(ROOT_DIR)/../../dist +PACKAGE_DIR := $(OUTPUT_DIR)/packages +SECRET_DIR := $(OUTPUT_DIR)/secrets + +EXCLUDES := +HELM_BIN := helm +HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.)))) + +.PHONY: $(EXCLUDES) $(HELM_CHARTS) + +all: $(HELM_CHARTS) + +$(HELM_CHARTS): + @echo "\n[$@]" + @make package-$@ + +make-%: + @if [ -f $*/Makefile ]; then make -C $*; fi + +dep-%: make-% + @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi + +lint-%: dep-% + @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) lint $*; fi + +package-%: lint-% + @mkdir -p $(PACKAGE_DIR) + @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi + @$(HELM_BIN) repo index $(PACKAGE_DIR) + +clean: + @rm -f */requirements.lock + @rm -f *tgz */charts/*tgz + @rm -rf $(PACKAGE_DIR) +%: + @: diff --git a/kubernetes/common/music/components/music-cassandra/.helmignore b/kubernetes/common/music/components/music-cassandra/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/.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/common/music/components/music-cassandra/Chart.yaml b/kubernetes/common/music/components/music-cassandra/Chart.yaml new file mode 100644 index 0000000000..ed2488cc36 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/Chart.yaml @@ -0,0 +1,19 @@ +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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 +description: ONAP - Cassandra Database +name: music-cassandra +version: 7.0.0 + diff --git a/kubernetes/common/music/components/music-cassandra/requirements.yaml b/kubernetes/common/music/components/music-cassandra/requirements.yaml new file mode 100644 index 0000000000..3d71e307d6 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/requirements.yaml @@ -0,0 +1,21 @@ +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. + +dependencies: + - name: common + version: ~7.x-0 + repository: 'file://../../../common' + - name: repositoryGenerator + version: ~7.x-0 + repository: 'file://../../../repositoryGenerator' diff --git a/kubernetes/common/music/components/music-cassandra/resources/LICENSE.txt b/kubernetes/common/music/components/music-cassandra/resources/LICENSE.txt new file mode 100644 index 0000000000..7f60913d26 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/resources/LICENSE.txt @@ -0,0 +1,13 @@ +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. \ No newline at end of file diff --git a/kubernetes/common/music/components/music-cassandra/resources/cql/admin.cql b/kubernetes/common/music/components/music-cassandra/resources/cql/admin.cql new file mode 100644 index 0000000000..a76d774bd3 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/resources/cql/admin.cql @@ -0,0 +1,19 @@ +CREATE KEYSPACE IF NOT EXISTS admin + WITH REPLICATION = { + 'class' : '{{.Values.cql.keyspace.replicationClass}}', + 'replication_factor': {{.Values.cql.keyspace.replicationFactor}} + } + AND DURABLE_WRITES = true; + +CREATE TABLE IF NOT EXISTS admin.keyspace_master ( + uuid uuid, + keyspace_name text, + application_name text, + is_api boolean, + password text, + username text, + is_aaf boolean, + PRIMARY KEY (uuid) +); + +describe keyspaces; diff --git a/kubernetes/common/music/components/music-cassandra/resources/cql/admin_pw.cql b/kubernetes/common/music/components/music-cassandra/resources/cql/admin_pw.cql new file mode 100644 index 0000000000..24f2ad77f7 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/resources/cql/admin_pw.cql @@ -0,0 +1,8 @@ +CREATE ROLE IF NOT EXISTS {{.Values.cql.adminUser.username}} +WITH PASSWORD = '{{.Values.cql.adminUser.password}}' +AND SUPERUSER = true +AND LOGIN = true; + +ALTER ROLE cassandra +WITH PASSWORD = '{{.Values.cql.adminUser.passwordReplace}}'; + diff --git a/kubernetes/common/music/components/music-cassandra/resources/cql/extra/check.cql b/kubernetes/common/music/components/music-cassandra/resources/cql/extra/check.cql new file mode 100644 index 0000000000..a516be857b --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/resources/cql/extra/check.cql @@ -0,0 +1,23 @@ +CREATE KEYSPACE testks + WITH REPLICATION = { + 'class' : '{{.Values.cql.keyspace.replicationClass}}', + 'replication_factor': {{.Values.cql.keyspace.replicationFactor}} + } + AND DURABLE_WRITES = true; + +CREATE TABLE testks.keyspace_master_table ( + uuid uuid, + keyspace_name text, + application_name text, + is_api boolean, + password text, + username text, + is_aaf boolean, + PRIMARY KEY (uuid) +); + +DESCRIBE KEYSPACES; +DESCRIBE keyspace testks; +SELECT * FROM system_auth.roles; +DROP keyspace testks; + diff --git a/kubernetes/common/music/components/music-cassandra/templates/configmap.yaml b/kubernetes/common/music/components/music-cassandra/templates/configmap.yaml new file mode 100755 index 0000000000..011dccda25 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/configmap.yaml @@ -0,0 +1,24 @@ +{{/* +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-cql + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/cql/*").AsConfig . | indent 2 }} + diff --git a/kubernetes/common/music/components/music-cassandra/templates/configmap_extra.yaml b/kubernetes/common/music/components/music-cassandra/templates/configmap_extra.yaml new file mode 100755 index 0000000000..72733b3088 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/configmap_extra.yaml @@ -0,0 +1,24 @@ +{{/* +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-extra-cql + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/cql/extra/*").AsConfig . | indent 2 }} + diff --git a/kubernetes/common/music/components/music-cassandra/templates/job.yaml b/kubernetes/common/music/components/music-cassandra/templates/job.yaml new file mode 100644 index 0000000000..3cf1ae34fd --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/job.yaml @@ -0,0 +1,90 @@ +{{/* +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: batch/v1 +kind: Job +metadata: + name: {{ include "common.fullname" . }}-config + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }}-job + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + template: + metadata: + labels: + app: {{ include "common.name" . }}-job + release: {{ include "common.release" . }} + spec: + restartPolicy: Never + initContainers: + - name: {{ include "common.name" . }}-readiness + image: {{ include "repositoryGenerator.image.readiness" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /app/ready.py + args: + - --timeout + - "{{ .Values.readinessTimeout }}" + - --container-name + - music-cassandra + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + containers: + - name: {{ include "common.name" . }}-update-job + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.job.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: CASS_HOSTNAME + value: "{{ .Values.job.host }}" + - name: USERNAME + value: "{{ .Values.cql.adminUser.username }}" + - name: PORT + value: "{{ .Values.job.port }}" + - name: PASSWORD + value: "{{ .Values.cql.adminUser.password }}" + - name: TIMEOUT + value: "{{ .Values.job.timeout }}" + - name: DELAY + value: "{{ .Values.job.delay }}" + volumeMounts: + # Admin cql Files that setup Admin Keyspace and Change Admin user. + - name: {{ include "common.name" . }}-cql + mountPath: /cql/admin.cql + subPath: admin.cql + - name: {{ include "common.name" . }}-cql + mountPath: /cql/admin_pw.cql + subPath: admin_pw.cql + # This is where Apps or MISC will put any of their own startup cql scripts. + - name: {{ include "common.name" . }}-extra-cql + mountPath: /cql/extra + volumes: + - name: {{ include "common.name" . }}-cql + configMap: + name: {{ include "common.fullname" . }}-cql + - name: {{ include "common.name" . }}-extra-cql + configMap: + name: {{ include "common.fullname" . }}-extra-cql + restartPolicy: Never + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" + diff --git a/kubernetes/common/music/components/music-cassandra/templates/pv.yaml b/kubernetes/common/music/components/music-cassandra/templates/pv.yaml new file mode 100644 index 0000000000..8399bff77d --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/pv.yaml @@ -0,0 +1,46 @@ +{{/* +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. +*/}} + +{{- $global := . }} +{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }} +{{- if eq "True" (include "common.needPV" .) -}} +{{- range $i := until (int $global.Values.replicaCount)}} +kind: PersistentVolume +apiVersion: v1 +metadata: + name: {{ include "common.fullname" $global }}-data-{{ $i }} + namespace: {{ include "common.namespace" $global }} + labels: + app: {{ include "common.fullname" $global }} + chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" + release: "{{ include "common.release" $global }}" + heritage: "{{ $global.Release.Service }}" + name: {{ include "common.fullname" $global }} +spec: + capacity: + storage: {{ $global.Values.persistence.size}} + accessModes: + - {{ $global.Values.persistence.accessMode }} + persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} + storageClassName: "{{ include "common.fullname" $global }}-data" + hostPath: + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} +{{if ne $i (int $global.Values.replicaCount) }} +--- +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/kubernetes/common/music/components/music-cassandra/templates/service.yaml b/kubernetes/common/music/components/music-cassandra/templates/service.yaml new file mode 100644 index 0000000000..5a26d6701c --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/service.yaml @@ -0,0 +1,54 @@ +{{/* +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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: {{ include "common.servicename" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + type: {{ .Values.service.type }} + # Not working, open k8s bug: https://github.com/kubernetes/kubernetes/issues/58662 + publishNotReadyAddresses: true + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.portName }} + - port: {{ .Values.service.internalPort2 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} + name: {{ .Values.service.portName3 }} + - port: {{ .Values.service.internalPort3 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort3 }} + name: {{ .Values.service.portName3 }} + {{- else -}} + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName }} + - port: {{ .Values.service.internalPort2 }} + name: {{ .Values.service.portName2 }} + - port: {{ .Values.service.internalPort3 }} + name: {{ .Values.service.portName3 }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ include "common.release" . }} + clusterIP: None diff --git a/kubernetes/common/music/components/music-cassandra/templates/statefulset.yaml b/kubernetes/common/music/components/music-cassandra/templates/statefulset.yaml new file mode 100644 index 0000000000..665cdaad0a --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/templates/statefulset.yaml @@ -0,0 +1,124 @@ +{{/* +# Copyright © 2019 AT&T, Amdocs, Bell Canada, Orange +# +# 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: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + serviceName: {{ include "common.servicename" . }} + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "common.name" . }} + podManagementPolicy: {{ .Values.podManagementPolicy }} + updateStrategy: + type: {{ .Values.updateStrategy.type }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ include "common.release" . }} + name: {{ include "common.name" . }} + spec: + containers: + - name: {{ include "common.name" . }} + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + - containerPort: {{ .Values.service.internalPort2 }} + - containerPort: {{ .Values.service.internalPort3 }} + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + exec: + command: + - /bin/bash + - -c + - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{ end -}} + readinessProbe: + exec: + command: + - /bin/bash + - -c + - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + lifecycle: + preStop: + exec: + command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] + env: + {{- $seed_size := default 1 .Values.replicaCount | int -}} + {{- $global := . }} + - name: MAX_HEAP_SIZE + value: {{ .Values.config.heap.max }} + - name: HEAP_NEWSIZE + value: {{ .Values.config.heap.min }} + - name: CASSANDRA_SEEDS + value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }}{{- if (lt ( add 1 $i ) $seed_size ) }},{{- end }}{{- end }}" + - name: JVM_OPTS + value: {{ .Values.config.jvmOpts | quote }} + - name: CASSANDRA_CLUSTER_NAME + value: {{ .Values.config.clusterName | quote }} + - name: CASSANDRA_DC + value: {{ .Values.config.dataCenter | quote }} + - name: CASSANDRA_RACK + value: {{ .Values.config.rackName | quote }} + - name: CASSANDRA_AUTO_BOOTSTRAP + value: {{ .Values.config.autoBootstrap | quote }} + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP +{{- if .Values.persistence.enabled }} + volumeMounts: + - name: {{ include "common.fullname" . }}-data + mountPath: /var/lib/cassandra +{{- end }} + resources: +{{ include "common.resources" . | indent 12 }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime +{{- if .Values.persistence.enabled }} + volumeClaimTemplates: + - metadata: + name: {{ include "common.fullname" . }}-data + labels: + name: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ include "common.release" . }}" + heritage: "{{ .Release.Service }}" + spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + storageClassName: {{ include "common.storageClass" . }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/kubernetes/common/music/components/music-cassandra/values.yaml b/kubernetes/common/music/components/music-cassandra/values.yaml new file mode 100644 index 0000000000..317087cf24 --- /dev/null +++ b/kubernetes/common/music/components/music-cassandra/values.yaml @@ -0,0 +1,136 @@ +# Copyright © 2018 AT&T, Amdocs, Bell Canada 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. + +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + nodePortPrefix: 302 + persistence: {} + +replicaCount: 3 + +# Cassandra Image - This image is modified from the original on +# Docker Hub where the Security has been turned on. +# When logging into DB the default username and password are 'cassandra' +# kubectl exec -it -n cqlsh -u cassandra -p cassandra +image: onap/music/cassandra_3_11:3.0.24 +pullPolicy: Always + +# Cassandra ENV configuration +config: + heap: + max: 512M + min: 100M + jvmOpts: -Dcassandra.consistent.rangemovement=false + clusterName: music-cluster + dataCenter: onap-1 + rackName: Rack1 + autoBootstrap: true + ports: + cql: &cqlPort 9042 + thrift: &thriftPort 9160 + # If a JVM Agent is in place + # agent: 61621 + +service: + expose: true + type: ClusterIP + name: &cassandraService music-cassandra + internalPort: *cqlPort + portName: cql + internalPort2: *thriftPort + portName2: thrift + internalPort3: 61621 + portName3: agent + +job: + host: *cassandraService + port: *cqlPort + timeout: 30 + delay: 120 + image: onap/music/cassandra_job:3.0.24 + +cql: + keyspace: + replicationClass: "SimpleStrategy" + replicationFactor: 3 + adminUser: + username: nelson24 + password: nelson24 + passwordReplace: A2C4E6G8I0J2L4O6Q8S0U2W4Y6 + +# probe configuration parameters +liveness: + initialDelaySeconds: 120 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readinessTimeout: 240 + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +podManagementPolicy: OrderedReady +updateStrategy: + type: OnDelete + +ingress: + enabled: false + +tolerations: [] + +persistence: + enabled: true + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + volumeReclaimPolicy: Retain + + ## database data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + ## storageClass: "-" + accessMode: ReadWriteOnce + size: 2Gi + mountPath: /dockerdata-nfs/ + mountSubPath: common/cassandra/data + +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 500m + memory: 1.2Gi + requests: + cpu: 160m + memory: 900Mi + large: + limits: + cpu: 4 + memory: 10Gi + requests: + cpu: 2 + memory: 6Gi + unlimited: {} diff --git a/kubernetes/common/music/requirements.yaml b/kubernetes/common/music/requirements.yaml index f16f6df288..a9566c1811 100644 --- a/kubernetes/common/music/requirements.yaml +++ b/kubernetes/common/music/requirements.yaml @@ -13,6 +13,12 @@ # limitations under the License. dependencies: + - name: music-cassandra + version: ~7.x-0 + repository: 'file://components/music-cassandra' - name: common version: ~7.x-0 repository: 'file://../common' + - name: repositoryGenerator + version: ~7.x-0 + repository: 'file://../repositoryGenerator' diff --git a/kubernetes/common/music/resources/config/logback.xml b/kubernetes/common/music/resources/config/logback.xml new file mode 100755 index 0000000000..51423e547d --- /dev/null +++ b/kubernetes/common/music/resources/config/logback.xml @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %X{keyspace} %msg%n + + + + + + + + + ${logDirectory}/${generalLogName}.log + + ${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log.zip + 1GB + 5 + 5GB + + + ${applicationLoggerPattern} + + + + + 256 + true + + + + + + + + keyspace + unknown + + + + ${logDirectory}/${generalLogName}-keyspace.log + + ${logDirectory}/${generalLogName}-${keyspace}.%d{yyyy-MM-dd}.%i.log.zip + 30 + + + ${applicationLoggerPattern} + + + + + + + 256 + true + + + + + + + + + + + ${logDirectory}/${securityLogName}.log + + ${logDirectory}/${securityLogName}.%i.log.zip + 1 + 9 + + + 5MB + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + 256 + 0 + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.%i.log.zip + 1 + 9 + + + 5MB + + + ${auditLoggerPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + + ${metricsLoggerPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%i.log.zip + 1 + 9 + + + 5MB + + + ${errorLoggerPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.%i.log.zip + 1 + 9 + + + 5MB + + + ${debugLoggerPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kubernetes/common/music/resources/config/music-sb.properties b/kubernetes/common/music/resources/config/music-sb.properties new file mode 100755 index 0000000000..751a351737 --- /dev/null +++ b/kubernetes/common/music/resources/config/music-sb.properties @@ -0,0 +1,13 @@ +server.port=8443 +server.servlet.context-path=/MUSIC/rest +spring.jackson.mapper.ACCEPT_CASE_INSENSITIVE_ENUMS=true +#server.ssl.enabled=false +server.tomcat.max-threads=100 +#logging.file=/opt/app/music/logs/MUSIC/music-app.log +#logging.config=file:/opt/app/music/etc/logback.xml +security.require-ssl=true +server.ssl.key-store=/opt/app/aafcertman/org.onap.music.jks +server.ssl.key-store-password=${KEYSTORE_PASSWORD} +server.ssl.key-store-provider=SUN +server.ssl.key-store-type=JKS + diff --git a/kubernetes/common/music/resources/config/music.properties b/kubernetes/common/music/resources/config/music.properties new file mode 100755 index 0000000000..a7681d0a02 --- /dev/null +++ b/kubernetes/common/music/resources/config/music.properties @@ -0,0 +1,24 @@ +lock.using={{.Values.properties.lockUsing}} +cassandra.host={{.Values.properties.cassandraHost}} +cassandra.port={{ .Values.properties.cassandraPort }} +lock.lease.period={{.Values.properties.lockLeasePeriod}} +cassandra.user=${CASSA_USER} +cassandra.password=${CASSA_PASSWORD} +cassandra.connecttimeoutms={{.Values.properties.cassandraConnecttimeoutms}} +cassandra.readtimeoutms={{.Values.properties.cassandraReadtimeoutms}} +cadi={{.Values.properties.cadi}} +music.aaf.ns={{.Values.properties.musicAafNs}} +keyspace.active={{.Values.properties.keyspaceActive}} +transId.header.required={{.Values.properties.transIdRequired}} +transId.header.prefix={{.Values.properties.transIdPrefix}} +conversation.header.required={{.Values.properties.conversationRequired}} +conversation.header.prefix={{.Values.properties.conversationPrefix}} +clientId.header.required={{.Values.properties.clientIdRequired}} +clientId.header.prefix={{.Values.properties.clientIdPrefix}} +messageId.header.required={{.Values.properties.messageIdRequired}} +messageId.header.prefix={{.Values.properties.messageIdPrefix}} +retry.count={{.Values.properties.retryCount}} +lock.daemon.sleeptime.ms={{.Values.properties.lockDaemonSleeptimeMs}} +keyspaces.for.lock.cleanup={{.Values.properties.keyspaceForLockCleanup}} +create.lock.wait.period.ms=0 +create.lock.wait.increment.ms=0 diff --git a/kubernetes/common/music/resources/config/startup.sh b/kubernetes/common/music/resources/config/startup.sh new file mode 100755 index 0000000000..37bb84de8b --- /dev/null +++ b/kubernetes/common/music/resources/config/startup.sh @@ -0,0 +1,69 @@ +#!/bin/bash +{{/* +# +# ============LICENSE_START========================================== +# org.onap.music +# =================================================================== +# Copyright (c) 2019 AT&T Intellectual Property +# =================================================================== +# 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. +# +# ============LICENSE_END============================================= +# ==================================================================== +*/}} + +echo "Running startup script to get password from certman" +PWFILE=/opt/app/aafcertman/.password +LOGFILE=/opt/app/music/logs/MUSIC/music-sb.log +PROPS=/opt/app/music/etc/music-sb.properties +LOGBACK=/opt/app/music/etc/logback.xml +LOGGING= +DEBUG_PROP= +# Debug Setup. Uses env variables +# DEBUG and DEBUG_PORT +# DEBUG=true/false | DEBUG_PORT= +if [ "${DEBUG}" == "true" ]; then + if [ "${DEBUG_PORT}" == "" ]; then + DEBUG_PORT=8000 + fi + echo "Debug mode on" + DEBUG_PROP="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n" +fi + +# LOGBACK file: if /opt/app/music/etc/logback.xml exists thenuse that. +if [ -f $LOGBACK ]; then + LOGGING="--logging.config=file:${LOGBACK}" +fi + +# Get Passwords from /opt/app/aafcertman +if [ -f $PWFILE ]; then + echo "Found ${PWFILE}" >> $LOGFILE + PASSWORD=$(cat ${PWFILE}) +else + PASSWORD=changeit + echo "#### Using Default Password for Certs" >> ${LOGFILE} +fi + +# If music-sb.properties exists in /opt/app/music/etc then use that to override the application.properties +if [ -f $PROPS ]; then + # Run with different Property file + #echo "java ${DEBUG_PROP} -jar MUSIC.jar --spring.config.location=file:${PROPS} ${LOGGING} 2>&1 | tee ${LOGFILE}" + java ${DEBUG_PROP} ${JAVA_OPTS} -jar MUSIC-SB.jar ${SPRING_OPTS} --spring.config.location=file:${PROPS} ${LOGGING} 2>&1 | tee ${LOGFILE} +else + #echo "java ${DEBUG_PROP} -jar MUSIC.jar --server.ssl.key-store-password=${PASSWORD} ${LOGGING} 2>&1 | tee ${LOGFILE}" + java ${DEBUG_PROP} ${JAVA_OPTS} -jar MUSIC-SB.jar ${SPRING_OPTS} --server.ssl.key-store-password="${PASSWORD}" ${LOGGING} 2>&1 | tee ${LOGFILE} +fi + + + + diff --git a/kubernetes/common/music/resources/keys/org.onap.music.jks b/kubernetes/common/music/resources/keys/org.onap.music.jks new file mode 100644 index 0000000000..35d27c3ef7 Binary files /dev/null and b/kubernetes/common/music/resources/keys/org.onap.music.jks differ diff --git a/kubernetes/common/music/resources/keys/truststoreONAPall.jks b/kubernetes/common/music/resources/keys/truststoreONAPall.jks new file mode 100644 index 0000000000..ff844b109d Binary files /dev/null and b/kubernetes/common/music/resources/keys/truststoreONAPall.jks differ diff --git a/kubernetes/common/music/templates/configmap.yaml b/kubernetes/common/music/templates/configmap.yaml new file mode 100644 index 0000000000..d42cf2e7e0 --- /dev/null +++ b/kubernetes/common/music/templates/configmap.yaml @@ -0,0 +1,21 @@ +{{/* +# Copyright © 2017-2020 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. +*/}} + +apiVersion: v1 +kind: ConfigMap +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/music/templates/deployment.yaml b/kubernetes/common/music/templates/deployment.yaml new file mode 100644 index 0000000000..cf0ce8f899 --- /dev/null +++ b/kubernetes/common/music/templates/deployment.yaml @@ -0,0 +1,121 @@ +{{/* +# Copyright © 2017-2020 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. +*/}} + +apiVersion: apps/v1 +kind: Deployment +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} +spec: + selector: {{- include "common.selectors" . | nindent 4 }} + replicas: {{ .Values.replicaCount }} + template: + metadata: {{- include "common.templateMetadata" . | nindent 6 }} + spec: + initContainers: + - name: {{ include "common.name" . }}-cassandra-readiness + image: {{ include "repositoryGenerator.image.readiness" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /app/ready.py + args: + - -j + - "{{ include "common.release" . }}-music-cassandra-config" + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - command: + - sh + args: + - -c + - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" + env: + - name: KEYSTORE_PASSWORD + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-keystore-pw" "key" "password") | indent 12}} + - name: CASSA_USER + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "login") | indent 12 }} + - name: CASSA_PASSWORD + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "password") | indent 12 }} + volumeMounts: + - mountPath: /config-input + name: properties-music-scrubbed + - mountPath: /config + name: properties-music + image: {{ include "repositoryGenerator.image.envsubst" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-update-config + containers: + # MUSIC Container + - name: "{{ include "common.name" . }}-springboot" + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: {{ include "common.containerPorts" . | nindent 12 }} + # 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.liveness.port }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{ end -}} + readinessProbe: + tcpSocket: + port: {{ .Values.readiness.port }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + resources: +{{ include "common.resources" . | indent 12 }} + env: + - name: SPRING_OPTS + value: "{{ .Values.springOpts }}" + - name: JAVA_OPTS + value: "{{ .Values.javaOpts }}" + - name: DEBUG + value: "{{ .Values.debug }}" + volumeMounts: + - name: localtime + mountPath: /etc/localtime + readOnly: true + - name: properties-music + mountPath: /opt/app/music/etc/music.properties + subPath: music.properties + - name: properties-music + mountPath: /opt/app/music/etc/music-sb.properties + subPath: music-sb.properties + - name: properties-music-scrubbed + mountPath: /opt/app/music/etc/logback.xml + subPath: logback.xml + - name: certs-aaf + mountPath: /opt/app/aafcertman/ + volumes: + - name: shared-data + emptyDir: {} + - name: certificate-vol + emptyDir: {} + - name: localtime + hostPath: + path: /etc/localtime + - name: properties-music-scrubbed + configMap: + name: {{ include "common.fullname" . }} + - name: properties-music + emptyDir: + medium: Memory + - name: certs-aaf + secret: + secretName: {{ include "common.secret.getSecretNameFast" (dict "global" . "uid" "music-certs") }} diff --git a/kubernetes/common/music/templates/secrets.yaml b/kubernetes/common/music/templates/secrets.yaml new file mode 100644 index 0000000000..15791a85d7 --- /dev/null +++ b/kubernetes/common/music/templates/secrets.yaml @@ -0,0 +1,17 @@ +{{/* +# Copyright © 2020 AT&T, 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. +*/}} + +{{ include "common.secretFast" . }} diff --git a/kubernetes/common/music/templates/service.yaml b/kubernetes/common/music/templates/service.yaml new file mode 100644 index 0000000000..3bd32a9419 --- /dev/null +++ b/kubernetes/common/music/templates/service.yaml @@ -0,0 +1,17 @@ +{{/* +# Copyright © 2017-2020 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. +*/}} + +{{ include "common.service" . }} diff --git a/kubernetes/common/music/values.yaml b/kubernetes/common/music/values.yaml index 7e89b02e02..31df352de7 100644 --- a/kubernetes/common/music/values.yaml +++ b/kubernetes/common/music/values.yaml @@ -17,17 +17,45 @@ ################################################################# global: nodePortPrefix: 302 - repository: nexus3.onap.org:10001 + nodePortPrefixExt: 304 + truststore: truststoreONAPall.jks - readinessImage: onap/oom/readiness:3.0.1 - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 -# flag to enable debugging - application support required -debugEnabled: false +################################################################# +# Secrets metaconfig +################################################################# +secrets: + - uid: music-certs + name: keystore.jks + type: generic + filePaths: + - resources/keys/org.onap.music.jks + - uid: music-keystore-pw + name: keystore-pw + type: password + password: '{{ .Values.keystorePassword }}' + passwordPolicy: required + - uid: cassa-secret + type: basicAuth + login: '{{ .Values.properties.cassandraUser }}' + password: '{{ .Values.properties.cassandraPassword }}' + passwordPolicy: required + + +################################################################# +# Application configuration defaults. +################################################################# +# application image +image: onap/music/music_sb:3.2.40 +pullPolicy: Always + +job: + host: cassandra + port: 9042 + # default number of instances -replicaCount: 3 +replicaCount: 1 nodeSelector: {} @@ -35,15 +63,100 @@ affinity: {} # probe configuration parameters liveness: - initialDelaySeconds: 10 - periodSeconds: 10 + initialDelaySeconds: 30 + periodSeconds: 6 # necessary to disable liveness probe when setting breakpoints # in debugger so K8s doesn't restart unresponsive container - enabled: true + enabled: false + port: 8443 + + +# Java options that need to be passed to jave on CLI +#javaOpts: -Xms256m -Xmx2048m +javaOpts: +# Options that need to be passed to CLI for Sprngboot, pw is a secret passed in through ENV +springOpts: --spring.config.location=file:/opt/app/music/etc/music-sb.properties +# Resource Limit flavor -By Default using small +flavor: large +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 1000m + memory: 1G + requests: + cpu: 300m + memory: 512Mi + large: + limits: + cpu: 1500m + memory: 3Gi + requests: + cpu: 1000m + memory: 2Gi + unlimited: {} readiness: - initialDelaySeconds: 10 - periodSeconds: 10 + initialDelaySeconds: 350 + periodSeconds: 120 + port: 8443 + +service: + useNodePortExt: true + type: NodePort + name: music + ports: + - name: https-api + port: 8443 + nodePort: '07' + +# Turn on Debugging true/false +debug: false +ingress: + enabled: false + +keystorePassword: "ysF9CVS+xvuXr0vf&fRa5lew" + +properties: + lockUsing: "cassandra" + # Comma dilimited list of hosts + cassandraHost: "music-cassandra" + cassandraUser: "nelson24" + cassandraPassword: "nelson24" + cassandraConnecttimeoutms: 12000 + cassandraPort: 9042 + # Connection Timeout for Cassandra in ms + # Read Timeout for Cassandra in ms + cassandraReadtimeoutms: 12000 + keyspaceActive: true + # Enable CADI + cadi: false + # Special headers that may be passed and if they are required. + # With the ability to add a Prefix if required. + transIdRequired: false + transIdPrefix: X-ATT- + conversationRequired: false + conversationPrefix: X-CSI- + clientIdRequired: false + clientIdPrefix: + messageIdRequired: false + messageIdPrefix: + + # sleep time for lock cleanup daemon, negative values turn off daemon +##### Lock settings + retryCount: 3 + lockLeasePeriod: 6000 + # sleep time for lock cleanup daemon, negative values turn off daemon + lockDaemonSleeptimeMs: 30000 + #comma separated list of keyspace names + keyspaceForLockCleanup: -resources: {} +logback: + errorLogLevel: info + securityLogLevel: info + applicationLogLevel: info + metricsLogLevel: info + auditLogLevel: info + # Values must be uppercase: INFO, WARN, CRITICAL,DEBUG etc.. + rootLogLevel: INFO \ No newline at end of file -- cgit 1.2.3-korg