templates/_helpers.tpl を更新

This commit is contained in:
2025-11-20 07:54:48 +00:00
parent 6e6c1316f7
commit c93e94ac14

View File

@@ -1,27 +1,49 @@
{{/* Return chart name (Chart.yaml:name) */}}
{{- define "chart.name" -}}
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{/*
Expand the name of the chart.
*/}}
{{- define "wordpress-nginx.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/* Return full release name (Release-ChartName) */}}
{{- define "chart.fullname" -}}
{{/*
Create a default fully qualified app name.
*/}}
{{- define "wordpress-nginx.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name (include "chart.name" .) | trunc 63 | trimSuffix "-" }}
{{- $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 }}
{{/* Standard labels */}}
{{- define "chart.labels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | default "latest" }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "wordpress-nginx.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "wordpress-nginx.labels" -}}
helm.sh/chart: {{ include "wordpress-nginx.chart" . }}
{{ include "wordpress-nginx.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/* Selector labels */}}
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
{{/*
Selector labels
*/}}
{{- define "wordpress-nginx.selectorLabels" -}}
app.kubernetes.io/name: {{ include "wordpress-nginx.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}