diff options
author | Mandeep Khinda <mandeep.khinda@amdocs.com> | 2018-04-20 21:02:45 +0000 |
---|---|---|
committer | Mandeep Khinda <mandeep.khinda@amdocs.com> | 2018-05-08 19:41:15 +0000 |
commit | 0fe4eb7bb654a7bdc114775cd941d4f5ab146d08 (patch) | |
tree | c865de1fd1740129f7fb78449700360f6bbc2cc1 /kubernetes/so/charts/mariadb/templates | |
parent | dd56858b505f0a8d35168ed423f7533fbfc6597d (diff) |
reducing configmap for SO
-cloning project files during pod init-phase
-injecting SQL through a shared volume
Issue-ID: OOM-858
Change-Id: Idc845910d5386c3228fb9a557fb3238823242cea
Signed-off-by: Mandeep Khinda <mandeep.khinda@amdocs.com>
Diffstat (limited to 'kubernetes/so/charts/mariadb/templates')
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/configmap.yaml | 58 | ||||
-rw-r--r-- | kubernetes/so/charts/mariadb/templates/deployment.yaml | 156 |
2 files changed, 68 insertions, 146 deletions
diff --git a/kubernetes/so/charts/mariadb/templates/configmap.yaml b/kubernetes/so/charts/mariadb/templates/configmap.yaml index c19e54a38f..3c71619fe7 100644 --- a/kubernetes/so/charts/mariadb/templates/configmap.yaml +++ b/kubernetes/so/charts/mariadb/templates/configmap.yaml @@ -18,60 +18,4 @@ 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 }} +{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }}
\ No newline at end of file diff --git a/kubernetes/so/charts/mariadb/templates/deployment.yaml b/kubernetes/so/charts/mariadb/templates/deployment.yaml index 3e263ce097..c85fe79103 100644 --- a/kubernetes/so/charts/mariadb/templates/deployment.yaml +++ b/kubernetes/so/charts/mariadb/templates/deployment.yaml @@ -31,102 +31,80 @@ spec: release: {{ .Release.Name }} spec: hostname: mariadb + initContainers: + - name: {{ include "common.name" . }}-inject-testlab-project + command: + - /bin/bash + - -c + - > + git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit; + echo "Clone complete. Copying from /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d to /docker-entrypoint-initdb.d"; + cp -rf /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d; + echo "Done."; + image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - name: docker-entrypoint-initdb-d + mountPath: "/docker-entrypoint-initdb.d" containers: - - name: {{ include "common.name" . }} - image: "{{ include "common.repository" . }}/{{ .Values.image }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - ports: - - containerPort: {{ .Values.service.internalPort }} - # disable liveness probe when breakpoints set in debugger - # so K8s doesn't restart unresponsive container - {{- if 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: + - name: {{ include "common.name" . }} + image: "{{ include "common.repository" . }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + {{ 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 + - name: docker-entrypoint-initdb-d + mountPath: "/docker-entrypoint-initdb.d" + resources: {{ toYaml .Values.resources | indent 12 }} - {{- if .Values.nodeSelector }} - nodeSelector: + {{- if .Values.nodeSelector }} + nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} - {{- end -}} - {{- if .Values.affinity }} - affinity: + {{- end -}} + {{- if .Values.affinity }} + affinity: {{ toYaml .Values.affinity | indent 10 }} - {{- end }} + {{- end }} volumes: + - name: mariadb-data {{- if .Values.persistence.enabled }} - - name: mariadb-data - persistentVolumeClaim: - claimName: {{ include "common.fullname" . }} + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }} {{- else }} - emptyDir: {} + 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 + - name: mariadb-conf + configMap: + name: confd-configmap + - name: localtime + hostPath: + path: /etc/localtime + - name: docker-entrypoint-initdb-d + emptyDir: {} imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" |