2019-02-13 22:22:11 +00:00
|
|
|
{{/* vim: set filetype=mustache: */}}
|
|
|
|
{{/*
|
|
|
|
Expand the name of the chart.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.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 "argo-cd.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 -}}
|
|
|
|
|
2019-11-05 00:17:25 +00:00
|
|
|
{{/*
|
|
|
|
Create controller name and version as used by the chart label.
|
2022-06-16 11:23:38 +00:00
|
|
|
Truncated at 52 chars because StatefulSet label 'controller-revision-hash' is limited
|
|
|
|
to 63 chars and it includes 10 chars of hash and a separating '-'.
|
2019-11-05 00:17:25 +00:00
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.controller.fullname" -}}
|
2022-06-16 11:23:38 +00:00
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.controller.name | trunc 52 | trimSuffix "-" -}}
|
2019-11-05 00:17:25 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create dex name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.dex.fullname" -}}
|
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.dex.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create redis name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.redis.fullname" -}}
|
2021-08-14 11:03:26 +00:00
|
|
|
{{- $redisHa := (index .Values "redis-ha") -}}
|
|
|
|
{{- $redisHaContext := dict "Chart" (dict "Name" "redis-ha") "Release" .Release "Values" $redisHa -}}
|
2020-04-09 16:31:13 +00:00
|
|
|
{{- if $redisHa.enabled -}}
|
|
|
|
{{- if $redisHa.haproxy.enabled -}}
|
2021-08-14 11:03:26 +00:00
|
|
|
{{- printf "%s-haproxy" (include "redis-ha.fullname" $redisHaContext) | trunc 63 | trimSuffix "-" -}}
|
2020-04-09 16:31:13 +00:00
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
2019-11-05 00:17:25 +00:00
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.redis.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
2020-04-09 16:31:13 +00:00
|
|
|
{{- end -}}
|
2019-11-05 00:17:25 +00:00
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create argocd server name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.server.fullname" -}}
|
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.server.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create argocd repo-server name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.repoServer.fullname" -}}
|
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.repoServer.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-03-16 21:01:30 +00:00
|
|
|
{{/*
|
|
|
|
Create argocd application set name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.applicationSet.fullname" -}}
|
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.applicationSet.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create argocd notifications name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.notifications.fullname" -}}
|
|
|
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.notifications.name | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2019-11-05 00:17:25 +00:00
|
|
|
{{/*
|
|
|
|
Create the name of the controller service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.controllerServiceAccountName" -}}
|
|
|
|
{{- if .Values.controller.serviceAccount.create -}}
|
2021-07-12 11:06:50 +00:00
|
|
|
{{ default (include "argo-cd.controller.fullname" .) .Values.controller.serviceAccount.name }}
|
2019-11-05 00:17:25 +00:00
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.controller.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create the name of the dex service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.dexServiceAccountName" -}}
|
|
|
|
{{- if .Values.dex.serviceAccount.create -}}
|
2021-07-12 11:06:50 +00:00
|
|
|
{{ default (include "argo-cd.dex.fullname" .) .Values.dex.serviceAccount.name }}
|
2019-11-05 00:17:25 +00:00
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.dex.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2021-07-12 11:06:50 +00:00
|
|
|
{{/*
|
|
|
|
Create the name of the redis service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.redisServiceAccountName" -}}
|
|
|
|
{{- if .Values.redis.serviceAccount.create -}}
|
|
|
|
{{ default (include "argo-cd.redis.fullname" .) .Values.redis.serviceAccount.name }}
|
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.redis.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2019-11-05 00:17:25 +00:00
|
|
|
{{/*
|
2022-03-16 21:01:30 +00:00
|
|
|
Create the name of the Argo CD server service account to use
|
2019-11-05 00:17:25 +00:00
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.serverServiceAccountName" -}}
|
|
|
|
{{- if .Values.server.serviceAccount.create -}}
|
2021-07-12 11:06:50 +00:00
|
|
|
{{ default (include "argo-cd.server.fullname" .) .Values.server.serviceAccount.name }}
|
2019-11-05 00:17:25 +00:00
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.server.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2019-11-19 23:27:12 +00:00
|
|
|
{{/*
|
|
|
|
Create the name of the repo-server service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.repoServerServiceAccountName" -}}
|
|
|
|
{{- if .Values.repoServer.serviceAccount.create -}}
|
2021-07-12 11:06:50 +00:00
|
|
|
{{ default (include "argo-cd.repoServer.fullname" .) .Values.repoServer.serviceAccount.name }}
|
2019-11-19 23:27:12 +00:00
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.repoServer.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-03-16 21:01:30 +00:00
|
|
|
{{/*
|
|
|
|
Create the name of the application set service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.applicationSetServiceAccountName" -}}
|
|
|
|
{{- if .Values.applicationSet.serviceAccount.create -}}
|
|
|
|
{{ default (include "argo-cd.applicationSet.fullname" .) .Values.applicationSet.serviceAccount.name }}
|
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.applicationSet.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create the name of the notifications service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.notificationsServiceAccountName" -}}
|
|
|
|
{{- if .Values.notifications.serviceAccount.create -}}
|
|
|
|
{{ default (include "argo-cd.notifications.fullname" .) .Values.notifications.serviceAccount.name }}
|
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.notifications.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create the name of the notifications bots slack service account to use
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.notificationsBotsSlackServiceAccountName" -}}
|
|
|
|
{{- if .Values.notifications.bots.slack.serviceAccount.create -}}
|
|
|
|
{{ default (include "argo-cd.notifications.fullname" .) .Values.notifications.bots.slack.serviceAccount.name }}
|
|
|
|
{{- else -}}
|
|
|
|
{{ default "default" .Values.notifications.bots.slack.serviceAccount.name }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2019-02-13 22:22:11 +00:00
|
|
|
{{/*
|
|
|
|
Create chart name and version as used by the chart label.
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.chart" -}}
|
|
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
2021-03-22 20:15:37 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Common labels
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.labels" -}}
|
|
|
|
helm.sh/chart: {{ include "argo-cd.chart" .context }}
|
|
|
|
{{ include "argo-cd.selectorLabels" (dict "context" .context "component" .component "name" .name) }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .context.Release.Service }}
|
|
|
|
app.kubernetes.io/part-of: argocd
|
2021-12-03 22:19:29 +00:00
|
|
|
{{- with .context.Values.global.additionalLabels }}
|
|
|
|
{{ toYaml . }}
|
|
|
|
{{- end }}
|
2021-03-22 20:15:37 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Selector labels
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.selectorLabels" -}}
|
|
|
|
{{- if .name -}}
|
|
|
|
app.kubernetes.io/name: {{ include "argo-cd.name" .context }}-{{ .name }}
|
2021-03-23 12:28:23 +00:00
|
|
|
{{ end -}}
|
2021-03-22 20:15:37 +00:00
|
|
|
app.kubernetes.io/instance: {{ .context.Release.Name }}
|
|
|
|
{{- if .component }}
|
|
|
|
app.kubernetes.io/component: {{ .component }}
|
|
|
|
{{- end }}
|
2021-04-21 19:31:16 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the appropriate apiVersion for ingress
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.ingress.apiVersion" -}}
|
2021-07-09 12:34:09 +00:00
|
|
|
{{- if .Values.apiVersionOverrides.ingress -}}
|
|
|
|
{{- print .Values.apiVersionOverrides.ingress -}}
|
|
|
|
{{- else if semverCompare "<1.14-0" (include "argo-cd.kubeVersion" $) -}}
|
2021-04-21 19:31:16 +00:00
|
|
|
{{- print "extensions/v1beta1" -}}
|
2021-05-23 12:25:26 +00:00
|
|
|
{{- else if semverCompare "<1.19-0" (include "argo-cd.kubeVersion" $) -}}
|
2021-04-21 19:31:16 +00:00
|
|
|
{{- print "networking.k8s.io/v1beta1" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "networking.k8s.io/v1" -}}
|
|
|
|
{{- end -}}
|
2021-05-16 15:32:19 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
2022-07-14 13:02:52 +00:00
|
|
|
{{/*
|
|
|
|
Return the appropriate apiVersion for autoscaling
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.autoscaling.apiVersion" -}}
|
|
|
|
{{- if .Values.apiVersionOverrides.autoscaling -}}
|
|
|
|
{{- print .Values.apiVersionOverrides.autoscaling -}}
|
|
|
|
{{- else if semverCompare "<1.23-0" (include "argo-cd.kubeVersion" $) -}}
|
|
|
|
{{- print "autoscaling/v2beta1" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "autoscaling/v2" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2021-05-23 12:25:26 +00:00
|
|
|
{{/*
|
|
|
|
Return the target Kubernetes version
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.kubeVersion" -}}
|
|
|
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-03-16 21:01:30 +00:00
|
|
|
{{/*
|
2021-05-16 15:32:19 +00:00
|
|
|
Argo Configuration Preset Values (Incluenced by Values configuration)
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.config.presets" -}}
|
|
|
|
{{- if .Values.configs.styles }}
|
|
|
|
ui.cssurl: "./custom/custom.styles.css"
|
|
|
|
{{- end }}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-03-16 21:01:30 +00:00
|
|
|
{{/*
|
2021-05-16 15:32:19 +00:00
|
|
|
Merge Argo Configuration with Preset Configuration
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.config" -}}
|
|
|
|
{{- if .Values.server.configEnabled -}}
|
|
|
|
{{- toYaml (mergeOverwrite (default dict (fromYaml (include "argo-cd.config.presets" $))) .Values.server.config) }}
|
|
|
|
{{- end -}}
|
2021-10-21 20:55:34 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
2022-03-16 21:01:30 +00:00
|
|
|
Return the default Argo CD app version
|
2021-10-21 20:55:34 +00:00
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.defaultTag" -}}
|
|
|
|
{{- default .Chart.AppVersion .Values.global.image.tag }}
|
|
|
|
{{- end -}}
|
2022-03-16 21:01:30 +00:00
|
|
|
|
2022-03-31 12:18:54 +00:00
|
|
|
{{- define "argo-cd.redisPasswordEnv" -}}
|
2022-08-25 11:35:17 +00:00
|
|
|
{{- if or .Values.externalRedis.password .Values.externalRedis.existingSecret -}}
|
2022-03-31 12:18:54 +00:00
|
|
|
- name: REDIS_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2022-08-25 11:35:17 +00:00
|
|
|
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
|
2022-03-31 12:18:54 +00:00
|
|
|
key: redis-password
|
2022-08-25 11:35:17 +00:00
|
|
|
{{- end -}}
|
2022-03-31 12:18:54 +00:00
|
|
|
{{- end -}}
|
2022-05-22 11:51:41 +00:00
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the appropriate apiVersion for pod disruption budget
|
|
|
|
*/}}
|
|
|
|
{{- define "argo-cd.podDisruptionBudget.apiVersion" -}}
|
|
|
|
{{- if semverCompare "<1.21-0" (include "argo-cd.kubeVersion" $) -}}
|
|
|
|
{{- print "policy/v1beta1" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "policy/v1" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|