From c3791c6003d4c53e3789efa61f42fd777905deb6 Mon Sep 17 00:00:00 2001 From: Pramod Date: Wed, 14 Aug 2019 16:24:01 -0700 Subject: Adding Helm charts of Multicloud-K8s To have seperate copy for ONAP4K8s Issue-ID: MULTICLOUD-771 Signed-off-by: Pramod Change-Id: Ie6bbb17370253f0a115502694b8579b46366d241 --- .../charts/mongo/templates/nfs-provisoner.yaml | 78 ++++++++++++++++ .../helm/onap4k8s/charts/mongo/templates/pv.yaml | 38 ++++++++ .../helm/onap4k8s/charts/mongo/templates/pvc.yaml | 43 +++++++++ .../onap4k8s/charts/mongo/templates/service.yaml | 97 +++++++++++++++++++ .../charts/mongo/templates/statefulset.yaml | 104 +++++++++++++++++++++ .../charts/mongo/templates/storageclass.yaml | 24 +++++ 6 files changed, 384 insertions(+) create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/nfs-provisoner.yaml create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/pv.yaml create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/pvc.yaml create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/service.yaml create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/statefulset.yaml create mode 100644 deployments/helm/onap4k8s/charts/mongo/templates/storageclass.yaml (limited to 'deployments/helm/onap4k8s/charts/mongo/templates') diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/nfs-provisoner.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/nfs-provisoner.yaml new file mode 100644 index 00000000..355ad382 --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/nfs-provisoner.yaml @@ -0,0 +1,78 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{ if not .Values.disableNfsProvisioner }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + #replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate + template: + metadata: + labels: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + image: "{{ .Values.global.nfsprovisionerRepository | default .Values.nfsprovisionerRepository }}/{{ .Values.nfsprovisionerImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - name: nfs + containerPort: {{ .Values.service.nfsPort }} + - name: mountd + containerPort: {{ .Values.service.mountdPort }} + - name: rpcbind + containerPort: {{ .Values.service.rpcbindPort }} + - name: rpcbind-udp + containerPort: {{ .Values.service.rpcbindUdpPort }} + protocol: UDP + securityContext: + capabilities: + add: + - DAC_READ_SEARCH + - SYS_RESOURCE + args: + - "-provisioner={{ include "common.fullname" . }}/nfs" + env: + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: SERVICE_NAME + value: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - name: export-volume + mountPath: /export + volumes: + - name: export-volume + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} +{{ end }} diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/pv.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/pv.yaml new file mode 100644 index 00000000..824dcbb8 --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/pv.yaml @@ -0,0 +1,38 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{- if (and (and (.Values.persistence.enabled) (not .Values.persistence.existingClaim)) ( .Values.disableNfsProvisioner)) -}} +kind: PersistentVolume +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + name: {{ include "common.fullname" . }} +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + storageClassName: "{{ include "common.fullname" . }}-data" + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} +{{- end -}} diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/pvc.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/pvc.yaml new file mode 100644 index 00000000..372c1068 --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/pvc.yaml @@ -0,0 +1,43 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + name: {{ include "common.fullname" . }} +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + selector: + matchLabels: + name: {{ include "common.fullname" . }} + storageClassName: "{{ include "common.fullname" . }}-data" +{{- end -}} diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/service.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/service.yaml new file mode 100644 index 00000000..df55854e --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/service.yaml @@ -0,0 +1,97 @@ +{{/* +# Copyright © 2018 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: v1 +kind: Service +metadata: + name: {{ include "common.servicename" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + clusterIP: None +#{{ if not .Values.disableNfsProvisioner }} +--- +kind: Service +apiVersion: v1 +metadata: + name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + namespace: {{ include "common.namespace" . }} + labels: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner +spec: + ports: + - name: nfs + port: {{ .Values.service.nfsPort }} + - name: mountd + port: {{ .Values.service.mountdPort }} + - name: rpcbind + port: {{ .Values.service.rpcbindPort }} + - name: rpcbind-udp + port: {{ .Values.service.rpcbindUdpPort }} + protocol: UDP + selector: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner +#{{ end }} +--- +# Client service for connecting to any Mongo instance for reads. +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename" . }}-read + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} +--- +{{ if .Values.geoEnabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename" . }}-nodeport + namespace: {{ include "common.namespace" . }} + labels: + statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0 +spec: + ports: + - name: {{ .Values.service.internalPort }} + port: {{ .Values.service.internalPort }} + targetPort: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort1 }} + - name: {{ .Values.xtrabackup.internalPort }} + port: {{ .Values.xtrabackup.internalPort }} + targetPort: {{ .Values.xtrabackup.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort2 }} + type: NodePort + selector: + statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0 + release: {{ .Release.Name }} +{{ end }} diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/statefulset.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/statefulset.yaml new file mode 100644 index 00000000..c79739f5 --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/statefulset.yaml @@ -0,0 +1,104 @@ +{{/* +# Copyright © 2018 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/v1beta1 +kind: StatefulSet +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + serviceName: {{ .Values.service.name }} + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: +#{{ if not .Values.disableNfsProvisioner }} + - name: {{ include "common.name" . }}-readiness + command: + - /root/ready.py + args: + - --container-name + - {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} +#{{ end }} + + containers: + - name: {{ include "common.name" . }} + image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: MONGO_INITDB_DATABASE + value: "{{ .Values.config.dbName }}" + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} + {{end -}} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + volumeMounts: + - mountPath: /var/lib/mongo + name: {{ include "common.fullname" . }}-data + resources: +{{ include "common.resources" . | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: {{ include "common.fullname" . }}-data +#{{ if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }}-data +#{{ else }} + emptyDir: {} +#{{ end }} diff --git a/deployments/helm/onap4k8s/charts/mongo/templates/storageclass.yaml b/deployments/helm/onap4k8s/charts/mongo/templates/storageclass.yaml new file mode 100644 index 00000000..3cd502ea --- /dev/null +++ b/deployments/helm/onap4k8s/charts/mongo/templates/storageclass.yaml @@ -0,0 +1,24 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{ if not .Values.disableNfsProvisioner }} +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: "{{ include "common.fullname" . }}-data" + namespace: {{ include "common.namespace" . }} +provisioner: {{ include "common.fullname" . }}/nfs +{{ end }} -- cgit 1.2.3-korg