Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5e6bd59
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 26, 2025
4b4073f
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 26, 2025
e1457a9
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 26, 2025
3d42306
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 26, 2025
f3673f8
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 29, 2025
30521c9
Merge branch 'main' into feat/separate-redis-for-runtime
mikhail-klimko Sep 29, 2025
32d78a0
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 29, 2025
12f2d6d
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Sep 30, 2025
3a72c7e
merge main
mikhail-klimko Oct 8, 2025
aa7a5f6
merge main
mikhail-klimko Oct 8, 2025
11bac81
merge main
mikhail-klimko Oct 8, 2025
efd38cc
merge main
mikhail-klimko Oct 8, 2025
de0e97f
merge main
mikhail-klimko Oct 8, 2025
ba00efa
merge main
mikhail-klimko Oct 8, 2025
2972e4b
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Oct 8, 2025
b6fd321
Merge branch 'main' into feat/separate-redis-for-runtime
mikhail-klimko Oct 8, 2025
dd57484
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Oct 8, 2025
b844d35
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Oct 8, 2025
73c87d6
feat: add separate redis for cf-argocd-extras and app-proxy
mikhail-klimko Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/gitops-runtime/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ dependencies:
version: 0.1.22
alias: tunnel-client
condition: tunnel-client.enabled
- name: redis-ha
version: 4.33.4
repository: https://dandydeveloper.github.io/charts/
condition: redis-ha.enabled
212 changes: 136 additions & 76 deletions charts/gitops-runtime/README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions charts/gitops-runtime/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,20 @@ gitops-operator:
tag: vX.Y.Z
```

### To 0.24.x

#### Affected values

- `.Values.redis`/`.Values.redis-ha`/`.Values.redis-secret-init` were added

```yaml
# Enabled standalone Redis (single Deployment with 1 replica)
redis:
enabled: true

