diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-11-18 21:33:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-11-18 21:33:41 +0000 |
commit | 05b13375638d061cf1e7e7e35b096188680fd699 (patch) | |
tree | 4d815cf92d32f5578335517a356f37e3c368d1e9 /kubernetes/common | |
parent | f7f65516359f45811938296189e8f8ad414b7262 (diff) | |
parent | e4ee7f1be369215e609930f5a885bd04cbe4534d (diff) |
Merge "[COMMON/VID] Modified VID to use Shared DB."
Diffstat (limited to 'kubernetes/common')
-rw-r--r-- | kubernetes/common/mariadb-galera/values.yaml | 8 | ||||
-rw-r--r-- | kubernetes/common/mariadb-init/templates/configmap.yaml | 16 | ||||
-rw-r--r-- | kubernetes/common/mariadb-init/templates/job.yaml | 29 | ||||
-rw-r--r-- | kubernetes/common/mariadb-init/values.yaml | 7 |
4 files changed, 50 insertions, 10 deletions
diff --git a/kubernetes/common/mariadb-galera/values.yaml b/kubernetes/common/mariadb-galera/values.yaml index 8a46098a21..55606ea018 100644 --- a/kubernetes/common/mariadb-galera/values.yaml +++ b/kubernetes/common/mariadb-galera/values.yaml @@ -131,10 +131,10 @@ ingress: ## Configure MariaDB-Galera with a custom my.cnf file ## ref: https://mariadb.com/kb/en/mariadb/configuring-mariadb-with-mycnf/#example-of-configuration-file ## -externalConfig: "" -# externalConfig: |- - # [mysqld] - # innodb_buffer_pool_size=2G +#externalConfig: "" +externalConfig: |- + [mysqld] + lower_case_table_names = 1 #resources: {} # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/kubernetes/common/mariadb-init/templates/configmap.yaml b/kubernetes/common/mariadb-init/templates/configmap.yaml index d021d60b8d..6708efdb60 100644 --- a/kubernetes/common/mariadb-init/templates/configmap.yaml +++ b/kubernetes/common/mariadb-init/templates/configmap.yaml @@ -27,3 +27,19 @@ metadata: heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} +--- +{{ if .Values.dbScript }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-dbscript + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: + db_cmd.sh: | + {{ tpl .Values.dbScript . | indent 4 }} +{{- end }} diff --git a/kubernetes/common/mariadb-init/templates/job.yaml b/kubernetes/common/mariadb-init/templates/job.yaml index cccb118787..fb06568777 100644 --- a/kubernetes/common/mariadb-init/templates/job.yaml +++ b/kubernetes/common/mariadb-init/templates/job.yaml @@ -56,8 +56,11 @@ spec: image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: - - bash - - /db_init/db_init.sh + - /bin/sh + - -c + - | + /db_init/db_init.sh {{ if or .Values.dbScriptConfigMap .Values.dbScript }} && + /db_config/db_cmd.sh{{ end }} env: - name: DB_HOST value: "{{ default .Values.global.mariadbGalera.nameOverride .Values.mariadbGalera.serviceName }}" @@ -82,7 +85,10 @@ spec: readOnly: true - name: mariadb-conf mountPath: /db_init/ - readOnly: true +{{- if or .Values.dbScriptConfigMap .Values.dbScript }} + - name: mariadb-init + mountPath: /db_config/ +{{- end }} resources: {{ include "common.resources" . | indent 12 }} {{- if .Values.nodeSelector }} @@ -94,12 +100,23 @@ spec: {{ toYaml .Values.affinity | indent 10 }} {{- end }} volumes: - - name: mariadb-conf - configMap: - name: {{ include "mariadbInit.configMap" . }} - name: localtime hostPath: path: /etc/localtime +{{- if or .Values.dbScriptConfigMap .Values.dbScript }} + - name: mariadb-init + configMap: +{{- if .Values.dbScriptConfigMap }} + name: {{ tpl .Values.dbScriptConfigMap . }} +{{- else -}} + name: {{ include "common.fullname" . }}-dbscript +{{- end }} + defaultMode: 0755 +{{- end }} + - name: mariadb-conf + configMap: + name: {{ include "mariadbInit.configMap" . }} + defaultMode: 0755 restartPolicy: Never imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/common/mariadb-init/values.yaml b/kubernetes/common/mariadb-init/values.yaml index dd5d208190..42a1513449 100644 --- a/kubernetes/common/mariadb-init/values.yaml +++ b/kubernetes/common/mariadb-init/values.yaml @@ -48,6 +48,13 @@ secrets: image: mariadb:10.1.38 pullPolicy: IfNotPresent +# These two values are used to supply commands that are run after the DB is created. +# Components using the shared DB can either pass a string which has a set of commands +# or a config map that contains a shell script. If both are specified only the config +# map will be executed. For reference, please see the VID components for config map +dbScript: "" +dbScriptConfigMap: "" + # Set it if you want to change the name of the different components # nameOverride: |