mirror of
https://gitea.com/gitea/helm-actions.git
synced 2026-04-05 01:00:48 +00:00
<!-- Before you open the request please review the following guidelines and tips to help it be more easily integrated: - Describe the scope of your change - i.e. what the change does. - Describe any known limitations with your change. - Please run any tests or examples that can exercise your modified code. Thank you for contributing! We will try to review, test and integrate the change as soon as we can. --> ### Description of the change Introducing use of the `tpl` function into _"gitea.actions.local_root_url"_ (in `_helpers.tpl`) so templating into the `giteaRootURL` parameter can be interpreted. Hence, it will permit the use of values already set in other parameters. ### Benefits To allow in an umbrella chart referencing to other values for setting the Gitea Root URL ### Possible drawbacks <!-- Describe any known limitations with your change --> ### Applicable issues <!-- Enter any applicable Issues here (You can reference an issue using #). Please remove this section if there is no referenced issue. --> - Fixes # ### Additional information <!-- If there's anything else that's important and relevant to your pull request, mention that information here. Please remove this section if it remains empty. --> ### ⚠ BREAKING - N/A ### Checklist <!-- [Place an '[X]' (no spaces) in all applicable fields. Please remove unrelated fields.] --> - [x] Helm templating unittests are added (required when changing anything in `templates` folder) Co-authored-by: 212597596 <cedric.henry@gevernova.com> Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/74 Reviewed-by: DaanSelen <daanselen@noreply.gitea.com> Co-authored-by: Ceddaerrix <ceddaerrix@noreply.gitea.com> Co-committed-by: Ceddaerrix <ceddaerrix@noreply.gitea.com>
131 lines
4.0 KiB
Smarty
131 lines
4.0 KiB
Smarty
{{/* vim: set filetype=mustache: */}}
|
|
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
|
|
{{- define "gitea.actions.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 "gitea.actions.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 a default worker name.
|
|
*/}}
|
|
{{- define "gitea.actions.workername" -}}
|
|
{{- printf "%s-%s" .global.Release.Name .worker | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "gitea.actions.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Storage Class
|
|
*/}}
|
|
{{- define "gitea.actions.persistence.storageClass" -}}
|
|
{{- $storageClass := default (tpl ( default "" .Values.global.storageClass) .) }}
|
|
{{- if $storageClass }}
|
|
storageClassName: {{ $storageClass | quote }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "gitea.actions.labels" -}}
|
|
helm.sh/chart: {{ include "gitea.actions.chart" . }}
|
|
app: {{ include "gitea.actions.name" . }}
|
|
{{ include "gitea.actions.selectorLabels" . }}
|
|
app.kubernetes.io/version: {{ default .Chart.AppVersion | quote }}
|
|
version: {{ default .Chart.AppVersion | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end -}}
|
|
|
|
{{- define "gitea.actions.labels.actRunner" -}}
|
|
helm.sh/chart: {{ include "gitea.actions.chart" . }}
|
|
app: {{ include "gitea.actions.name" . }}-act-runner
|
|
{{ include "gitea.actions.selectorLabels.actRunner" . }}
|
|
app.kubernetes.io/version: {{ default .Chart.AppVersion | quote }}
|
|
version: {{ default .Chart.AppVersion | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "gitea.actions.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "gitea.actions.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end -}}
|
|
|
|
{{- define "gitea.actions.selectorLabels.actRunner" -}}
|
|
app.kubernetes.io/name: {{ include "gitea.actions.name" . }}-act-runner
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end -}}
|
|
|
|
{{- define "gitea.actions.local_root_url" -}}
|
|
{{- tpl .Values.giteaRootURL . -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Common create image implementation
|
|
*/}}
|
|
{{- define "gitea.actions.common.image" -}}
|
|
{{- $fullOverride := .image.fullOverride | default "" -}}
|
|
{{- $registry := .root.Values.global.imageRegistry | default .image.registry -}}
|
|
{{- $repository := .image.repository -}}
|
|
{{- $separator := ":" -}}
|
|
{{- $tag := .image.tag | default .root.Chart.AppVersion | toString -}}
|
|
{{- $digest := "" -}}
|
|
{{- if .image.digest }}
|
|
{{- $digest = (printf "@%s" (.image.digest | toString)) -}}
|
|
{{- end -}}
|
|
{{- if $fullOverride }}
|
|
{{- printf "%s" $fullOverride -}}
|
|
{{- else if $registry }}
|
|
{{- printf "%s/%s%s%s%s" $registry $repository $separator $tag $digest -}}
|
|
{{- else -}}
|
|
{{- printf "%s%s%s%s" $repository $separator $tag $digest -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create image for the Gitea Actions Act Runner
|
|
*/}}
|
|
{{- define "gitea.actions.actRunner.image" -}}
|
|
{{ include "gitea.actions.common.image" (dict "root" . "image" .Values.statefulset.actRunner) }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create image for DinD
|
|
*/}}
|
|
{{- define "gitea.actions.dind.image" -}}
|
|
{{ include "gitea.actions.common.image" (dict "root" . "image" .Values.statefulset.dind) }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create image for Init
|
|
*/}}
|
|
{{- define "gitea.actions.init.image" -}}
|
|
{{ include "gitea.actions.common.image" (dict "root" . "image" .Values.init.image) }}
|
|
{{- end -}} |