# Enabled Redis High Availability (StatefulSet with Proxy)
redis-ha:
enabled: false
```

{{ template "chart.valuesSection" . }}
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ LEADER_ID:
fieldRef:
fieldPath: metadata.name
{{- end }}
CACHE_HOST: {{ (splitList ":" (include "codefresh-gitops-runtime.argocd.redis.url" .) | first) }}
CACHE_PORT: {{ (splitList ":" (include "codefresh-gitops-runtime.argocd.redis.url" .) | last) }}
CACHE_PASSWORD:
valueFrom:
secretKeyRef:
name: gitops-runtime-redis
key: auth
{{ include "codefresh-gitops-runtime.get-proxy-env-vars" . }}
{{- end -}}

Expand Down
23 changes: 11 additions & 12 deletions charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,18 @@ Determine argocd server username ConfigMap.
Determine argocd redis url
*/}}
{{- define "codefresh-gitops-runtime.argocd.redis.url" -}}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- if (index .Values "argo-cd" "enabled") }}
{{- $serviceName := include "codefresh-gitops-runtime.argocd.redis.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.redis.serviceport" . }}
{{- printf "%s:%s" $serviceName $port }}
{{- else if (index .Values "global" "external-argo-cd" "redis") }}
{{- $redis := (index .Values "global" "external-argo-cd" "redis") }}
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.redis.svc is not set" $redis.svc }}
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.redis.port is not set" $redis.port }}
{{- printf "%s:%v" $svc $port }}
{{- if and (index .Values "redis-ha" "enabled") (index .Values "redis-ha" "haproxy" "enabled") }}
{{- $redisHa := (index .Values "redis-ha") -}}
{{- $redisHaContext := dict "Chart" (dict "Name" "redis-ha") "Release" .Release "Values" $redisHa -}}
{{- $serverName := printf "%s-haproxy" (include "redis-ha.fullname" $redisHaContext) | trunc 63 | trimSuffix "-" -}}
{{- $port := $redisHa.haproxy.servicePort -}}
{{- printf "%s:%v" $serverName $port }}
{{- else if .Values.redis.enabled }}
{{- $serviceName := include "redis.fullname" . }}
{{- $port := .Values.redis.service.ports.redis.port }}
{{- printf "%s:%v" $serviceName $port }}
{{- else }}
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.redis is not set" }}
{{- fail "ERROR: .Values.redis or .Values.redis-ha must be enabled!" }}
{{- end }}
{{- end}}

Expand Down Expand Up @@ -516,7 +516,6 @@ NO_PROXY: {{ .Values.global.noProxy | quote }}
{{- printf "%s" $eventBusName }}
{{- end }}


{{- define "codefresh-gitops-runtime.image.name" -}}
{{/* Restoring root $ context */}}
{{- $ := .context -}}
Expand Down
2 changes: 2 additions & 0 deletions charts/gitops-runtime/templates/app-proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{{- $_ := set $appProxyContext "Values" (deepCopy (get .Values "app-proxy")) }}
{{- $_ := set $appProxyContext.Values "global" (deepCopy (get .Values "global")) }}
{{- $_ := set $appProxyContext.Values "argo-cd" (get .Values "argo-cd") }}
{{- $_ := set $appProxyContext.Values "redis" (get .Values "redis") }}
{{- $_ := set $appProxyContext.Values "redis-ha" (get .Values "redis-ha") }}

{{/* Merge environment variables with the ones in _app-proxy-env.yaml */}}
{{- $mainContainerMergedValues := mergeOverwrite $appProxyContext.Values.env (include "codefresh-gitops-runtime.app-proxy.calculated-env-vars" . | fromYaml) }}
Expand Down
10 changes: 5 additions & 5 deletions charts/gitops-runtime/templates/argo-gateway/_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,29 @@ LISTEN_ADDRESS:
REDISDB:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: argo-gateway-cmd-params-cm
key: redis.db
optional: true
REDIS_COMPRESSION:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: argo-gateway-cmd-params-cm
key: redis.compression
optional: true
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: argocd-redis
name: gitops-runtime-redis
key: auth
REDIS_SERVER:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: argo-gateway-cmd-params-cm
key: redis.server
REDIS_USERNAME:
valueFrom:
secretKeyRef:
name: argocd-redis
name: argo-gateway-cmd-params-cm
key: redis-username
optional: true
REPO_SERVER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,29 @@ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:
REDISDB:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: cluster-event-reporter-cmd-params-cm
key: redis.db
optional: true
REDIS_COMPRESSION:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: cluster-event-reporter-cmd-params-cm
key: redis.compression
optional: true
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: argocd-redis
name: gitops-runtime-redis
key: auth
REDIS_SERVER:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: cluster-event-reporter-cmd-params-cm
key: redis.server
REDIS_USERNAME:
valueFrom:
secretKeyRef:
name: argocd-redis
name: cluster-event-reporter-cmd-params-cm
key: redis-username
optional: true
REPO_SERVER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,29 @@ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:
REDISDB:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: runtime-event-reporter-cmd-params-cm
key: redis.db
optional: true
REDIS_COMPRESSION:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: runtime-event-reporter-cmd-params-cm
key: redis.compression
optional: true
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: argocd-redis
name: gitops-runtime-redis
key: auth
REDIS_SERVER:
valueFrom:
configMapKeyRef:
name: argocd-cmd-params-cm
name: runtime-event-reporter-cmd-params-cm
key: redis.server
REDIS_USERNAME:
valueFrom:
secretKeyRef:
name: argocd-redis
name: runtime-event-reporter-cmd-params-cm
key: redis-username
optional: true
REPO_SERVER:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: batch/v1
kind: Job
metadata:
name: redis-secret-init
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
helm.sh/hook-weight: "10"
spec:
backoffLimit: 0
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: redis-secret-init
restartPolicy: Never
containers:
- name: redis-secret-init
image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" (index .Values "redis-secret-init" "image") "context" .) }}
imagePullPolicy: {{ index .Values "redis-secret-init" "image" "pullPolicy" | default "IfNotPresent" }}
command: ["sh", "-c"]
args:
- |
PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
if kubectl get secret gitops-runtime-redis -o jsonpath="{.data.auth}" &> /dev/null; then
echo "Secret gitops-runtime-redis already exists, skipping creation"
exit 0
fi
kubectl create secret generic gitops-runtime-redis --from-literal=auth=$PASSWORD --dry-run=client -o yaml | kubectl apply -f -
{{- with (index .Values "redis-secret-init" "nodeSelector") | default .Values.global.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with (index .Values "redis-secret-init" "tolerations") | default .Values.global.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
{{- with (index .Values "redis-secret-init" "affinity") }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: redis-secret-init
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation,hook-failed
helm.sh/hook-weight: "-10"
rules:
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- gitops-runtime-redis
verbs:
- get
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: redis-secret-init
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation,hook-failed
helm.sh/hook-weight: "-10"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: redis-secret-init
subjects:
- kind: ServiceAccount
name: redis-secret-init
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: redis-secret-init
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation,hook-failed
helm.sh/hook-weight: "-10"
48 changes: 48 additions & 0 deletions charts/gitops-runtime/templates/redis/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "redis.fullname" -}}
{{- .Values.redis.fullnameOverride | default (print "redis") }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "redis.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "redis.labels" -}}
helm.sh/chart: {{ include "redis.chart" . }}
{{ include "redis.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: redis
codefresh.io/internal: "true"
{{- end }}

{{/*
Selector labels
*/}}
{{- define "redis.selectorLabels" -}}
app.kubernetes.io/name: redis
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "redis.serviceAccountName" -}}
{{- if .Values.redis.serviceAccount.create }}
{{- default (include "redis.fullname" .) .Values.redis.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.redis.serviceAccount.name }}
{{- end }}
{{- end }}
Loading