feat: 外部Secret連携(extraEnvFrom / extraEnv / SMTP existingSecret)を追加
Helm Chart Release / release-chart (push) Successful in 6s
Helm Chart Release / release-chart (push) Successful in 6s
helmchart/secret-manager が各ネームスペースへ配布する cred-* Secret を WordPress 側から参照できるようにする(phpfpm と同一方針)。 - extraEnvFrom / extraEnv: 既存 Secret/ConfigMap を wordpress コンテナへ env 注入 - smtp.auth.existingSecret / existingSecretKey: パスワードファイルだけ既存 Secret から取得 - smtp.existingMsmtprcSecret / existingMsmtprcSecretKey: 完成済み msmtprc を そのままマウント(指定時は configmap-smtp を生成せず host/port/auth.* は無視) 既定値は全て空のため既存挙動は不変。手動リリース 7.1.0-b。
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{{- if .Values.smtp.enabled }}
|
||||
{{- if and .Values.smtp.enabled (not .Values.smtp.existingMsmtprcSecret) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
|
||||
@@ -321,7 +321,11 @@ spec:
|
||||
sendmail_from = "{{ .Values.smtp.from }}"
|
||||
PHP_SMTP_EOF
|
||||
|
||||
{{- if .Values.smtp.existingMsmtprcSecret }}
|
||||
echo "SMTP configured from existing secret: {{ .Values.smtp.existingMsmtprcSecret }}"
|
||||
{{- else }}
|
||||
echo "SMTP configured: {{ .Values.smtp.host }}:{{ .Values.smtp.port }}"
|
||||
{{- end }}
|
||||
exec php-fpm
|
||||
{{- else }}
|
||||
command: ["php-fpm"]
|
||||
@@ -343,6 +347,13 @@ spec:
|
||||
key: db-password
|
||||
- name: WORDPRESS_TABLE_PREFIX
|
||||
value: {{ .Values.wordpress.tablePrefix | quote }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnvFrom }}
|
||||
envFrom:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: wordpress-data
|
||||
mountPath: /var/www/html
|
||||
@@ -352,7 +363,7 @@ spec:
|
||||
- name: smtp-config
|
||||
mountPath: /etc/smtp-config
|
||||
readOnly: true
|
||||
{{- if .Values.smtp.auth.enabled }}
|
||||
{{- if and .Values.smtp.auth.enabled (not .Values.smtp.existingMsmtprcSecret) }}
|
||||
- name: smtp-secrets
|
||||
mountPath: /etc/smtp-secrets
|
||||
readOnly: true
|
||||
@@ -380,17 +391,26 @@ spec:
|
||||
{{- end }}
|
||||
{{- if .Values.smtp.enabled }}
|
||||
- name: smtp-config
|
||||
{{- if .Values.smtp.existingMsmtprcSecret }}
|
||||
# 完成済み msmtprc を持つ既存 Secret(secret-manager の cred-* 等)を利用
|
||||
secret:
|
||||
secretName: {{ .Values.smtp.existingMsmtprcSecret }}
|
||||
items:
|
||||
- key: {{ .Values.smtp.existingMsmtprcSecretKey | default "msmtprc" }}
|
||||
path: msmtprc
|
||||
{{- else }}
|
||||
configMap:
|
||||
name: {{ include "wordpress-nginx.fullname" . }}-smtp-config
|
||||
items:
|
||||
- key: msmtprc
|
||||
path: msmtprc
|
||||
{{- if .Values.smtp.auth.enabled }}
|
||||
{{- end }}
|
||||
{{- if and .Values.smtp.auth.enabled (not .Values.smtp.existingMsmtprcSecret) }}
|
||||
- name: smtp-secrets
|
||||
secret:
|
||||
secretName: {{ include "wordpress-nginx.fullname" . }}-smtp
|
||||
secretName: {{ .Values.smtp.auth.existingSecret | default (printf "%s-smtp" (include "wordpress-nginx.fullname" .)) }}
|
||||
items:
|
||||
- key: password
|
||||
- key: {{ .Values.smtp.auth.existingSecretKey | default "password" }}
|
||||
path: password
|
||||
# 0600だとSecretボリュームの所有者はroot、
|
||||
# msmtpはPHP-FPMワーカー(www-data等の非root)から実行されるため読めない
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- if .Values.smtp.enabled }}
|
||||
{{- if and .Values.smtp.enabled (not .Values.smtp.existingMsmtprcSecret) (not .Values.smtp.auth.existingSecret) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
|
||||
Reference in New Issue
Block a user