{{/*
Chart label
*/}}
{{- define "flink-cdc-session.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Fully qualified name: Release.Name (chart name 중복 시 제거)
*/}}
{{- define "flink-cdc-session.fullname" -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
ServiceAccount name
*/}}
{{- define "flink-cdc-session.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "flink-cdc-session.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Truststore secret name
*/}}
{{- define "flink-cdc-session.truststoreSecretName" -}}
{{- default (printf "%s-flink-truststore" (include "flink-cdc-session.fullname" .)) .Values.truststore.secretName }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "flink-cdc-session.labels" -}}
helm.sh/chart: {{ include "flink-cdc-session.chart" . }}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
