Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #234 - customInit: Can't find config setting #235

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zammad/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: zammad
version: 10.1.0
version: 10.1.1
appVersion: 6.1.0-24
description: Zammad is a web based open source helpdesk/customer support system with many features to manage customer communication via several channels like telephone, facebook, twitter, chat and e-mails.
home: https://zammad.org
Expand Down
32 changes: 16 additions & 16 deletions zammad/templates/configmap-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ metadata:
labels:
{{- include "zammad.labels" . | nindent 4 }}
data:
{{ if .Values.zammadConfig.elasticsearch.initialisation }}
elasticsearch-init: |-
#!/bin/bash
set -e
bundle exec rails r 'Setting.set("es_url", "{{ .Values.zammadConfig.elasticsearch.schema }}://{{ if .Values.zammadConfig.elasticsearch.enabled }}{{ .Release.Name }}-elasticsearch{{ else }}{{ .Values.zammadConfig.elasticsearch.host }}{{ end }}:{{ .Values.zammadConfig.elasticsearch.port }}")'
ELASTICSEARCH_USER=${ELASTICSEARCH_USER:-{{ .Values.zammadConfig.elasticsearch.user }}}
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASSWORD}" ]; then
bundle exec rails r "Setting.set(\"es_user\", \"${ELASTICSEARCH_USER}\")"
bundle exec rails r "Setting.set(\"es_password\", \"${ELASTICSEARCH_PASSWORD}\")"
fi
{{- if and .Values.zammadConfig.elasticsearch.reindex }}
bundle exec rake zammad:searchindex:rebuild
{{ end }}
echo "elasticsearch init complete :)"
{{ end }}
postgresql-init: |-
#!/bin/bash
set -e
Expand All @@ -37,6 +22,21 @@ data:
echo "${AUTOWIZARD_JSON}" | base64 -d > /opt/zammad/var/auto_wizard.json
fi
{{- with .Values.zammadConfig.initContainers.zammad.customInit }}
{{- toYaml . | nindent 4 }}
mgruner marked this conversation as resolved.
Show resolved Hide resolved
{{- . | nindent 4 }}
{{- end }}
echo "zammad init complete :)"
{{ if .Values.zammadConfig.elasticsearch.initialisation }}
elasticsearch-init: |-
#!/bin/bash
set -e
bundle exec rails r 'Setting.set("es_url", "{{ .Values.zammadConfig.elasticsearch.schema }}://{{ if .Values.zammadConfig.elasticsearch.enabled }}{{ .Release.Name }}-elasticsearch{{ else }}{{ .Values.zammadConfig.elasticsearch.host }}{{ end }}:{{ .Values.zammadConfig.elasticsearch.port }}")'
ELASTICSEARCH_USER=${ELASTICSEARCH_USER:-{{ .Values.zammadConfig.elasticsearch.user }}}
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASSWORD}" ]; then
bundle exec rails r "Setting.set(\"es_user\", \"${ELASTICSEARCH_USER}\")"
bundle exec rails r "Setting.set(\"es_password\", \"${ELASTICSEARCH_PASSWORD}\")"
fi
{{- if and .Values.zammadConfig.elasticsearch.reindex }}
bundle exec rake zammad:searchindex:rebuild
{{ end }}
echo "elasticsearch init complete :)"
{{ end }}
38 changes: 22 additions & 16 deletions zammad/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: {{ template "zammad.fullname" . }}-var
mountPath: /opt/zammad/var
{{- end }}
- name: zammad-init
- name: postgresql-init
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
Expand All @@ -81,36 +81,36 @@ spec:
value: "{{ if .Values.zammadConfig.memcached.enabled }}{{ .Release.Name }}-memcached{{ else }}{{ .Values.zammadConfig.memcached.host }}{{ end }}:{{ .Values.zammadConfig.memcached.port }}"
- name: REDIS_URL
value: "redis://:$(REDIS_PASSWORD)@{{ if .Values.zammadConfig.redis.enabled }}{{ .Release.Name }}-redis-master{{ else }}{{ .Values.zammadConfig.redis.host }}{{ end }}:{{ .Values.zammadConfig.redis.port }}"
{{- if .Values.autoWizard.enabled }}
- name: AUTOWIZARD_JSON
- name: POSTGRESQL_PASS
valueFrom:
secretKeyRef:
name: {{ template "zammad.autowizardSecretName" . }}
key: {{ .Values.secrets.autowizard.secretKey }}
{{- end }}
name: {{ template "zammad.postgresqlSecretName" . }}
key: {{ .Values.secrets.postgresql.secretKey }}
- name: DATABASE_URL
value: "postgres://{{ .Values.zammadConfig.postgresql.user }}:$(POSTGRESQL_PASS)@{{ if .Values.zammadConfig.postgresql.enabled }}{{ .Release.Name }}-postgresql{{ else }}{{ .Values.zammadConfig.postgresql.host }}{{ end }}:{{ .Values.zammadConfig.postgresql.port }}/{{ .Values.zammadConfig.postgresql.db }}"
{{- if .Values.extraEnv }}
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- end }}
{{- with .Values.zammadConfig.initContainers.zammad.resources }}
{{- with .Values.zammadConfig.initContainers.postgresql.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.zammadConfig.initContainers.zammad.securityContext }}
{{- with .Values.zammadConfig.initContainers.postgresql.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ template "zammad.fullname" . }}-init
mountPath: /docker-entrypoint.sh
readOnly: true
subPath: zammad-init
subPath: postgresql-init
- name: {{ template "zammad.fullname" . }}-tmp
mountPath: /opt/zammad/tmp
- name: {{ template "zammad.fullname" . }}-var
mountPath: /opt/zammad/storage
- name: {{ template "zammad.fullname" . }}-var
mountPath: /opt/zammad/var
- name: postgresql-init
- name: zammad-init
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
Expand All @@ -131,23 +131,29 @@ spec:
name: {{ template "zammad.postgresqlSecretName" . }}
key: {{ .Values.secrets.postgresql.secretKey }}
- name: DATABASE_URL
value: "postgres://{{ .Values.zammadConfig.postgresql.user }}:$(POSTGRESQL_PASS)@{{ if .Values.zammadConfig.postgresql.enabled }}{{ .Release.Name }}-postgresql{{ else }}{{ .Values.zammadConfig.postgresql.host }}{{ end }}:{{ .Values.zammadConfig.postgresql.port }}/{{ .Values.zammadConfig.postgresql.db }}"
value: "postgres://{{ .Values.zammadConfig.postgresql.user }}:$(POSTGRESQL_PASS)@{{ if .Values.zammadConfig.postgresql.enabled }}{{ .Release.Name }}-postgresql{{ else }}{{ .Values.zammadConfig.postgresql.host }}{{ end }}:{{ .Values.zammadConfig.postgresql.port }}/{{ .Values.zammadConfig.postgresql.db }}" {{- if .Values.autoWizard.enabled }}
- name: AUTOWIZARD_JSON
valueFrom:
secretKeyRef:
name: {{ template "zammad.autowizardSecretName" . }}
key: {{ .Values.secrets.autowizard.secretKey }}
{{- end }}
{{- if .Values.extraEnv }}
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- end }}
{{- with .Values.zammadConfig.initContainers.postgresql.resources }}
{{- with .Values.zammadConfig.initContainers.zammad.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.zammadConfig.initContainers.postgresql.securityContext }}
{{- with .Values.zammadConfig.initContainers.zammad.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ template "zammad.fullname" . }}-init
mountPath: /docker-entrypoint.sh
readOnly: true
subPath: postgresql-init
subPath: zammad-init
- name: {{ template "zammad.fullname" . }}-tmp
mountPath: /opt/zammad/tmp
- name: {{ template "zammad.fullname" . }}-var
Expand Down