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

[bitnami/Ghost] Correctly handle smtpExistingSecret value #31179

Closed
wants to merge 4 commits into from
Closed
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
8 changes: 6 additions & 2 deletions bitnami/ghost/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 22.1.2 (2024-12-13)
## 22.1.3 (2025-01-07)

* [bitnami/ghost] Release 22.1.2 ([#31038](https://github.com/bitnami/charts/pull/31038))
* [bitnami/Ghost] Correctly handle smtpExistingSecret value ([#31179](https://github.com/bitnami/charts/pull/31179))

## <small>22.1.2 (2024-12-13)</small>

* [bitnami/ghost] Release 22.1.2 (#31038) ([b5d4c51](https://github.com/bitnami/charts/commit/b5d4c5136f4da9c15b23fa036fc2f826f3852adf)), closes [#31038](https://github.com/bitnami/charts/issues/31038)

## <small>22.1.1 (2024-12-11)</small>

Expand Down
2 changes: 1 addition & 1 deletion bitnami/ghost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ maintainers:
name: ghost
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/ghost
version: 22.1.2
version: 22.1.3
11 changes: 11 additions & 0 deletions bitnami/ghost/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ Return the MySQL Secret Name
{{- end -}}
{{- end -}}

{{/*
Return the SMTP Secret Name
*/}}
{{- define "ghost.smtpSecretName" -}}
{{- if .Values.smtpExistingSecret }}
{{- printf "%s" .Values.smtpExistingSecret -}}
{{- else -}}
{{- printf "%s-smtp" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Compile all warnings into a single message.
*/}}
Expand Down
6 changes: 2 additions & 4 deletions bitnami/ghost/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,11 @@ spec:
- name: GHOST_SMTP_USER
value: {{ .Values.smtpUser | quote }}
{{- end }}
{{- if .Values.smtpPassword }}
Copy link
Contributor

@alvneiayu alvneiayu Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, the pipelines are failing because you need to keep this. If not you are deploying a deployment trying to get a secret without the key smtp-password because is empty

- name: GHOST_SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "smtp-password") }}
{{- end }}
name: {{ include "ghost.smtpSecretName" . }}
key: smtp-password
{{- if .Values.smtpService }}
- name: GHOST_SMTP_SERVICE
value: {{ .Values.smtpService | quote }}
Expand Down
20 changes: 17 additions & 3 deletions bitnami/ghost/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if or (not .Values.existingSecret) (and (not .Values.smtpExistingSecret) .Values.smtpPassword) }}
{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -22,9 +22,23 @@ data:
ghost-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end }}
{{- if and .Values.smtpPassword (not .Values.smtpExistingSecret) }}
---
{{- end }}

{{- if not .Values.smtpExistingSecret }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to check here the smtpPassword, you are creating an empty secret without data in this case.

apiVersion: v1
kind: Secret
metadata:
name: {{ template "common.names.fullname" . }}-smtp
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- if .Values.smtpPassword }}
smtp-password: {{ .Values.smtpPassword | b64enc | quote }}
{{- end }}
{{- end }}
---
{{- end }}
Loading