Files
yourls/templates/_helpers.tpl
T
claude de1a4144b5
Helm Chart Release / release-chart (push) Successful in 7s
feat: チャートをゼロから再設計(外部DB前提のYOURLS+Nginx構成に作り直し)
旧チャートは存在しないDocker Hubイメージ(yourls/yourls)を参照し、Bitnami MySQL
サブチャートに依存するなど正しく動作しない状態だったため、YOURLS公式イメージ
(docker.io/yourls, container-entrypoint.sh/config-container.php)の実装を確認した上で
WordPressチャートと同一方針(外部DB、emptyDir+PVC分離、fsGroup非root実行、
real IP取得対応)でスクラッチから再構築した。
2026-09-12 07:56:17 +09:00

78 lines
2.3 KiB
Smarty

{{/*
Expand the name of the chart.
*/}}
{{- define "yourls-nginx.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
*/}}
{{- define "yourls-nginx.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "yourls-nginx.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "yourls-nginx.labels" -}}
helm.sh/chart: {{ include "yourls-nginx.chart" . }}
{{ include "yourls-nginx.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "yourls-nginx.selectorLabels" -}}
app.kubernetes.io/name: {{ include "yourls-nginx.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Secret name used for chart-managed credentials.
*/}}
{{- define "yourls-nginx.secretName" -}}
{{- printf "%s-secret" (include "yourls-nginx.fullname" .) }}
{{- end }}
{{/*
Fetch a previously-generated value from the existing chart-managed Secret, if any.
Used so that random values (cookiekey, auto-generated admin password) survive
"helm upgrade" instead of rotating on every release, which would otherwise
invalidate admin login cookies and previously-issued passwords.
Usage: {{ include "yourls-nginx.existingSecretValue" (list . "cookiekey") }}
Returns an empty string on first install (no Secret exists yet) or when
running "helm template" without cluster access.
*/}}
{{- define "yourls-nginx.existingSecretValue" -}}
{{- $ctx := index . 0 -}}
{{- $key := index . 1 -}}
{{- $secret := lookup "v1" "Secret" $ctx.Release.Namespace (include "yourls-nginx.secretName" $ctx) -}}
{{- if $secret -}}
{{- $value := index $secret.data $key -}}
{{- if $value -}}
{{- $value | b64dec -}}
{{- end -}}
{{- end -}}
{{- end }}