PSA/helm/templates/_helpers.tpl
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

148 lines
5.3 KiB
Smarty

{{/*
Expand the name of the chart.
*/}}
{{- define "sebastian.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "sebastian.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 "sebastian.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "sebastian.labels" -}}
helm.sh/chart: {{ include "sebastian.chart" . }}
{{ include "sebastian.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "sebastian.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sebastian.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/* Safely check if hostedEnv is enabled.
Returns "true" if hostedEnv exists and is enabled, empty string otherwise. */}}
{{- define "sebastian.hostedEnvEnabled" -}}
{{- if and .Values.hostedEnv .Values.hostedEnv.enabled -}}true{{- end -}}
{{- end }}
{{/* Resolve the correct namespace for the resource.
Returns a trimmed single-line string to avoid newline emission in include sites. */}}
{{- define "sebastian.namespace" -}}{{- if .Values.devEnv.enabled -}}{{- .Values.devEnv.namespace -}}{{- else if (include "sebastian.hostedEnvEnabled" .) -}}{{- .Values.hostedEnv.namespace -}}{{- else -}}{{- .Values.namespace -}}{{- end -}}{{- end }}
{{/* Derive deployment color from release name */}}
{{- define "sebastian.color" -}}
{{- $rn := .Release.Name -}}
{{- if hasSuffix "-blue" $rn -}}blue{{- else if hasSuffix "-green" $rn -}}green{{- else -}}{{- "" -}}{{- end -}}
{{- end }}
{{/* Resolve host for app:
- If release is colored (-blue/-green) and .Values.domainSuffix is set -> <color>.<domainSuffix>
- Else if .Values.host is set -> .Values.host
- Else fallback to .Values.domainSuffix (may be empty) */}}
{{- define "sebastian.resolveHost" -}}
{{- $host := default "" .Values.host -}}
{{- $suffix := default "" .Values.domainSuffix -}}
{{- $color := include "sebastian.color" . -}}
{{- if and $color (ne $color "") (ne $suffix "") -}}
{{- printf "%s.%s" $color $suffix -}}
{{- else if ne $host "" -}}
{{- $host -}}
{{- else -}}
{{- $suffix -}}
{{- end -}}
{{- end }}
{{/* Render GOOGLE_OAUTH_* env vars from gmail_integration config */}}
{{- define "sebastian.googleOAuthEnv" -}}
{{- if and .Values.gmail_integration.enabled .Values.gmail_integration.client_id .Values.gmail_integration.client_secret }}
- name: GOOGLE_OAUTH_CLIENT_ID
value: "{{ .Values.gmail_integration.client_id }}"
- name: GOOGLE_OAUTH_CLIENT_SECRET
value: "{{ .Values.gmail_integration.client_secret }}"
{{- end }}
{{- end }}
{{/* Runtime DB host for workloads that should prefer PgBouncer when it is enabled. */}}
{{- define "sebastian.runtimeDbHost" -}}
{{- if .Values.db.enabled -}}
{{- if and .Values.pgbouncer .Values.pgbouncer.enabled -}}
{{- printf "%s.%s.svc.cluster.local" (.Values.pgbouncer.service.name | default "pgbouncer") (include "sebastian.namespace" .) -}}
{{- else -}}
{{- printf "db.%s.svc.cluster.local" (include "sebastian.namespace" .) -}}
{{- end -}}
{{- else -}}
{{- .Values.config.db.host -}}
{{- end -}}
{{- end }}
{{/* Runtime DB port for workloads that should prefer PgBouncer when it is enabled. */}}
{{- define "sebastian.runtimeDbPort" -}}
{{- if .Values.db.enabled -}}
{{- if and .Values.pgbouncer .Values.pgbouncer.enabled -}}
{{- printf "%v" (.Values.pgbouncer.service.port | default 6432) -}}
{{- else -}}
{{- printf "%v" (.Values.db.service.port | default 5432) -}}
{{- end -}}
{{- else -}}
{{- printf "%v" .Values.config.db.port -}}
{{- end -}}
{{- end }}
{{/*
Render MICROSOFT_OAUTH_* env vars using the microsoft_integration config.
*/}}
{{- define "sebastian.microsoftOAuthEnv" -}}
{{- if and .Values.microsoft_integration.enabled .Values.microsoft_integration.client_id }}
- name: MICROSOFT_OAUTH_CLIENT_ID
value: "{{ .Values.microsoft_integration.client_id }}"
{{- end }}
{{- if and .Values.microsoft_integration.enabled .Values.microsoft_integration.client_secret }}
- name: MICROSOFT_OAUTH_CLIENT_SECRET
value: "{{ .Values.microsoft_integration.client_secret }}"
{{- end }}
{{- end }}
{{/* Render NINJAONE_OAUTH_* env vars from ninjaone_integration config */}}
{{- define "sebastian.ninjaonetOAuthEnv" -}}
{{- if and .Values.ninjaone_integration.enabled .Values.ninjaone_integration.client_id }}
- name: NINJAONE_OAUTH_CLIENT_ID
value: "{{ .Values.ninjaone_integration.client_id }}"
{{- end }}
{{- if and .Values.ninjaone_integration.enabled .Values.ninjaone_integration.client_secret }}
- name: NINJAONE_OAUTH_CLIENT_SECRET
value: "{{ .Values.ninjaone_integration.client_secret }}"
{{- end }}
{{- end }}