Files
cloud-host/backend/helm/cloudhost-platform/templates/_helpers.tpl
T
keyhan bf9e827f85 Add cloudhost-platform Helm chart and registry ingress manifests.
Deploy backend, frontend, PostgreSQL, and Redis on Kubernetes with optional Ingress/TLS, SQL migration hooks, and public registry exposure at repo.3fase.ir.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 19:01:05 +03:30

97 lines
3.3 KiB
Smarty

{{- define "cloudhost-platform.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "cloudhost-platform.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- define "cloudhost-platform.namespace" -}}
{{- .Values.namespace | default "cloudhost" }}
{{- end }}
{{- define "cloudhost-platform.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}
{{- end }}
{{- define "cloudhost-platform.labels" -}}
helm.sh/chart: {{ include "cloudhost-platform.chart" . }}
{{ include "cloudhost-platform.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "cloudhost-platform.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cloudhost-platform.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "cloudhost-platform.postgres.fullname" -}}
{{- printf "%s-postgres" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- define "cloudhost-platform.redis.fullname" -}}
{{- printf "%s-redis" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- define "cloudhost-platform.backend.fullname" -}}
{{- printf "%s-backend" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- define "cloudhost-platform.frontend.fullname" -}}
{{- printf "%s-frontend" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- define "cloudhost-platform.secretName" -}}
{{- printf "%s-secrets" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- define "cloudhost-platform.tlsSecretName" -}}
{{- if .Values.ingress.tls.secretName }}
{{- .Values.ingress.tls.secretName }}
{{- else }}
{{- printf "%s-platform-tls" (include "cloudhost-platform.fullname" .) }}
{{- end }}
{{- end }}
{{- define "cloudhost-platform.urlScheme" -}}
{{- if and .Values.ingress.enabled .Values.ingress.tls.enabled }}https{{- else }}http{{- end }}
{{- end }}
{{- define "cloudhost-platform.frontendPublicUrl" -}}
{{- $scheme := include "cloudhost-platform.urlScheme" . -}}
{{- if .Values.ingress.enabled }}
{{- if .Values.ingress.singleHost.enabled }}
{{- printf "%s://%s" $scheme .Values.ingress.singleHost.host }}
{{- else }}
{{- printf "%s://%s" $scheme .Values.ingress.frontend.host }}
{{- end }}
{{- else }}
{{- printf "http://%s-frontend.%s.svc.cluster.local:3000" (include "cloudhost-platform.fullname" .) (include "cloudhost-platform.namespace" .) }}
{{- end }}
{{- end }}
{{- define "cloudhost-platform.apiPublicUrl" -}}
{{- $scheme := include "cloudhost-platform.urlScheme" . -}}
{{- if .Values.ingress.enabled }}
{{- if .Values.ingress.singleHost.enabled }}
{{- printf "%s://%s%s" $scheme .Values.ingress.singleHost.host .Values.ingress.singleHost.apiPath }}
{{- else }}
{{- printf "%s://%s" $scheme .Values.ingress.api.host }}
{{- end }}
{{- else }}
{{- printf "http://%s-backend.%s.svc.cluster.local:4000" (include "cloudhost-platform.fullname" .) (include "cloudhost-platform.namespace" .) }}
{{- end }}
{{- end }}
{{- define "cloudhost-platform.backendImage" -}}
{{- printf "%s:%s" .Values.images.backend.repository .Values.images.backend.tag }}
{{- end }}
{{- define "cloudhost-platform.frontendImage" -}}
{{- printf "%s:%s" .Values.images.frontend.repository .Values.images.frontend.tag }}
{{- end }}