add part two

This commit is contained in:
2023-01-31 14:20:06 +07:00
parent d718d71471
commit 60ea87cfe6
153 changed files with 26163 additions and 3 deletions

View File

@@ -0,0 +1,59 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
** Please be patient while the chart is being deployed **
1. Access your Argo CD installation:
{{- if .Values.server.ingress.enabled }}
Connect to one of the following hosts:
{{ if .Values.server.ingress.tls }}
https://{{ .Values.server.ingress.hostname }}
{{- else }}
http://{{ .Values.server.ingress.hostname }}
{{- end }}
{{- else }}
Execute the following commands:
{{- if contains "NodePort" .Values.server.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "argocd.server" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
export URL="http://${NODE_IP}:${NODE_PORT}/"
echo "Argo CD URL: http://$NODE_IP:$NODE_PORT/"
{{- else if contains "LoadBalancer" .Values.server.service.type }}
** Please ensure an external IP is associated to the {{ include "argocd.server" . }} service before proceeding **
** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "argocd.server" . }} **
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "argocd.server" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
{{- $port:=.Values.server.service.ports.http | toString }}
export URL="http://${SERVICE_IP}{{- if ne $port "80" }}:{{ .Values.server.service.ports.http }}{{ end }}"
echo "Argo CD URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.server.service.ports.http }}{{ end }}/"
{{- else if contains "ClusterIP" .Values.server.service.type }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "argocd.server" . }} 8080:{{ .Values.server.service.ports.http }} &
export URL=http://127.0.0.1:8080/
echo "Argo CD URL: http://127.0.0.1:8080/"
{{- end }}
{{- end }}
2. Execute the following commands to obtain the Argo CD credentials:
echo "Username: \"admin\""
echo "Password: $(kubectl -n {{ .Release.Namespace }} get secret argocd-secret -o jsonpath="{.data.clearPassword}" | base64 -d)"
{{- if not .Values.server.configEnabled -}}
WARNING: server.configEnabled is disabled, a config map called "argocd-cm" must exist in your namespace
{{- end -}}
{{- if not .Values.config.createExtraKnownHosts -}}
WARNING: config.createExtraKnownHosts is disabled, a secret called "argocd-ssh-known-hosts-cm" must exist in your namespace
{{- end -}}
{{- include "common.warnings.rollingTag" .Values.image }}
{{- include "common.warnings.rollingTag" .Values.dex.image }}
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
{{- include "argocd.validateValues" . }}

View File

