Skip to content

Commit

Permalink
feat(kv-db): add default config for redis-like DBs
Browse files Browse the repository at this point in the history
The leaks in short-running pods result in idle connections
to Redict/Valkey, all of these KV-databases have ‹timeout› option in
their config that allows for iterative cleanup of hanging connections.

This mitigates the issue to the point of still having free connections
slots to Redict/Valkey, i.e., the pods shall be killed, but handlers do
not end up in a retry-loop trying to connect to Redict/Valkey.

Since the config is 1:1 between all Redis, Redict, and Valkey, create
one ConfigMap, map the config into the databases and pass the path
to the config as an argument.

Tested with Redict and Valkey. »NOT« tested with Redis.

Related to packit/packit-service#2522

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Oct 8, 2024
1 parent a1211a6 commit c000b31
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openshift/configmap-redis_like_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
name: redis-like-config
data:
redis.conf: |
timeout 1800
6 changes: 6 additions & 0 deletions openshift/redict.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ spec:
containers:
- name: redict
image: registry.redict.io/redict:7
args:
- "/etc/redislike/redis.conf"
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /data
name: redict-pv
- mountPath: /etc/redislike
name: redis-like-config
resources:
# requests and limits have to be the same to have Guaranteed QoS
requests:
Expand All @@ -38,6 +42,8 @@ spec:
- name: redict-pv
persistentVolumeClaim:
claimName: redict-pvc
- name: redis-like-config
configMap: {name: redis-like-config}
replicas: 1
strategy:
type: Recreate
Expand Down
6 changes: 6 additions & 0 deletions openshift/valkey.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ spec:
containers:
- name: valkey
image: valkey/valkey:8.0.0
args:
- "/etc/redislike/redis.conf"
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /data
name: valkey-pv
- mountPath: /etc/redislike
name: redis-like-config
resources:
# requests and limits have to be the same to have Guaranteed QoS
requests:
Expand All @@ -38,6 +42,8 @@ spec:
- name: valkey-pv
persistentVolumeClaim:
claimName: valkey-pvc
- name: redis-like-config
configMap: {name: redis-like-config}
replicas: 1
strategy:
type: Recreate
Expand Down
1 change: 1 addition & 0 deletions playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('file', '{{ project_dir }}/openshift/configmap-redis_like_config.yml') }}"
- "{{ lookup('template', '{{ project_dir }}/openshift/{{ kv_database }}.yml.j2') }}"
when: with_kv_database
tags:
Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('file', '{{ project_dir }}/openshift/configmap-redis_like_config.yml') }}"
- "{{ lookup('template', '{{ project_dir }}/openshift/{{ kv_database }}.yml.j2') }}"
when: with_kv_database
tags:
Expand Down

0 comments on commit c000b31

Please sign in to comment.