Skip to content

Commit

Permalink
Merge branch 'main' into feature/depracate
Browse files Browse the repository at this point in the history
* main:
  feat(argo-cd): Add Probes for redis (argoproj#2400)
  • Loading branch information
pdrastil committed Feb 7, 2024
2 parents accfbfc + 5da5982 commit 2332616
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 2 deletions.
24 changes: 24 additions & 0 deletions charts/argo-cd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,18 @@ server:
| redis.exporter.image.imagePullPolicy | string | `""` (defaults to global.image.imagePullPolicy) | Image pull policy for the redis-exporter |
| redis.exporter.image.repository | string | `"public.ecr.aws/bitnami/redis-exporter"` | Repository to use for the redis-exporter |
| redis.exporter.image.tag | string | `"1.57.0"` | Tag to use for the redis-exporter |
| redis.exporter.livenessProbe.enabled | bool | `false` | Enable Kubernetes liveness probe for Redis exporter |
| redis.exporter.livenessProbe.failureThreshold | int | `5` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
| redis.exporter.livenessProbe.initialDelaySeconds | int | `30` | Number of seconds after the container has started before [probe] is initiated |
| redis.exporter.livenessProbe.periodSeconds | int | `15` | How often (in seconds) to perform the [probe] |
| redis.exporter.livenessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
| redis.exporter.livenessProbe.timeoutSeconds | int | `15` | Number of seconds after which the [probe] times out |
| redis.exporter.readinessProbe.enabled | bool | `false` | Enable Kubernetes liveness probe for Redis exporter (optional) |
| redis.exporter.readinessProbe.failureThreshold | int | `5` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
| redis.exporter.readinessProbe.initialDelaySeconds | int | `30` | Number of seconds after the container has started before [probe] is initiated |
| redis.exporter.readinessProbe.periodSeconds | int | `15` | How often (in seconds) to perform the [probe] |
| redis.exporter.readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
| redis.exporter.readinessProbe.timeoutSeconds | int | `15` | Number of seconds after which the [probe] times out |
| redis.exporter.resources | object | `{}` | Resource limits and requests for redis-exporter sidecar |
| redis.extraArgs | list | `[]` | Additional command line arguments to pass to redis-server |
| redis.extraContainers | list | `[]` | Additional containers to be added to the redis pod |
Expand All @@ -1048,6 +1060,12 @@ server:
| redis.image.tag | string | `"7.0.15-alpine"` | Redis tag |
| redis.imagePullSecrets | list | `[]` (defaults to global.imagePullSecrets) | Secrets with credentials to pull images from a private registry |
| redis.initContainers | list | `[]` | Init containers to add to the redis pod |
| redis.livenessProbe.enabled | bool | `false` | Enable Kubernetes liveness probe for Redis server |
| redis.livenessProbe.failureThreshold | int | `5` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
| redis.livenessProbe.initialDelaySeconds | int | `30` | Number of seconds after the container has started before [probe] is initiated |
| redis.livenessProbe.periodSeconds | int | `15` | How often (in seconds) to perform the [probe] |
| redis.livenessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
| redis.livenessProbe.timeoutSeconds | int | `15` | Number of seconds after which the [probe] times out |
| redis.metrics.enabled | bool | `false` | Deploy metrics service |
| redis.metrics.service.annotations | object | `{}` | Metrics service annotations |
| redis.metrics.service.clusterIP | string | `"None"` | Metrics service clusterIP. `None` makes a "headless service" (no virtual IP) |
Expand Down Expand Up @@ -1075,6 +1093,12 @@ server:
| redis.podAnnotations | object | `{}` | Annotations to be added to the Redis server pods |
| redis.podLabels | object | `{}` | Labels to be added to the Redis server pods |
| redis.priorityClassName | string | `""` (defaults to global.priorityClassName) | Priority class for redis pods |
| redis.readinessProbe.enabled | bool | `false` | Enable Kubernetes liveness probe for Redis server |
| redis.readinessProbe.failureThreshold | int | `5` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
| redis.readinessProbe.initialDelaySeconds | int | `30` | Number of seconds after the container has started before [probe] is initiated |
| redis.readinessProbe.periodSeconds | int | `15` | How often (in seconds) to perform the [probe] |
| redis.readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
| redis.readinessProbe.timeoutSeconds | int | `15` | Number of seconds after which the [probe] times out |
| redis.resources | object | `{}` | Resource limits and requests for redis |
| redis.securityContext | object | See [values.yaml] | Redis pod-level security context |
| redis.service.annotations | object | `{}` | Redis service annotations |
Expand Down
58 changes: 56 additions & 2 deletions charts/argo-cd/templates/redis/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,32 @@ spec:
envFrom:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.redis.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.redis.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.redis.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.redis.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.livenessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/redis_liveness.sh
{{- end }}
{{- if .Values.redis.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.redis.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.redis.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.redis.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.readinessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/redis_readiness.sh
{{- end }}
ports:
- name: redis
containerPort: {{ .Values.redis.containerPorts.redis }}
Expand All @@ -82,8 +108,10 @@ spec:
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.redis.volumeMounts }}
volumeMounts:
- mountPath: /health
name: health
{{- with .Values.redis.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.redis.exporter.enabled }}
Expand All @@ -102,6 +130,28 @@ spec:
- name: metrics
containerPort: {{ .Values.redis.containerPorts.metrics }}
protocol: TCP
{{- if .Values.redis.exporter.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /metrics
port: {{ .Values.redis.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.redis.exporter.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.redis.exporter.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.redis.exporter.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.redis.exporter.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.exporter.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.redis.exporter.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /metrics
port: {{ .Values.redis.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.redis.exporter.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.redis.exporter.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.redis.exporter.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.redis.exporter.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.exporter.readinessProbe.failureThreshold }}
{{- end }}
resources:
{{- toYaml .Values.redis.exporter.resources | nindent 10 }}
{{- with .Values.redis.exporter.containerSecurityContext }}
Expand Down Expand Up @@ -139,8 +189,12 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.redis.volumes }}
volumes:
- name: health
configMap:
name: {{ include "argo-cd.redis.fullname" . }}-health-configmap
defaultMode: 0755
{{- with .Values.redis.volumes }}
{{- toYaml . | nindent 8}}
{{- end }}
{{- with .Values.redis.dnsConfig }}
Expand Down
35 changes: 35 additions & 0 deletions charts/argo-cd/templates/redis/health-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- $redisHa := index .Values "redis-ha" -}}
{{- if and .Values.redis.enabled (not $redisHa.enabled) -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "argo-cd.redis.fullname" . }}-health-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
data:
redis_liveness.sh: |
response=$(
redis-cli \
-h localhost \
-p {{ .Values.redis.containerPorts.redis }} \
ping
)
if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then
echo "$response"
exit 1
fi
echo "response=$response"
redis_readiness.sh: |
response=$(
redis-cli \
-h localhost \
-p {{ .Values.redis.containerPorts.redis }} \
ping
)
if [ "$response" != "PONG" ] ; then
echo "$response"
exit 1
fi
echo "response=$response"
{{- end }}
58 changes: 58 additions & 0 deletions charts/argo-cd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,35 @@ redis:
drop:
- ALL

## Probes for Redis exporter (optional)
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
readinessProbe:
# -- Enable Kubernetes liveness probe for Redis exporter (optional)
enabled: false
# -- Number of seconds after the container has started before [probe] is initiated
initialDelaySeconds: 30
# -- How often (in seconds) to perform the [probe]
periodSeconds: 15
# -- Number of seconds after which the [probe] times out
timeoutSeconds: 15
# -- Minimum consecutive successes for the [probe] to be considered successful after having failed
successThreshold: 1
# -- Minimum consecutive failures for the [probe] to be considered failed after having succeeded
failureThreshold: 5
livenessProbe:
# -- Enable Kubernetes liveness probe for Redis exporter
enabled: false
# -- Number of seconds after the container has started before [probe] is initiated
initialDelaySeconds: 30
# -- How often (in seconds) to perform the [probe]
periodSeconds: 15
# -- Number of seconds after which the [probe] times out
timeoutSeconds: 15
# -- Minimum consecutive successes for the [probe] to be considered successful after having failed
successThreshold: 1
# -- Minimum consecutive failures for the [probe] to be considered failed after having succeeded
failureThreshold: 5

# -- Resource limits and requests for redis-exporter sidecar
resources: {}
# limits:
Expand Down Expand Up @@ -1213,6 +1242,35 @@ redis:
# - secretRef:
# name: secret-name

## Probes for Redis server (optional)
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
readinessProbe:
# -- Enable Kubernetes liveness probe for Redis server
enabled: false
# -- Number of seconds after the container has started before [probe] is initiated
initialDelaySeconds: 30
# -- How often (in seconds) to perform the [probe]
periodSeconds: 15
# -- Number of seconds after which the [probe] times out
timeoutSeconds: 15
# -- Minimum consecutive successes for the [probe] to be considered successful after having failed
successThreshold: 1
# -- Minimum consecutive failures for the [probe] to be considered failed after having succeeded
failureThreshold: 5
livenessProbe:
# -- Enable Kubernetes liveness probe for Redis server
enabled: false
# -- Number of seconds after the container has started before [probe] is initiated
initialDelaySeconds: 30
# -- How often (in seconds) to perform the [probe]
periodSeconds: 15
# -- Number of seconds after which the [probe] times out
timeoutSeconds: 15
# -- Minimum consecutive successes for the [probe] to be considered successful after having failed
successThreshold: 1
# -- Minimum consecutive failures for the [probe] to be considered failed after having succeeded
failureThreshold: 5

# -- Additional containers to be added to the redis pod
## Note: Supports use of custom Helm templates
extraContainers: []
Expand Down

0 comments on commit 2332616

Please sign in to comment.