diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-11-19 17:19:06 +0100 |
---|---|---|
committer | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-12-02 09:39:35 +0100 |
commit | 589ecb93f9cd18bd42349243214e965f193c6286 (patch) | |
tree | e213c38554af32d908c722f29757c2d38d4359f4 /kubernetes/common/music/components | |
parent | dd99d982adf86279d73d0db7cde0a728e422133d (diff) |
[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 <sylvain.desbureaux@orange.com>
Change-Id: Icd5caef12b28cbcc246cf30a13426d6eb11cfe20
Diffstat (limited to 'kubernetes/common/music/components')
15 files changed, 673 insertions, 0 deletions
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 <cassandra-n> -n <namespace> 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: <storageClass> + ## 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: {} |