@@ -0,0 +1,284 @@
{{/*
Return the proper Argo CD image name
*/}}
{{- define "argocd.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Dex image name
*/}}
{{- define "argocd.dex.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.dex.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "argocd.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "argocd.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.dex.image .Values.volumePermissions.image) "global" .Values.global) -}}
{{- end -}}
{{/*
Return the proper service name for Argo CD controller
*/}}
{{- define "argocd.application-controller" -}}
{{- printf "%s-app-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Argo CD controller adding the working namespace
*/}}
{{- define "argocd.namespace.application-controller" -}}
{{- printf "%s-app-controller" (include "common.names.fullname.namespace" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Argo CD applicationSet controller
*/}}
{{- define "argocd.applicationSet" -}}
{{- printf "%s-applicationset-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Argo CD server
*/}}
{{- define "argocd.server" -}}
{{- printf "%s-server" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Argo CD server adding the working namespace
*/}}
{{- define "argocd.namespace.server" -}}
{{- printf "%s-server" (include "common.names.fullname.namespace" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Argo CD repo server
*/}}
{{- define "argocd.repo-server" -}}
{{- printf "%s-repo-server" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Return the proper service name for Dex
*/}}
{{- define "argocd.dex" -}}
{{- printf "%s-dex" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{/*
Create a default fully qualified redis name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "argocd.redis.fullname" -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "redis" "chartValues" .Values.redis "context" $) -}}
{{- end -}}
{{/*
Create a default name for known hosts configmap.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "argocd.custom-styles.fullname" -}}
{{- if .Values.config.existingStylesConfigmap -}}
{{- .Values.config.existingStylesConfigmap -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name "custom-styles" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for the Argo CD server
*/}}
{{- define "argocd.server.serviceAccountName" -}}
{{- if .Values.server.serviceAccount.create -}}
{{ default (printf "%s-argocd-server" (include "common.names.fullname" .)) .Values.server.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.server.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for the Argo CD application controller
*/}}
{{- define "argocd.application-controller.serviceAccountName" -}}
{{- if .Values.controller.serviceAccount.create -}}
{{ default (printf "%s-argocd-app-controller" (include "common.names.fullname" .)) .Values.controller.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.controller.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for the Argo CD applicationSet controller
*/}}
{{- define "argocd.applicationSet.serviceAccountName" -}}
{{- if .Values.applicationSet.serviceAccount.create -}}
{{ default (printf "%s-applicationset-controller" (include "common.names.fullname" .)) .Values.applicationSet.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.applicationSet.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for the Argo CD repo server
*/}}
{{- define "argocd.repo-server.serviceAccountName" -}}
{{- if .Values.repoServer.serviceAccount.create -}}
{{ default (printf "%s-argocd-repo-server" (include "common.names.fullname" .)) .Values.repoServer.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.repoServer.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for Dex
*/}}
{{- define "argocd.dex.serviceAccountName" -}}
{{- if .Values.dex.serviceAccount.create -}}
{{ default (printf "%s-dex" (include "common.names.fullname" .)) .Values.dex.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.dex.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{/*
Return the Redis® secret name
*/}}
{{- define "argocd.redis.secretName" -}}
{{- if .Values.redis.enabled }}
{{- if .Values.redis.auth.existingSecret }}
{{- printf "%s" .Values.redis.auth.existingSecret -}}
{{- else -}}
{{- printf "%s" (include "argocd.redis.fullname" .) }}
{{- end -}}
{{- else if .Values.externalRedis.existingSecret }}
{{- printf "%s" .Values.externalRedis.existingSecret -}}
{{- else -}}
{{- printf "%s-redis" (include "argocd.redis.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return the Redis® secret key
*/}}
{{- define "argocd.redis.secretPasswordKey" -}}
{{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }}
{{- .Values.redis.auth.existingSecretPasswordKey | printf "%s" }}
{{- else if and (not .Values.redis.enabled) .Values.externalRedis.existingSecret }}
{{- .Values.externalRedis.existingSecretPasswordKey | printf "%s" }}
{{- else -}}
{{- printf "redis-password" -}}
{{- end -}}
{{- end -}}
{{/*
Return whether Redis® uses password authentication or not
*/}}
{{- define "argocd.redis.auth.enabled" -}}
{{- if or (and .Values.redis.enabled .Values.redis.auth.enabled) (and (not .Values.redis.enabled) (or .Values.externalRedis.password .Values.externalRedis.existingSecret)) }}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Return the Redis® hostname
*/}}
{{- define "argocd.redisHost" -}}
{{- if .Values.redis.enabled }}
{{- printf "%s-master" (include "argocd.redis.fullname" .) -}}
{{- else -}}
{{- required "If the redis dependency is disabled you need to add an external redis host" .Values.externalRedis.host -}}
{{- end -}}
{{- end -}}
{{/*
Return the Redis® port
*/}}
{{- define "argocd.redisPort" -}}
{{- if .Values.redis.enabled }}
{{- .Values.redis.service.port -}}
{{- else -}}
{{- .Values.externalRedis.port -}}
{{- end -}}
{{- end -}}
{{/*
Validate Redis config
*/}}
{{- define "argocd.validateValues.redis" -}}
{{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }}
{{- if not .Values.redis.auth.existingSecretPasswordKey -}}
Argo CD: You need to provide existingSecretPasswordKey when an existingSecret is specified in redis dependency
{{- end -}}
{{- else if and (not .Values.redis.enabled) .Values.externalRedis.existingSecret }}
{{- if not .Values.externalRedis.existingSecretPasswordKey -}}
Argo CD: You need to provide existingSecretPasswordKey when an existingSecret is specified in redis
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Validate external Redis config
*/}}
{{- define "argocd.validateValues.externalRedis" -}}
{{- if not .Values.redis.enabled -}}
Argo CD: If the redis dependency is disabled you need to add an external redis port
{{- end -}}
{{- end -}}
{{/*
Validate Dex config
*/}}
{{- define "argocd.validateValues.dex.config" -}}
{{- if .Values.dex.enabled -}}
{{- if not .Values.server.url -}}
Argo CD: server.url must be set when enabling Dex for SSO. Please add `--set server.url=<your-argo-cd-url>` to the installation parameters.
{{- end -}}
{{- if not (index .Values "server" "config" "dex.config") -}}
Argo CD: server.config.dex\.config must be set when enabling Dex for SSO. Please add `--set server.config.dex\.config=<your-dex-configuration>` to the installation parameters.
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Validate cluster credentials
*/}}
{{- define "argocd.validateValues.clusterCredentials" -}}
{{- range .Values.config.clusterCredentials -}}
{{- if not .name -}}
Argo CD: A valid .name entry is required in all clusterCrendials objects!
{{- end -}}
{{- if not .server -}}
Argo CD: A valid .server entry is required in all clusterCrendials objects!
{{- end -}}
{{- if not .config -}}
Argo CD: A valid .config entry is required in all clusterCrendials objects!
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{- define "argocd.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "argocd.validateValues.dex.config" .) -}}
{{- $messages := append $messages (include "argocd.validateValues.clusterCredentials" .) -}}
{{- $messages := append $messages (include "argocd.validateValues.externalRedis" .) -}}
{{- $messages := append $messages (include "argocd.validateValues.redis" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- end -}}

View File

@@ -0,0 +1,29 @@
{{- if and .Values.rbac.create .Values.controller.clusterAdminAccess }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRole
metadata:
name: {{ include "argocd.namespace.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
{{- if .Values.controller.clusterRoleRules }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.clusterRoleRules "context" $ ) | nindent 2 }}
{{ else }}
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
{{- end }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.rbac.create .Values.controller.clusterAdminAccess }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
name: {{ include "argocd.namespace.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "argocd.namespace.application-controller" . }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.application-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}

View File

@@ -0,0 +1,251 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: controller
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.controller.replicaCount }}
{{- if .Values.controller.updateStrategy }}
strategy: {{- toYaml .Values.controller.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: controller
template:
metadata:
{{- if .Values.controller.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.controller.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: controller
{{- if .Values.controller.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.application-controller.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.controller.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.controller.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.controller.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.controller.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAffinityPreset "component" "controller" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAntiAffinityPreset "component" "controller" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.controller.nodeAffinityPreset.type "key" .Values.controller.nodeAffinityPreset.key "values" .Values.controller.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.controller.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.controller.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.controller.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.controller.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.controller.schedulerName }}
schedulerName: {{ .Values.controller.schedulerName }}
{{- end }}
{{- if .Values.controller.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.controller.shareProcessNamespace }}
{{- end }}
{{- if .Values.controller.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.controller.priorityClassName }}
priorityClassName: {{ .Values.controller.priorityClassName | quote }}
{{- end }}
{{- if .Values.controller.runtimeClassName }}
runtimeClassName: {{ .Values.controller.runtimeClassName }}
{{- end }}
{{- if .Values.controller.podSecurityContext.enabled }}
securityContext: {{- omit .Values.controller.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.redisWait.enabled }}
- name: wait-for-redis
image: {{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.redis.image.pullPolicy | quote }}
{{- with .Values.redisWait.securityContext }}
securityContext: {{ . | toYaml }}
{{- end }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
. /opt/bitnami/scripts/libos.sh
. /opt/bitnami/scripts/liblog.sh
check_redis_connection() {
local result="$(redis-cli -h {{ include "argocd.redisHost" . }} -p {{ include "argocd.redisPort" . }} {{ .Values.redisWait.extraArgs }} PING)"
if [[ "$result" != "PONG" ]]; then
false
fi
}
info "Checking redis connection..."
if ! retry_while "check_redis_connection"; then
error "Could not connect to the Redis server"
return 1
else
info "Connected to the Redis instance"
fi
{{- if include "argocd.redis.auth.enabled" . }}
env:
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- end }}
{{- if .Values.controller.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: controller
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.controller.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.controller.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.controller.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.controller.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.controller.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.controller.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.controller.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.controller.args "context" $) | nindent 12 }}
{{- else }}
args:
- argocd-application-controller
- --status-processors
- {{ .Values.controller.defaultArgs.statusProcessors | quote }}
- --operation-processors
- {{ .Values.controller.defaultArgs.operationProcessors | quote }}
- --app-resync
- {{ .Values.controller.defaultArgs.appResyncPeriod | quote }}
- --self-heal-timeout-seconds
- {{ .Values.controller.defaultArgs.selfHealTimeout | quote }}
- --repo-server
- {{ include "argocd.repo-server" . }}:{{ .Values.repoServer.service.port }}
- --logformat
- {{ .Values.controller.logFormat | quote }}
- --loglevel
- {{ .Values.controller.logLevel | quote }}
# TODO(miguelaeh): Test the chart using redis sentinel enabled: https://github.com/argoproj/argo-cd/blob/2a410187565e15633b6f2a8c8d8da22cf02b257d/util/cache/cache.go#L40
- --redis
- {{ include "argocd.redisHost" . }}:{{ include "argocd.redisPort" . }}
{{- if .Values.controller.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: controller
containerPort: {{ .Values.controller.containerPorts.controller }}
protocol: TCP
- name: metrics
containerPort: {{ .Values.controller.containerPorts.metrics }}
protocol: TCP
env:
{{- if and .Values.redis.enabled (include "argocd.redis.auth.enabled" .) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- if .Values.controller.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.controller.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.controller.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.controller.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.controller.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.controller.resources }}
resources: {{- toYaml .Values.controller.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.controller.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.controller.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.controller.containerPorts.controller }}
initialDelaySeconds: {{ .Values.controller.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.controller.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.controller.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.controller.startupProbe.successThreshold }}
failureThreshold: {{ .Values.controller.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.controller.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.controller.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.controller.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.controller.containerPorts.controller }}
initialDelaySeconds: {{ .Values.controller.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.controller.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.controller.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.controller.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.controller.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.controller.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.controller.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.controller.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: {{ .Values.controller.containerPorts.controller }}
initialDelaySeconds: {{ .Values.controller.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.controller.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.controller.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.controller.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.controller.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
# Mounting into a path that will be read by Argo CD.
# This secret will be autogenerated by Argo CD repo server unless it already exists. Users can create its own certificate to override it.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/tls/#inbound-tls-certificates-used-by-argocd-repo-sever
- mountPath: /app/config/server/tls
name: argocd-repo-server-tls
{{- if .Values.controller.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.controller.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: argocd-repo-server-tls
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
- key: ca.crt
path: ca.crt
optional: true
secretName: argocd-repo-server-tls
{{- if .Values.controller.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,53 @@
{{- if .Values.controller.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.application-controller" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: controller
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.controller.metrics.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.controller.metrics.service.type }}
{{- if and .Values.controller.metrics.service.clusterIP (eq .Values.controller.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.controller.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.controller.metrics.service.type "LoadBalancer") (eq .Values.controller.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.controller.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.controller.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.controller.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.controller.metrics.service.type "LoadBalancer") (not (empty .Values.controller.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.controller.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.controller.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.controller.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.controller.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.controller.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http-metrics
port: {{ .Values.controller.metrics.service.port }}
protocol: TCP
{{- if (and (or (eq .Values.controller.service.type "NodePort") (eq .Values.controller.service.type "LoadBalancer")) (not (empty .Values.controller.metrics.service.nodePort))) }}
nodePort: {{ .Values.controller.metrics.service.nodePort }}
{{- else if eq .Values.controller.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: controller
{{- end }}

View File

@@ -0,0 +1,25 @@
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.rules.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "argocd.application-controller" . }}
{{- if .Values.controller.metrics.rules.namespace }}
namespace: {{ .Values.controller.metrics.rules.namespace }}
{{- end }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.rules.selector }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.rules.selector "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.rules.additionalLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.rules.additionalLabels "context" $ ) | nindent 4 }}
{{- end }}
spec:
groups:
- name: argocd
rules:
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.rules.spec "context" $ ) | nindent 6 }}
{{- end }}

View File

@@ -0,0 +1,41 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- secrets
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- argoproj.io
resources:
- applications
- appprojects
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- list
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.controller.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.application-controller.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.application-controller" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.rbac.create .Values.controller.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.application-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: controller
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.controller.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.controller.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.controller.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,54 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.application-controller" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: controller
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.controller.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.controller.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.controller.service.type }}
{{- if and .Values.controller.service.clusterIP (eq .Values.controller.service.type "ClusterIP") }}
clusterIP: {{ .Values.controller.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.controller.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.controller.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.controller.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.controller.service.type "LoadBalancer") (not (empty .Values.controller.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.controller.service.loadBalancerIP }}
{{- end }}
{{- if .Values.controller.service.sessionAffinity }}
sessionAffinity: {{ .Values.controller.service.sessionAffinity }}
{{- end }}
{{- if .Values.controller.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.controller.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: tcp-controller
port: {{ .Values.controller.service.port }}
targetPort: controller
protocol: TCP
{{- if (and (or (eq .Values.controller.service.type "NodePort") (eq .Values.controller.service.type "LoadBalancer")) (not (empty .Values.controller.service.nodePort))) }}
nodePort: {{ .Values.controller.service.nodePort }}
{{- else if eq .Values.controller.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.controller.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: controller

View File

@@ -0,0 +1,50 @@
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd.application-controller" . }}
{{- if .Values.controller.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.controller.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: controller
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.controller.metrics.serviceMonitor.interval }}
interval: {{ .Values.controller.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.controller.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.controller.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: controller
{{- end }}

View File

@@ -0,0 +1,183 @@
{{- if .Values.applicationSet.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.applicationSet" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.applicationSet.replicaCount }}
{{- if .Values.applicationSet.updateStrategy }}
strategy: {{- toYaml .Values.applicationSet.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: applicationSet
template:
metadata:
{{- if .Values.applicationSet.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: applicationSet
{{- if .Values.applicationSet.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.applicationSet.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.applicationSet.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.applicationSet.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.applicationSet.podAffinityPreset "component" "applicationSet" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.applicationSet.podAntiAffinityPreset "component" "applicationSet" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.applicationSet.nodeAffinityPreset.type "key" .Values.applicationSet.nodeAffinityPreset.key "values" .Values.applicationSet.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.applicationSet.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.applicationSet.priorityClassName }}
priorityClassName: {{ .Values.applicationSet.priorityClassName | quote }}
{{- end }}
{{- if .Values.applicationSet.podSecurityContext.enabled }}
securityContext: {{- omit .Values.applicationSet.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: applicationset-controller
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.applicationSet.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.applicationSet.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.args "context" $) | nindent 12 }}
{{- else }}
args:
- argocd-applicationset-controller
- --logformat
- {{ .Values.applicationSet.logFormat | quote }}
- --loglevel
- {{ .Values.applicationSet.logLevel | quote }}
- --metrics-addr
- ":{{ .Values.applicationSet.containerPorts.metrics }}"
- --probe-addr
- ":{{ .Values.applicationSet.containerPorts.probe }}"
{{- if or (gt ( .Values.applicationSet.replicaCount | int64) 1) .Values.applicationSet.defaultArgs.enableLeaderElection }}
- --enable-leader-election=true
{{- end }}
- --argocd-repo-server
- {{ include "argocd.repo-server" . }}:{{ .Values.repoServer.service.port }}
- --policy
- {{ .Values.applicationSet.defaultArgs.policy | quote }}
- --debug
- {{ .Values.applicationSet.defaultArgs.debug | quote }}
- --dry-run
- {{ .Values.applicationSet.defaultArgs.dryRun | quote }}
{{- if .Values.applicationSet.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
env:
{{- if .Values.applicationSet.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.applicationSet.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.applicationSet.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- name: metrics
containerPort: {{ .Values.applicationSet.containerPorts.metrics }}
protocol: TCP
- name: probe
containerPort: {{ .Values.applicationSet.containerPorts.probe }}
protocol: TCP
- name: webhook
containerPort: 7000
protocol: TCP
{{- if .Values.applicationSet.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.applicationSet.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: probe
initialDelaySeconds: {{ .Values.applicationSet.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.applicationSet.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.applicationSet.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.applicationSet.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.applicationSet.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.applicationSet.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.applicationSet.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: probe
initialDelaySeconds: {{ .Values.applicationSet.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.applicationSet.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.applicationSet.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.applicationSet.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.applicationSet.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.applicationSet.resources }}
resources: {{- toYaml .Values.applicationSet.resources | nindent 12 }}
{{- end }}
{{- if .Values.applicationSet.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.applicationSet.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /app/config/ssh
name: ssh-known-hosts
{{- if .Values.config.tlsCerts }}
- mountPath: /app/config/tls
name: tls-certs
{{- end }}
{{- if .Values.config.gpgKeys }}
- mountPath: /app/config/gpg/source
name: gpg-keys
{{- end }}
- mountPath: /app/config/gpg/keys
name: gpg-keyring
- mountPath: /tmp
name: tmp
{{- if .Values.applicationSet.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
volumes:
- name: ssh-known-hosts
configMap:
name: argocd-ssh-known-hosts-cm
{{- if .Values.config.tlsCerts }}
- name: tls-certs
configMap:
name: argocd-tls-certs-cm
{{- end }}
{{- if .Values.config.gpgKeys }}
- name: gpg-keys
configMap:
name: argocd-gpg-keys-cm
{{- end }}
- name: gpg-keyring
emptyDir: {}
- name: tmp
emptyDir: {}
{{- if .Values.applicationSet.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,64 @@
{{- if and .Values.applicationSet.enabled .Values.applicationSet.webhook.ingress.enabled -}}
apiVersion: {{ include "common.capabilities.webhook.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "argocd.applicationSet" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.applicationSet.webhook.ingress.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.webhook.ingress.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.applicationSet.webhook.ingress.annotations .Values.commonAnnotations .Values.applicationSet.webhook.ingress.certManager }}
annotations:
{{- if .Values.applicationSet.webhook.ingress.certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
{{- if .Values.applicationSet.webhook.ingress.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.webhook.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if and .Values.applicationSet.webhook.ingress.ingressClassName (eq "true" (include "common.webhook.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.applicationSet.webhook.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.applicationSet.webhook.ingress.hostname }}
- host: {{ .Values.applicationSet.webhook.ingress.hostname }}
http:
paths:
{{- if .Values.applicationSet.webhook.ingress.extraPaths }}
{{- toYaml .Values.applicationSet.webhook.ingress.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.applicationSet.webhook.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.applicationSet.webhook.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" .) "servicePort" (ternary "https" "http" .Values.applicationSet.webhook.ingress.tls) "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.applicationSet.webhook.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" $) "servicePort" (ternary "https" "http" $.Values.applicationSet.webhook.ingress.tls) "context" $) | nindent 14 }}
{{- end }}
tls:
{{- if .Values.applicationSet.webhook.ingress.tls }}
- hosts:
- {{ .Values.applicationSet.webhook.ingress.hostname }}
secretName: {{ printf "%s-tls" .Values.applicationSet.webhook.ingress.hostname }}
{{- end }}
{{- if .Values.applicationSet.webhook.ingress.extraTls }}
{{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.webhook.ingress.extraTls "context" $ ) | nindent 4 }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,53 @@
{{- if and .Values.applicationSet.enabled .Values.applicationSet.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.applicationSet" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: applicationSet
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- with .Values.applicationSet.metrics.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.applicationSet.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.applicationSet.metrics.service.type }}
{{- if and .Values.applicationSet.metrics.service.clusterIP (eq .Values.applicationSet.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.applicationSet.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.applicationSet.metrics.service.type "LoadBalancer") (eq .Values.applicationSet.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.applicationSet.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.applicationSet.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.applicationSet.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.applicationSet.metrics.service.type "LoadBalancer") (not (empty .Values.applicationSet.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.applicationSet.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.applicationSet.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.applicationSet.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.applicationSet.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http-metrics
port: {{ .Values.applicationSet.metrics.service.port }}
protocol: TCP
{{- if (and (or (eq .Values.applicationSet.service.type "NodePort") (eq .Values.applicationSet.service.type "LoadBalancer")) (not (empty .Values.applicationSet.metrics.service.nodePort))) }}
nodePort: {{ .Values.applicationSet.metrics.service.nodePort }}
{{- else if eq .Values.applicationSet.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- end }}

View File

@@ -0,0 +1,91 @@
{{- if and .Values.rbac.create .Values.applicationSet.enabled }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.applicationSet" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- argoproj.io
resources:
- applications
- applicationsets
- applicationsets/finalizers
- applicationsets/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- argoproj.io
resources:
- applicationsets/status
verbs:
- get
- patch
- update
- apiGroups:
- argoproj.io
resources:
- appprojects
verbs:
- get
- apiGroups:
- ""
resources:
- events
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- ""
resources:
- secrets
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- apps
- extensions
resources:
- deployments
verbs:
- get
- list
- watch
# Leader election
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- update
- delete
- patch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.applicationSet.enabled .Values.applicationSet.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.applicationSet" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.applicationSet.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.applicationSet" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.applicationSet.enabled .Values.rbac.create .Values.applicationSet.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.applicationSet.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- if or .Values.applicationSet.serviceAccount.annotations .Values.commonAnnotations }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.applicationSet.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.applicationSet.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,55 @@
{{- if .Values.applicationSet.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.applicationSet" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.applicationSet.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.applicationSet.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.applicationSet.service.type }}
{{- if and .Values.applicationSet.service.clusterIP (eq .Values.applicationSet.service.type "ClusterIP") }}
clusterIP: {{ .Values.applicationSet.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.applicationSet.service.type "LoadBalancer") (eq .Values.applicationSet.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.applicationSet.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.applicationSet.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.applicationSet.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.applicationSet.service.type "LoadBalancer") (not (empty .Values.applicationSet.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.applicationSet.service.loadBalancerIP }}
{{- end }}
{{- if .Values.applicationSet.service.sessionAffinity }}
sessionAffinity: {{ .Values.applicationSet.service.sessionAffinity }}
{{- end }}
{{- if .Values.applicationSet.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: webhook
port: {{ .Values.applicationSet.service.port }}
targetPort: webhook
{{- if (and (or (eq .Values.applicationSet.service.type "NodePort") (eq .Values.applicationSet.service.type "LoadBalancer")) (not (empty .Values.applicationSet.service.nodePort))) }}
nodePort: {{ .Values.applicationSet.service.nodePort }}
{{- else if eq .Values.applicationSet.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.applicationSet.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: applicationSet
{{- end }}

View File

@@ -0,0 +1,49 @@
{{- if and .Values.applicationSet.enabled .Values.applicationSet.metrics.enabled .Values.applicationSet.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argo-cd.applicationSet" . }}
{{- if .Values.applicationSet.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.applicationSet.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.applicationSet.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.applicationSet.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: applicationSet
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.applicationSet.metrics.serviceMonitor.interval }}
interval: {{ .Values.applicationSet.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.applicationSet.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.applicationSet.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.applicationSet.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.applicationSet.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.applicationSet.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.applicationSet.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.applicationSet.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: applicationSet
{{- end }}

View File

@@ -0,0 +1,24 @@
{{- if .Values.server.configEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
# Mandatory hardcoded name.
# Ref: https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-cm.yaml
name: argocd-cm
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
{{- if .Values.config.styles }}
ui.cssurl: "./custom/custom.styles.css"
{{- end }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.config "context" $ ) | nindent 2 }}
{{- end }}

View File

@@ -0,0 +1,55 @@
{{- if .Values.config.secret.create }}
apiVersion: v1
kind: Secret
metadata:
# Mandatory hardcoded name.
# Ref: https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-secret.yaml
name: argocd-secret
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if or .Values.commonAnnotations .Values.config.secret.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.config.secret.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.config.secret.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
type: Opaque
data:
{{- if .Values.config.secret.githubSecret }}
webhook.github.secret: {{ .Values.config.secret.githubSecret | b64enc }}
{{- end }}
{{- if .Values.config.secret.gitlabSecret }}
webhook.gitlab.secret: {{ .Values.config.secret.gitlabSecret | b64enc }}
{{- end }}
{{- if .Values.config.secret.bitbucketServerSecret }}
webhook.bitbucketserver.secret: {{ .Values.config.secret.bitbucketServerSecret | b64enc }}
{{- end }}
{{- if .Values.config.secret.bitbucketUUID }}
webhook.bitbucket.uuid: {{ .Values.config.secret.bitbucketUUID | b64enc }}
{{- end }}
{{- if .Values.config.secret.gogsSecret }}
webhook.gogs.secret: {{ .Values.config.secret.gogsSecret | b64enc }}
{{- end }}
{{- if and .Values.config.secret.argocdServerTlsConfig.key .Values.config.secret.argocdServerTlsConfig.crt }}
tls.key: {{ .Values.config.secret.argocdServerTlsConfig.key | b64enc }}
tls.crt: {{ .Values.config.secret.argocdServerTlsConfig.crt | b64enc }}
{{- end }}
{{- $password := include "common.secrets.passwords.manage" (dict "secret" "argocd-secret" "key" "clearPassword" "providedValues" (list "config.secret.argocdServerAdminPassword") "context" $) }}
clearPassword: {{ $password }}
{{- $password = (trimAll "\"" $password) | b64dec }}
# The password needs to be bcrypt hashed
admin.password: {{ (split ":" (htpasswd "" $password))._1 | b64enc }}
admin.passwordMtime: {{ default (dateInZone "2006-01-02T15:04:05Z" (now) "UTC") .Values.config.secret.argocdServerAdminPasswordMtime | b64enc }}
{{- range $key, $value := .Values.config.secret.extra }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,26 @@
{{- range .Values.config.clusterCredentials }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.names.fullname" $ }}-cluster-{{ .name }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
argocd.argoproj.io/secret-type: cluster
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
stringData:
name: {{ .name }}
server: {{ .server }}
namespaces: {{ .namespaces }}
config: |
{{- .config | toPrettyJson | nindent 4 }}
---
{{- end }}

View File

@@ -0,0 +1,224 @@
{{- if .Values.dex.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.dex.replicaCount }}
{{- if .Values.dex.updateStrategy }}
strategy: {{- toYaml .Values.dex.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: dex
template:
metadata:
{{- if .Values.dex.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.dex.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: dex
{{- if .Values.dex.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.dex.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.dex.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.dex.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.dex.podAffinityPreset "component" "dex" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.dex.podAntiAffinityPreset "component" "dex" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.dex.nodeAffinityPreset.type "key" .Values.dex.nodeAffinityPreset.key "values" .Values.dex.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.dex.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.dex.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.dex.schedulerName }}
schedulerName: {{ .Values.dex.schedulerName }}
{{- end }}
{{- if .Values.dex.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.dex.shareProcessNamespace }}
{{- end }}
{{- if .Values.dex.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.dex.priorityClassName }}
priorityClassName: {{ .Values.dex.priorityClassName | quote }}
{{- end }}
{{- if .Values.dex.runtimeClassName }}
runtimeClassName: {{ .Values.dex.runtimeClassName }}
{{- end }}
{{- if .Values.dex.podSecurityContext.enabled }}
securityContext: {{- omit .Values.dex.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.volumePermissions.enabled }}
- name: volume-permissions
image: {{ include "argocd.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
chown -R {{ .Values.dex.containerSecurityContext.runAsUser }}:{{ .Values.dex.podSecurityContext.fsGroup }} /shared
chown -R {{ .Values.dex.containerSecurityContext.runAsUser }}:{{ .Values.dex.podSecurityContext.fsGroup }} /tmp
securityContext:
runAsUser: {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: static-files
mountPath: /shared
- name: tmp-dir
mountPath: /tmp
{{- end }}
- name: copyutil
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.dex.resources }}
resources: {{- toYaml .Values.dex.resources | nindent 12 }}
{{- end }}
{{- if .Values.dex.containerSecurityContext }}
securityContext: {{- omit .Values.dex.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
command:
- cp
- -n
- /opt/bitnami/argo-cd/bin/argocd
- /shared/argocd-dex
volumeMounts:
- mountPath: /shared
name: static-files
{{- if .Values.dex.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: dex
image: {{ include "argocd.dex.image" . }}
imagePullPolicy: {{ .Values.dex.image.pullPolicy }}
{{- if .Values.dex.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.dex.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.dex.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.dex.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.dex.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.dex.command "context" $) | nindent 12 }}
{{- else }}
command:
- /shared/argocd-dex
{{- end }}
{{- if .Values.dex.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.dex.args "context" $) | nindent 12 }}
{{- else }}
args:
- rundex
{{- if .Values.dex.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.dex.containerPorts.http }}
protocol: TCP
- name: grpc
containerPort: {{ .Values.dex.containerPorts.grpc }}
protocol: TCP
{{- if .Values.dex.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.dex.containerPorts.metrics }}
protocol: TCP
{{- end }}
env:
{{- if .Values.dex.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.dex.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.dex.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.dex.resources }}
resources: {{- toYaml .Values.dex.resources | nindent 12 }}
{{- end }}
{{- if .Values.dex.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.startupProbe.successThreshold }}
failureThreshold: {{ .Values.dex.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.dex.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.dex.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.dex.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.dex.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- name: static-files
mountPath: /shared
- name: tmp-dir
mountPath: /tmp
{{- if .Values.dex.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.dex.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp-dir
emptyDir: {}
- name: static-files
emptyDir: {}
{{- if .Values.dex.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,53 @@
{{- if and .Values.dex.enabled .Values.dex.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.dex" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.dex.metrics.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.dex.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.dex.metrics.service.type }}
{{- if and .Values.dex.metrics.service.clusterIP (eq .Values.dex.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.dex.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.dex.metrics.service.type "LoadBalancer") (eq .Values.dex.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.dex.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.dex.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.dex.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.dex.metrics.service.type "LoadBalancer") (not (empty .Values.dex.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.dex.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.dex.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.dex.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.dex.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.dex.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: metrics
port: {{ .Values.dex.metrics.service.port }}
targetPort: metrics
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.metrics.service.nodePort))) }}
nodePort: {{ .Values.dex.metrics.service.nodePort }}
{{- else if eq .Values.dex.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if and .Values.dex.enabled .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- secrets
- configmaps
verbs:
- get
- list
- watch
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.dex.enabled .Values.dex.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.dex.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.dex" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.dex.enabled .Values.rbac.create .Values.dex.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.dex.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.dex.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.dex.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.dex.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,65 @@
{{- if .Values.dex.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.dex.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.dex.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.dex.service.type }}
{{- if and .Values.dex.service.clusterIP (eq .Values.dex.service.type "ClusterIP") }}
clusterIP: {{ .Values.dex.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.dex.service.type "LoadBalancer") (eq .Values.dex.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.dex.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.dex.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.dex.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.dex.service.type "LoadBalancer") (not (empty .Values.dex.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.dex.service.loadBalancerIP }}
{{- end }}
{{- if .Values.dex.service.sessionAffinity }}
sessionAffinity: {{ .Values.dex.service.sessionAffinity }}
{{- end }}
{{- if .Values.dex.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.dex.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http
port: {{ .Values.dex.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.http))) }}
nodePort: {{ .Values.dex.service.nodePorts.http }}
{{- else if eq .Values.dex.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.dex.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.grpc))) }}
nodePort: {{ .Values.dex.service.nodePorts.grpc }}
{{- else if eq .Values.dex.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.dex.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if and .Values.dex.enabled .Values.dex.metrics.enabled .Values.dex.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd.dex" . }}
{{- if .Values.dex.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.dex.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: dex
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.dex.metrics.serviceMonitor.jobLabel | quote }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.dex.metrics.serviceMonitor.interval }}
interval: {{ .Values.dex.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.dex.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.dex.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: dex
{{- end }}

View File

@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}

View File

@@ -0,0 +1,19 @@
{{- if .Values.config.gpgKeys }}
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-gpg-keys-cm
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
{{- include "common.tplvalues.render" (dict "value" .Values.config.gpgKeys "context" $) | nindent 2 }}
{{- end }}

View File

@@ -0,0 +1,25 @@
{{- if .Values.config.createExtraKnownHosts }}
apiVersion: v1
kind: ConfigMap
metadata:
# Mandatory hardcoded name.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#ssh-known-host-public-keys
name: argocd-ssh-known-hosts-cm
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
ssh_known_hosts: |
{{- include "common.tplvalues.render" (dict "value" .Values.config.knownHosts "context" $) | nindent 4 }}
{{- if .Values.config.extraKnownHosts }}
{{- include "common.tplvalues.render" (dict "value" .Values.config.extraKnownHosts "context" $) | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,284 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.repoServer.replicaCount }}
{{- if .Values.repoServer.updateStrategy }}
strategy: {{- toYaml .Values.repoServer.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: repo-server
template:
metadata:
{{- if .Values.repoServer.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: repo-server
{{- if .Values.repoServer.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.repo-server.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.repoServer.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.repoServer.podAffinityPreset "component" "repo-server" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.repoServer.podAntiAffinityPreset "component" "repo-server" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.repoServer.nodeAffinityPreset.type "key" .Values.repoServer.nodeAffinityPreset.key "values" .Values.repoServer.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.repoServer.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.schedulerName }}
schedulerName: {{ .Values.repoServer.schedulerName }}
{{- end }}
{{- if .Values.repoServer.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.repoServer.shareProcessNamespace }}
{{- end }}
{{- if .Values.repoServer.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.priorityClassName }}
priorityClassName: {{ .Values.repoServer.priorityClassName | quote }}
{{- end }}
{{- if .Values.repoServer.runtimeClassName }}
runtimeClassName: {{ .Values.repoServer.runtimeClassName }}
{{- end }}
{{- if .Values.repoServer.podSecurityContext.enabled }}
securityContext: {{- omit .Values.repoServer.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.volumePermissions.enabled }}
- name: volume-permissions
image: {{ include "argocd.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
chown -R {{ .Values.repoServer.containerSecurityContext.runAsUser }}:{{ .Values.repoServer.podSecurityContext.fsGroup }} /tmp
securityContext:
runAsUser: {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: tmp-dir
mountPath: /tmp
{{- end }}
{{- if .Values.redisWait.enabled }}
- name: wait-for-redis
image: {{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.redis.image.pullPolicy | quote }}
{{- with .Values.redisWait.securityContext }}
securityContext: {{ . | toYaml }}
{{- end }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
. /opt/bitnami/scripts/libos.sh
. /opt/bitnami/scripts/liblog.sh
check_redis_connection() {
local result="$(redis-cli -h {{ include "argocd.redisHost" . }} -p {{ include "argocd.redisPort" . }} {{ .Values.redisWait.extraArgs }} PING)"
if [[ "$result" != "PONG" ]]; then
false
fi
}
info "Checking redis connection..."
if ! retry_while "check_redis_connection"; then
error "Could not connect to the Redis server"
return 1
else
info "Connected to the Redis instance"
fi
{{- if include "argocd.redis.auth.enabled" . }}
env:
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- end }}
{{- if .Values.repoServer.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: argocd-repo-server
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.repoServer.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.repoServer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.args "context" $) | nindent 12 }}
{{- else }}
args:
- argocd-repo-server
- --logformat
- {{ .Values.repoServer.logFormat | quote }}
- --loglevel
- {{ .Values.repoServer.logLevel | quote }}
- --redis
- {{ include "argocd.redisHost" . }}:{{ include "argocd.redisPort" . }}
{{- if .Values.repoServer.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: repo-server
containerPort: {{ .Values.repoServer.containerPorts.repoServer }}
protocol: TCP
{{- if .Values.repoServer.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.repoServer.containerPorts.metrics }}
protocol: TCP
{{- end }}
env:
{{- if and .Values.redis.enabled (include "argocd.redis.auth.enabled" .) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- if .Values.repoServer.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.repoServer.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.repoServer.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.repoServer.resources }}
resources: {{- toYaml .Values.repoServer.resources | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.startupProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.repoServer.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.repoServer.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#ssh-known-host-public-keys
- name: ssh-known-hosts
mountPath: /app/config/ssh
{{- if .Values.config.tlsCerts }}
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#repositories-using-self-signed-tls-certificates-or-are-signed-by-custom-ca
- mountPath: /app/config/tls
name: tls-certs
{{- end }}
# Mounting into a path that will be read by Argo CD.
# This secret will be autogenerated by Argo CD repo server unless it already exists. Users can create its own certificate to override it.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/tls/#inbound-tls-certificates-used-by-argocd-repo-sever
- mountPath: /app/config/server/tls
name: argocd-repo-server-tls
- mountPath: /app/config/gpg/keys
name: gpg-keyring
- mountPath: /tmp
name: tmp-dir
{{- if .Values.repoServer.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: ssh-known-hosts
configMap:
name: argocd-ssh-known-hosts-cm
{{- if .Values.config.tlsCerts }}
- configMap:
name: argocd-tls-certs-cm
name: tls-certs
{{- end }}
- name: argocd-repo-server-tls
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
- key: ca.crt
path: ca.crt
optional: true
secretName: argocd-repo-server-tls
- emptyDir: {}
name: tmp-dir
- emptyDir: {}
name: gpg-keyring
{{- if .Values.repoServer.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,47 @@
{{- if .Values.repoServer.autoscaling.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "argocd.repo-server" . }}
minReplicas: {{ .Values.repoServer.autoscaling.minReplicas }}
maxReplicas: {{ .Values.repoServer.autoscaling.maxReplicas }}
metrics:
{{- if .Values.repoServer.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.repoServer.autoscaling.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.repoServer.autoscaling.targetCPU }}
{{- end }}
{{- end }}
{{- if .Values.repoServer.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.repoServer.autoscaling.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.repoServer.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,52 @@
{{- if .Values.repoServer.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.repo-server" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.metrics.service.annotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.repoServer.metrics.service.type }}
{{- if and .Values.repoServer.metrics.service.clusterIP (eq .Values.repoServer.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.repoServer.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.repoServer.metrics.service.type "LoadBalancer") (eq .Values.repoServer.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.repoServer.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.repoServer.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.repoServer.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.repoServer.metrics.service.type "LoadBalancer") (not (empty .Values.repoServer.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.repoServer.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.repoServer.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.repoServer.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.repoServer.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http-metrics
targetPort: metrics
port: {{ .Values.repoServer.metrics.service.port }}
protocol: TCP
{{- if (and (or (eq .Values.repoServer.service.type "NodePort") (eq .Values.repoServer.service.type "LoadBalancer")) (not (empty .Values.repoServer.metrics.service.nodePort))) }}
nodePort: {{ .Values.repoServer.metrics.service.nodePort }}
{{- else if eq .Values.repoServer.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- end }}

View File

@@ -0,0 +1,25 @@
{{- if .Values.config.secret.repositoryCredentials }}
apiVersion: v1
kind: Secret
metadata:
# Mandatory hardcoded name.
# Ref: https://github.com/argoproj/argo-helm/blob/master/charts/argo-cd/templates/argocd-repo-server/repository-credentials-secret.yaml
name: argocd-repository-credentials
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- range $key, $value := .Values.config.secret.repositoryCredentials }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- argoproj.io
resources:
- applications
- applicationset
verbs:
- get
- list
- watch
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.repoServer.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.repo-server.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.repo-server" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.rbac.create .Values.repoServer.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.repo-server.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.repoServer.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.repoServer.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,54 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.repoServer.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.repoServer.service.type }}
{{- if and .Values.repoServer.service.clusterIP (eq .Values.repoServer.service.type "ClusterIP") }}
clusterIP: {{ .Values.repoServer.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.repoServer.service.type "LoadBalancer") (eq .Values.repoServer.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.repoServer.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.repoServer.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.repoServer.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.repoServer.service.type "LoadBalancer") (not (empty .Values.repoServer.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.repoServer.service.loadBalancerIP }}
{{- end }}
{{- if .Values.repoServer.service.sessionAffinity }}
sessionAffinity: {{ .Values.repoServer.service.sessionAffinity }}
{{- end }}
{{- if .Values.repoServer.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: tcp-repo-server
port: {{ .Values.repoServer.service.port }}
targetPort: repo-server
protocol: TCP
{{- if (and (or (eq .Values.repoServer.service.type "NodePort") (eq .Values.repoServer.service.type "LoadBalancer")) (not (empty .Values.repoServer.service.nodePort))) }}
nodePort: {{ .Values.repoServer.service.nodePort }}
{{- else if eq .Values.repoServer.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.repoServer.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: repo-server

View File

@@ -0,0 +1,51 @@
{{- if and .Values.repoServer.metrics.enabled .Values.repoServer.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd.repo-server" . }}
{{- if .Values.repoServer.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.repoServer.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.repoServer.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.repoServer.metrics.serviceMonitor.jobLabel | quote }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.repoServer.metrics.serviceMonitor.interval }}
interval: {{ .Values.repoServer.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.repoServer.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.repoServer.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.repoServer.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.repoServer.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.repoServer.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.repoServer.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: repo-server
{{- end }}

View File

@@ -0,0 +1,36 @@
{{- if .Values.rbac.create -}}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRole
metadata:
name: {{ include "argocd.namespace.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- delete
- get
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- list
- apiGroups:
- ""
resources:
- pods
- pods/log
verbs:
- get
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- if .Values.rbac.create -}}
kind: ClusterRoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.namespace.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "argocd.namespace.server" . }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.server.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}

View File

@@ -0,0 +1,283 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.server.replicaCount }}
{{- if .Values.server.updateStrategy }}
strategy: {{- toYaml .Values.server.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: server
template:
metadata:
{{- if .Values.server.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.server.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: server
{{- if .Values.server.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.server.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.server.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.server.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.server.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.server.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.server.podAffinityPreset "component" "server" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.server.podAntiAffinityPreset "component" "server" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.server.nodeAffinityPreset.type "key" .Values.server.nodeAffinityPreset.key "values" .Values.server.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.server.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.server.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.server.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.server.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.server.schedulerName }}
schedulerName: {{ .Values.server.schedulerName }}
{{- end }}
{{- if .Values.server.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.server.shareProcessNamespace }}
{{- end }}
{{- if .Values.server.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName | quote }}
{{- end }}
{{- if .Values.server.runtimeClassName }}
runtimeClassName: {{ .Values.server.runtimeClassName }}
{{- end }}
{{- if .Values.server.podSecurityContext.enabled }}
securityContext: {{- omit .Values.server.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.server.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.redisWait.enabled }}
- name: wait-for-redis
image: {{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.redis.image.pullPolicy | quote }}
{{- with .Values.redisWait.securityContext }}
securityContext: {{ . | toYaml }}
{{- end }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
. /opt/bitnami/scripts/libos.sh
. /opt/bitnami/scripts/liblog.sh
check_redis_connection() {
local result="$(redis-cli -h {{ include "argocd.redisHost" . }} -p {{ include "argocd.redisPort" . }} {{ .Values.redisWait.extraArgs }} PING)"
if [[ "$result" != "PONG" ]]; then
false
fi
}
info "Checking redis connection..."
if ! retry_while "check_redis_connection"; then
error "Could not connect to the Redis server"
return 1
else
info "Connected to the Redis instance"
fi
{{- if include "argocd.redis.auth.enabled" . }}
env:
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- end }}
containers:
- name: argocd-server
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.server.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.server.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.server.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.server.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.server.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.server.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.server.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.server.args "context" $) | nindent 12 }}
{{- else }}
args:
- argocd-server
- --staticassets
- /opt/bitnami/argo-cd/app
- --repo-server
- {{ include "argocd.repo-server" . }}:{{ .Values.repoServer.service.port }}
{{- if .Values.dex.enabled }}
- --dex-server
- http://{{ include "argocd.dex" . }}:{{ .Values.dex.service.ports.http }}
{{- end }}
- --logformat
- {{ .Values.server.logFormat }}
- --loglevel
- {{ .Values.server.logLevel }}
# TODO(miguelaeh): Test the chart using redis sentinel enabled: https://github.com/argoproj/argo-cd/blob/2a410187565e15633b6f2a8c8d8da22cf02b257d/util/cache/cache.go#L40
- --redis
- {{ include "argocd.redisHost" . }}:{{ include "argocd.redisPort" . }}
{{- if .Values.server.insecure }}
- --insecure
{{- end }}
{{- if .Values.server.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.server.containerPorts.http }}
protocol: TCP
{{- if .Values.server.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.server.containerPorts.metrics }}
protocol: TCP
{{- end }}
env:
{{- if and .Values.redis.enabled (include "argocd.redis.auth.enabled" .) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- if .Values.server.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.server.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.server.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.server.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.server.resources }}
resources: {{- toYaml .Values.server.resources | nindent 12 }}
{{- end }}
{{- if .Values.server.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.server.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.server.containerPorts.http }}
initialDelaySeconds: {{ .Values.server.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.server.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.server.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.server.startupProbe.successThreshold }}
failureThreshold: {{ .Values.server.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.server.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.server.containerPorts.http }}
initialDelaySeconds: {{ .Values.server.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.server.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.server.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.server.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.server.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.server.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.server.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.server.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.server.containerPorts.http }}
initialDelaySeconds: {{ .Values.server.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.server.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.server.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.server.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.server.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#ssh-known-host-public-keys
- name: ssh-known-hosts
mountPath: /app/config/ssh
{{- if .Values.config.styles }}
- mountPath: "/bitnami/argocd/app/custom/custom.styles.css"
subPath: "custom.styles.css"
name: custom-styles
{{- end }}
{{- if .Values.config.tlsCerts }}
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#repositories-using-self-signed-tls-certificates-or-are-signed-by-custom-ca
- mountPath: /app/config/tls
name: tls-certs
{{- end }}
# Mounting into a path that will be read by Argo CD.
# This secret will be autogenerated by Argo CD repo server unless it already exists. Users can create its own certificate to override it.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/tls/#inbound-tls-certificates-used-by-argocd-repo-sever
- mountPath: /app/config/server/tls
name: argocd-repo-server-tls
{{- if .Values.server.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.server.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: ssh-known-hosts
configMap:
name: argocd-ssh-known-hosts-cm
{{- if .Values.config.styles }}
- configMap:
name: {{ include "argocd.custom-styles.fullname" . }}
name: custom-styles
{{- end }}
{{- if .Values.config.tlsCerts }}
- configMap:
name: argocd-tls-certs-cm
name: tls-certs
{{- end }}
- name: argocd-repo-server-tls
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
- key: ca.crt
path: ca.crt
optional: true
secretName: argocd-repo-server-tls
{{- if .Values.server.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,46 @@
{{- if .Values.server.ingressGrpc.enabled }}
{{- if .Values.server.ingressGrpc.secrets }}
{{- range .Values.server.ingressGrpc.secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
namespace: {{ $.Release.Namespace | quote }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
app.kubernetes.io/component: server
{{- if $.Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ .certificate | b64enc }}
tls.key: {{ .key | b64enc }}
---
{{- end }}
{{- end }}
{{- if and .Values.server.ingressGrpc.tls .Values.server.ingressGrpc.selfSigned }}
{{- $ca := genCA "server-ca" 365 }}
{{- $cert := genSignedCert .Values.server.ingressGrpc.hostname nil (list .Values.server.ingressGrpc.hostname) 365 $ca }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-tls" .Values.server.ingressGrpc.hostname }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ $cert.Cert | b64enc | quote }}
tls.key: {{ $cert.Key | b64enc | quote }}
ca.crt: {{ $ca.Cert | b64enc | quote }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,47 @@
{{- if .Values.server.autoscaling.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "argocd.server" . }}
minReplicas: {{ .Values.server.autoscaling.minReplicas }}
maxReplicas: {{ .Values.server.autoscaling.maxReplicas }}
metrics:
{{- if .Values.server.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.server.autoscaling.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.server.autoscaling.targetCPU }}
{{- end }}
{{- end }}
{{- if .Values.server.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.server.autoscaling.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.server.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,66 @@
{{- if .Values.server.ingressGrpc.enabled -}}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "argocd.server" . }}-grpc
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.server.ingressGrpc.annotations .Values.commonAnnotations .Values.server.ingressGrpc.certManager }}
annotations:
{{- if .Values.server.ingressGrpc.certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
{{- if .Values.server.ingressGrpc.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.ingressGrpc.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if and .Values.server.ingressGrpc.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.server.ingressGrpc.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.server.ingressGrpc.hostname }}
- host: {{ .Values.server.ingressGrpc.hostname }}
http:
paths:
{{- if .Values.server.ingressGrpc.extraPaths }}
{{- toYaml .Values.server.ingressGrpc.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.server.ingressGrpc.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.server.ingressGrpc.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" .) "servicePort" (ternary "https" "http" .Values.server.ingressGrpc.tls) "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.server.ingressGrpc.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" $) "servicePort" (ternary "https" "http" $.Values.server.ingressGrpc.tls) "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.server.ingressGrpc.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.ingressGrpc.extraRules "context" $) | nindent 4 }}
{{- end }}
{{- if or .Values.server.ingressGrpc.tls .Values.server.ingressGrpc.extraTls }}
tls:
{{- if .Values.server.ingressGrpc.tls }}
- hosts:
- {{ .Values.server.ingressGrpc.hostname }}
secretName: {{ printf "%s-tls" .Values.server.ingressGrpc.hostname }}
{{- end }}
{{- if .Values.server.ingressGrpc.extraTls }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.ingressGrpc.extraTls "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,66 @@
{{- if .Values.server.ingress.enabled -}}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.server.ingress.annotations .Values.commonAnnotations .Values.server.ingress.certManager }}
annotations:
{{- if .Values.server.ingress.certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
{{- if .Values.server.ingress.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if and .Values.server.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.server.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.server.ingress.hostname }}
- host: {{ .Values.server.ingress.hostname }}
http:
paths:
{{- if .Values.server.ingress.extraPaths }}
{{- toYaml .Values.server.ingress.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.server.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.server.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" .) "servicePort" (ternary "https" "http" .Values.server.ingress.tls) "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.server.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "argocd.server" $) "servicePort" (ternary "https" "http" $.Values.server.ingress.tls) "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.server.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.ingress.extraRules "context" $) | nindent 4 }}
{{- end }}
{{- if or .Values.server.ingress.tls .Values.server.ingress.extraTls }}
tls:
{{- if .Values.server.ingress.tls }}
- hosts:
- {{ .Values.server.ingress.hostname }}
secretName: {{ printf "%s-tls" .Values.server.ingress.hostname }}
{{- end }}
{{- if .Values.server.ingress.extraTls }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.ingress.extraTls "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,54 @@
{{- if .Values.server.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.server" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.server.metrics.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.server.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.server.metrics.service.type }}
{{- if and .Values.server.metrics.service.clusterIP (eq .Values.server.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.server.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.server.metrics.service.type "LoadBalancer") (eq .Values.server.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.server.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.server.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.server.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.server.metrics.service.type "LoadBalancer") (not (empty .Values.server.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.server.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.server.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.server.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.server.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.server.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http-metrics
targetPort: metrics
port: {{ .Values.server.metrics.service.port }}
protocol: TCP
{{- if (and (or (eq .Values.server.service.type "NodePort") (eq .Values.server.service.type "LoadBalancer")) (not (empty .Values.server.metrics.service.nodePort))) }}
nodePort: {{ .Values.server.metrics.service.nodePort }}
{{- else if eq .Values.server.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: server
{{- end }}

View File

@@ -0,0 +1,46 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- secrets
- configmaps
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- argoproj.io
resources:
- applications
- applicationsets
- appprojects
verbs:
- create
- get
- list
- watch
- update
- delete
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- list
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.server.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.server.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.server" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.rbac.create .Values.server.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.server.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.server.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.server.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.server.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,64 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.server.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.server.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.server.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.server.service.type }}
{{- if and .Values.server.service.clusterIP (eq .Values.server.service.type "ClusterIP") }}
clusterIP: {{ .Values.server.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.server.service.type "LoadBalancer") (eq .Values.server.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.server.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.server.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.server.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.server.service.type "LoadBalancer") (not (empty .Values.server.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.server.service.loadBalancerIP }}
{{- end }}
{{- if .Values.server.service.sessionAffinity }}
sessionAffinity: {{ .Values.server.service.sessionAffinity }}
{{- end }}
{{- if .Values.server.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.server.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http
port: {{ .Values.server.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.server.service.type "NodePort") (eq .Values.server.service.type "LoadBalancer")) (not (empty .Values.server.service.nodePorts.http))) }}
nodePort: {{ .Values.server.service.nodePorts.http }}
{{- else if eq .Values.server.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: https
port: {{ .Values.server.service.ports.https }}
# NOTE: Argo CD uses only one port (8080) configured with https and always redirects http request to it, so the target port is the same than for http
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.server.service.type "NodePort") (eq .Values.server.service.type "LoadBalancer")) (not (empty .Values.server.service.nodePorts.https))) }}
nodePort: {{ .Values.server.service.nodePorts.https }}
{{- else if eq .Values.server.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.server.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: server

View File

@@ -0,0 +1,51 @@
{{- if and .Values.server.metrics.enabled .Values.server.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd.server" . }}
{{- if .Values.server.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.server.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.server.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.server.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: server
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.server.metrics.serviceMonitor.jobLabel | quote }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.server.metrics.serviceMonitor.interval }}
interval: {{ .Values.server.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.server.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.server.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.server.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.server.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.server.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.server.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.server.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.server.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: server
{{- end }}

View File

@@ -0,0 +1,46 @@
{{- if .Values.server.ingress.enabled }}
{{- if .Values.server.ingress.secrets }}
{{- range .Values.server.ingress.secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
namespace: {{ $.Release.Namespace | quote }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
app.kubernetes.io/component: server
{{- if $.Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ .certificate | b64enc }}
tls.key: {{ .key | b64enc }}
---
{{- end }}
{{- end }}
{{- if and .Values.server.ingress.tls .Values.server.ingress.selfSigned }}
{{- $ca := genCA "server-ca" 365 }}
{{- $cert := genSignedCert .Values.server.ingress.hostname nil (list .Values.server.ingress.hostname) 365 $ca }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-tls" .Values.server.ingress.hostname }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ $cert.Cert | b64enc | quote }}
tls.key: {{ $cert.Key | b64enc | quote }}
ca.crt: {{ $ca.Cert | b64enc | quote }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if and .Values.config.styles (not .Values.config.existingStylesConfigmap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "argocd.custom-styles.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
custom.styles.css: |
{{- include "common.tplvalues.render" ( dict "value" .Values.config.styles "context" $ ) | nindent 4 }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.config.tlsCerts }}
apiVersion: v1
kind: ConfigMap
metadata:
# Mandatory hardcoded name.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#repositories-using-self-signed-tls-certificates-or-are-signed-by-custom-ca
name: argocd-tls-certs-cm
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
{{- include "common.tplvalues.render" (dict "value" .Values.config.tlsCerts "context" $) | nindent 2 }}
{{- end }}