Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ CACHE_PORT: {{ (splitList ":" (include "codefresh-gitops-runtime.argocd.redis.ur
CACHE_PASSWORD:
valueFrom:
secretKeyRef:
name: gitops-runtime-redis
name: {{ ternary "gitops-runtime-redis" "argocd-redis" (or .Values.redis.enabled (index .Values "redis-ha" "enabled")) }}
key: auth
CF_SERVICE_NAME: {{ $appProxyName }}
CF_SERVICE_VERSION: {{ $appProxyVersion }}
Expand Down
4 changes: 3 additions & 1 deletion charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ Determine argocd redis url
{{- $port := .Values.redis.service.ports.redis.port }}
{{- printf "%s:%v" $serviceName $port }}
{{- else }}
{{- fail "ERROR: .Values.redis or .Values.redis-ha must be enabled!" }}
{{- $serviceName := index .Values "global" "integrations" "argo-cd" "redis" "svc" }}
{{- $port := index .Values "global" "integrations" "argo-cd" "redis" "port" }}
{{- printf "%s:%v" $serviceName $port }}
{{- end }}
{{- end}}

Expand Down
2 changes: 1 addition & 1 deletion charts/gitops-runtime/templates/argo-gateway/_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ REDIS_COMPRESSION:
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: gitops-runtime-redis
name: {{ ternary "gitops-runtime-redis" "argocd-redis" (or .Values.redis.enabled (index .Values "redis-ha" "enabled")) }}
key: auth
REDIS_SERVER:
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{- $context := deepCopy . }}
{{- $_ := set $context "Values" (deepCopy (get .Values "argo-gateway")) }}
{{- $_ := set $context.Values "redis" (deepCopy (get .Values "redis")) }}
{{- $_ := set $context.Values "redis-ha" (deepCopy (get .Values "redis-ha")) }}
{{- $_ := set $context.Values "global" (deepCopy (get .Values "global")) }}
{{/* Merge environment variables from calculated, defaults and overwrites */}}
{{- $defaults := (include "argo-gateway.resources.environment-variables.defaults" $context | fromYaml) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ REDIS_COMPRESSION:
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: gitops-runtime-redis
name: {{ ternary "gitops-runtime-redis" "argocd-redis" (or .Values.redis.enabled (index .Values "redis-ha" "enabled")) }}
key: auth
REDIS_SERVER:
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{- $context := deepCopy . }}
{{- $_ := set $context "Values" (deepCopy (get (index .Values "global") "event-reporters")) }}
{{- $_ := set $context.Values "redis" (deepCopy (get .Values "redis")) }}
{{- $_ := set $context.Values "redis-ha" (deepCopy (get .Values "redis-ha")) }}
{{- $_ := set $context.Values "global" (deepCopy (get .Values "global")) }}
{{/* Merge .Values.event-reporters.<event-reporter-name> with .Values.global.event-reporters */}}
{{- $valuesOverrides := index .Values "event-reporters" "cluster-event-reporter" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ REDIS_COMPRESSION:
REDIS_PASSWORD:
valueFrom:
secretKeyRef:
name: gitops-runtime-redis
name: {{ ternary "gitops-runtime-redis" "argocd-redis" (or .Values.redis.enabled (index .Values "redis-ha" "enabled")) }}
key: auth
REDIS_SERVER:
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{- $context := deepCopy . }}
{{- $_ := set $context "Values" (deepCopy (get (index .Values "global") "event-reporters")) }}
{{- $_ := set $context.Values "redis" (deepCopy (get .Values "redis")) }}
{{- $_ := set $context.Values "redis-ha" (deepCopy (get .Values "redis-ha")) }}
{{- $_ := set $context.Values "global" (deepCopy (get .Values "global")) }}
{{/* Merge .Values.event-reporters.<event-reporter-name> with .Values.global.event-reporters */}}
{{- $valuesOverrides := index .Values "event-reporters" "runtime-event-reporter" }}
Expand Down
16 changes: 14 additions & 2 deletions charts/gitops-runtime/tests/argo-api-gateway_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suite: argo-gateway tests
templates:
- argo-gateway/**
tests:
- it: Argo Api Gateway ConfigMap should have valid data
- it: Argo Api Gateway ConfigMap should have valid data (default)
template: argo-gateway/configmap.yaml
values:
- ./values/mandatory-values-ingress.yaml
Expand All @@ -13,11 +13,23 @@ tests:
value: argo-cd-server:80
- equal:
path: data["redis.server"]
value: runtime-redis:6379
value: argo-cd-redis:6379
- equal:
path: data["repo.server"]
value: argo-cd-repo-server:8081

- it: Argo Api Gateway ConfigMap should have valid redis url
set:
redis:
enabled: true
template: argo-gateway/configmap.yaml
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: data["redis.server"]
value: runtime-redis:6379

- it: Argo Api Gateway Deployment should have valid matchLabel selectors
template: argo-gateway/deployment.yaml
values:
Expand Down
49 changes: 46 additions & 3 deletions charts/gitops-runtime/tests/event-reporters_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,26 @@ tests:
path: metadata.name
value: runtime-event-reporter

- it: Runtime Reporter ConfigMap should have valid data
- it: Runtime Reporter ConfigMap should have valid data (default)
template: event-reporters/runtime-event-reporter/configmap.yaml
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: data["argocd.server"]
value: argo-cd-server:80
- equal:
path: data["redis.server"]
value: argo-cd-redis:6379
- equal:
path: data["repo.server"]
value: argo-cd-repo-server:8081

- it: Runtime Reporter ConfigMap should have valid data (.Values.redis.enabled=true)
template: event-reporters/runtime-event-reporter/configmap.yaml
set:
redis:
enabled: true
values:
- ./values/mandatory-values-ingress.yaml
asserts:
Expand All @@ -45,7 +63,7 @@ tests:
path: data["repo.server"]
value: argo-cd-repo-server:8081

- it: Runtime Reporter ConfigMap should have valid redis-ha url
- it: Runtime Reporter ConfigMap should have valid redis-ha url (.Values.redis-ha.enabled=true)
template: event-reporters/runtime-event-reporter/configmap.yaml
values:
- ./values/mandatory-values-ingress.yaml
Expand Down Expand Up @@ -168,8 +186,33 @@ tests:
cpu: 200m
memory: 256Mi

- it: Runtime Reporter should have correct REDIS_ environment variables
- it: Runtime Reporter should have correct REDIS_ environment variables (default)
template: event-reporters/runtime-event-reporter/deployment.yaml
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_SERVER
valueFrom:
configMapKeyRef:
name: runtime-event-reporter-cmd-params-cm
key: redis.server
- contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: argocd-redis
key: auth

- it: Runtime Reporter should have correct REDIS_ environment variables (.Values.redis.enabled=true or .Values.redis-ha.enabled=true)
template: event-reporters/runtime-event-reporter/deployment.yaml
set:
redis:
enabled: true
values:
- ./values/mandatory-values-ingress.yaml
asserts:
Expand Down
4 changes: 2 additions & 2 deletions charts/gitops-runtime/tests/external_argocd_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ tests:
asserts:
- equal:
path: data["redis.server"]
value: runtime-redis:6379
value: argo-cd-redis:6379

- it: runtime-event-reporter ConfigMap should have valid Sources Server address
template: event-reporters/runtime-event-reporter/configmap.yaml
Expand Down Expand Up @@ -555,7 +555,7 @@ tests:
asserts:
- equal:
path: data["redis.server"]
value: runtime-redis:6379
value: argo-cd-redis:6379

- it: argo-gateway ConfigMap should have valid Repo Server URL
template: argo-gateway/configmap.yaml
Expand Down
31 changes: 27 additions & 4 deletions charts/gitops-runtime/tests/redis_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ templates:
- redis/**
- charts/redis-ha/**
tests:
- it: Standalone Redis Deployment should be created by default
- it: Standalone Redis Deployment should be created when redis.enabled is true
set:
redis:
enabled: true
template: redis/deployment.yaml
values:
- ./values/mandatory-values-ingress.yaml
Expand All @@ -33,22 +36,22 @@ tests:
name: runtime-redis
not: true

- it: App-Proxy should have CACHE_ environment variables (standalone Redis)
- it: App-Proxy should have CACHE_ environment variables (ArgoCD Redis)
template: app-proxy/deployment.yaml
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_HOST")].value
value: runtime-redis
value: argo-cd-redis
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_PORT")].value
value: "6379"
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_PASSWORD")].valueFrom
value:
secretKeyRef:
name: gitops-runtime-redis
name: argocd-redis
key: auth

- it: App-Proxy should have CACHE_ environment variables (Redis HA)
Expand All @@ -70,3 +73,23 @@ tests:
secretKeyRef:
name: gitops-runtime-redis
key: auth

- it: App-Proxy should have CACHE_ environment variables (Standalone Redis)
template: app-proxy/deployment.yaml
set:
redis.enabled: true
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_HOST")].value
value: runtime-redis
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_PORT")].value
value: "6379"
- equal:
path: spec.template.spec.containers[0].env[?(@.name=="CACHE_PASSWORD")].valueFrom
value:
secretKeyRef:
name: gitops-runtime-redis
key: auth
7 changes: 6 additions & 1 deletion charts/gitops-runtime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ global:
svc: argo-cd-repo-server
# -- Port of the ArgoCD repo server
port: 8081
redis:
# -- Service name of the ArgoCD Redis
svc: argo-cd-redis
# -- Port of the ArgoCD Redis
port: 6379
# -- Configuration for external Argo Rollouts
external-argo-rollouts:
# -- Rollout reporter settings
Expand Down Expand Up @@ -759,7 +764,7 @@ redis-secret-init:
# -- Standalone redis deployment
# Will be replaced by redis-ha subchart when `redis-ha.enabled=true`
redis:
enabled: true
enabled: false
fullnameOverride: "runtime-redis"
# -- Redis image
image:
Expand Down