Files
gitks/charts/templates/_helpers.tpl
T
zhenyi c2487ec0b6 feat(charts): add Helm chart for gitks Git bare repository service
- Create Chart.yaml with application metadata and keywords
- Add _helpers.tpl with name, fullname, labels, and DNS template functions
- Generate ConfigMap with all gitks configuration environment variables
- Implement StatefulSet with persistent volume claims for repository data
- Create headless service for pod DNS and cluster communication
- Add gRPC service for client connections and metrics service
- Include HorizontalPodAutoscaler for dynamic scaling
- Add PodDisruptionBudget to maintain cluster availability
- Create ServiceAccount with proper security context
- Add test connection pod using grpcurl for health checks
- Generate NOTES.txt with installation instructions and quick start guide
- Create .helmignore file to exclude common development files
- Configure persistence, resource limits, and security settings
- Add support for cluster mode with etcd service discovery
2026-06-08 21:21:15 +08:00

76 lines
2.0 KiB
Smarty

{{/*
Expand the name of the chart.
*/}}
{{- define "gitks.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
*/}}
{{- define "gitks.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 }}
{{/*
Headless service name (used for StatefulSet pod DNS).
*/}}
{{- define "gitks.headlessServiceName" -}}
{{- printf "%s-headless" (include "gitks.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "gitks.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "gitks.labels" -}}
helm.sh/chart: {{ include "gitks.chart" . }}
{{ include "gitks.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "gitks.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gitks.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "gitks.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gitks.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Pod DNS name template: pod-name.headless-svc.namespace.svc.cluster.local
*/}}
{{- define "gitks.podDnsTemplate" -}}
$(STORAGE_NAME).{{ include "gitks.headlessServiceName" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{- end }}