diff options
author | Mike Elliott <mike.elliott@amdocs.com> | 2018-02-12 15:54:03 -0500 |
---|---|---|
committer | Mike Elliott <mike.elliott@amdocs.com> | 2018-02-23 15:09:17 -0500 |
commit | d32d36e3219cc0f17e2fe81e6ac50866e4025140 (patch) | |
tree | e30ef0e7c453a1b5e6a4d0c4b0f6eca9fa5a31fe /kubernetes/so/charts/mariadb/templates | |
parent | a70775c54d244fe769293ea3bba1d99881416e6e (diff) |
Add standardized helm chart for so
This is a standardization (based on helm community best practices)
of a Helm chart for the Service Orchestrator (so) in ONAP.
How to deploy the so chart (outside of the parent onap chart) from
the local oom/kubernetes codebase.
** need to create/update dependencies defined in the chart's
** requirements.yaml
helm dep update so/
** deploy the so helm chart with the "release" name of 'onap'
helm install so/ -n onap
Change-Id: I22471eb9fe0dec32941e14dc63857222c80ebe20
Issue-ID: OOM-727
Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
Diffstat (limited to 'kubernetes/so/charts/mariadb/templates')
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/NOTES.txt | 19 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/clusterrolebinding.yaml | 19 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/configmap.yaml | 63 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/deployment.yaml | 118 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/pv.yaml | 20 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/pvc.yaml | 29 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/secrets.yaml | 27 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/service.yaml | 24 |
8 files changed, 319 insertions, 0 deletions
diff --git a/kubernetes/so/charts/mariadb/templates/NOTES.txt b/kubernetes/so/charts/mariadb/templates/NOTES.txt new file mode 100644 index 0000000000..c1f5d13859 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ include "common.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "common.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/so/charts/mariadb/templates/clusterrolebinding.yaml b/kubernetes/so/charts/mariadb/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..a1ff116614 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ + +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +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 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: default + namespace: {{ include "common.namespace" . }}
\ No newline at end of file diff --git a/kubernetes/so/charts/mariadb/templates/configmap.yaml b/kubernetes/so/charts/mariadb/templates/configmap.yaml new file mode 100644 index 0000000000..e70563a379 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/configmap.yaml @@ -0,0 +1,63 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: confd-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: docker-entry-initd-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: automated-tests-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/automated-tests/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: bulkload-default-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/default/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: demo-dns-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/demo-dns/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: demo-vfw-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/demo-vfw/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: scripts-camunda-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/camunda/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: main-schemas-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/db-sql-scripts/main-schemas/*").AsConfig . | indent 2 }} diff --git a/kubernetes/so/charts/mariadb/templates/deployment.yaml b/kubernetes/so/charts/mariadb/templates/deployment.yaml new file mode 100644 index 0000000000..14654dc24a --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/deployment.yaml @@ -0,0 +1,118 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + hostname: mariadb + containers: + - name: {{ .Chart.Name }} + image: {{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{end -}} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + volumeMounts: + - mountPath: /var/lib/mysql + name: mariadb-data + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /etc/mysql/conf.d + name: mariadb-conf + - mountPath: /docker-entrypoint-initdb.d/02-load-additional-changes.sh + name: mariadb-docker-entrypoint-initdb + subPath: 02-load-additional-changes.sh + - mountPath: /docker-entrypoint-initdb.d/01-load-default-sql-files.sh + name: mariadb-docker-entrypoint-initdb + subPath: 01-load-default-sql-files.sh + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/automated-tests + name: mariadb-docker-entrypoint-automated-tests + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/default + name: mariadb-docker-entrypoint-bulkload-default + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/demo-dns + name: mariadb-docker-entrypoint-demo-dns + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/demo-vfw + name: mariadb-docker-entrypoint-demo-vfw + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/camunda + name: mariadb-docker-entrypoint-camunda + - mountPath: /docker-entrypoint-initdb.d/db-sql-scripts/main-schemas + name: mariadb-docker-entrypoint-main-schemas + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + {{- if .Values.persistence.enabled }} + - name: mariadb-data + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + - name: mariadb-conf + configMap: + name: confd-configmap + - name: mariadb-docker-entrypoint-initdb + configMap: + name: docker-entry-initd-configmap + - name: mariadb-docker-entrypoint-automated-tests + configMap: + name: automated-tests-configmap + - name: mariadb-docker-entrypoint-bulkload-default + configMap: + name: bulkload-default-configmap + - name: mariadb-docker-entrypoint-demo-dns + configMap: + name: demo-dns-configmap + - name: mariadb-docker-entrypoint-demo-vfw + configMap: + name: demo-vfw-configmap + - name: mariadb-docker-entrypoint-camunda + configMap: + name: scripts-camunda-configmap + - name: mariadb-docker-entrypoint-main-schemas + configMap: + name: main-schemas-configmap + - name: localtime + hostPath: + path: /etc/localtime + imagePullSecrets: + - name: "{{ include "common.name" . }}-docker-registry-key" diff --git a/kubernetes/so/charts/mariadb/templates/pv.yaml b/kubernetes/so/charts/mariadb/templates/pv.yaml new file mode 100644 index 0000000000..e03879f119 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/pv.yaml @@ -0,0 +1,20 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolume +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} +{{- end -}}
\ No newline at end of file diff --git a/kubernetes/so/charts/mariadb/templates/pvc.yaml b/kubernetes/so/charts/mariadb/templates/pvc.yaml new file mode 100644 index 0000000000..4a15577687 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/pvc.yaml @@ -0,0 +1,29 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} diff --git a/kubernetes/so/charts/mariadb/templates/secrets.yaml b/kubernetes/so/charts/mariadb/templates/secrets.yaml new file mode 100644 index 0000000000..2d2d33547a --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/secrets.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + db-root-password: {{ .Values.config.mariadbRootPassword | b64enc | quote }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.name" . }}-docker-registry-key + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + .dockercfg: {{ .Values.global.repositorySecret | default .Values.repositorySecret }} +type: kubernetes.io/dockercfg
\ No newline at end of file diff --git a/kubernetes/so/charts/mariadb/templates/service.yaml b/kubernetes/so/charts/mariadb/templates/service.yaml new file mode 100644 index 0000000000..0a040bcab5 --- /dev/null +++ b/kubernetes/so/charts/mariadb/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +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: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.externalPort }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + {{- end}} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }}
\ No newline at end of file |