Skip to content

Commit e22bfec

Browse files
committed
MintMaker: Deploy Redis for Renovate cache
Redis will be used by renovate PLRs to store and retrieve cache in order to improve performance and decrease the number of API calls. Connection is not password protected, but a network policy exists to restrict access only to pods in the "mintmaker" namespace. I think that a password is unnecessary since it would complicate the deployment and no sensitive or important data will be stored in the database. The persistent volume exists to back up the data so that Redis can reload it after restart. The memory limit was chosen somewhat arbitrarily, but we can increase it if high use is observed over time. OOM errors should not happen since Redis limit is configured lower than Openshift limit.
1 parent 915ca90 commit e22bfec

File tree

7 files changed

+118
-0
lines changed

7 files changed

+118
-0
lines changed

Diff for: components/mintmaker/base/kustomization.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
resources:
22
- cronjobs/
33
- rbac/
4+
- redis-cache/
45

56
apiVersion: kustomize.config.k8s.io/v1beta1
67
kind: Kustomization
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- redis-configmap.yaml
5+
- redis-deployment.yaml
6+
- redis-networkpolicy.yaml
7+
- redis-pvc.yaml
8+
- redis-service.yaml
9+
namespace: mintmaker
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: redis-config
5+
namespace: mintmaker
6+
data:
7+
redis.conf: |
8+
bind 0.0.0.0
9+
protected-mode no
10+
port 6379
11+
maxmemory 800mb
12+
maxmemory-policy allkeys-lru
13+
dir /var/lib/redis/data
14+
15+
appendonly yes
16+
aof-use-rdb-preamble yes
17+
appendfsync everysec
18+
19+
save 900 1
20+
save 300 10
21+
save 60 10000
22+
23+
logfile ""
24+
loglevel notice
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: redis
5+
namespace: mintmaker
6+
spec:
7+
replicas: 1
8+
strategy:
9+
type: Recreate
10+
selector:
11+
matchLabels:
12+
app: redis
13+
template:
14+
metadata:
15+
labels:
16+
app: redis
17+
spec:
18+
containers:
19+
- name: redis
20+
image: registry.redhat.io/rhel9/redis-7:9.5
21+
ports:
22+
- containerPort: 6379
23+
command: ["container-entrypoint"]
24+
args: ["run-redis"]
25+
resources:
26+
requests:
27+
memory: "800Mi"
28+
cpu: "0.75"
29+
limits:
30+
memory: "1Gi"
31+
cpu: "1"
32+
securityContext:
33+
runAsNonRoot: true
34+
runAsUser: 1001120000
35+
readOnlyRootFilesystem: true
36+
volumeMounts:
37+
- name: redis-data
38+
mountPath: /var/lib/redis/data
39+
- name: redis-config
40+
mountPath: /etc/redis/redis.conf
41+
subPath: redis.conf
42+
volumes:
43+
- name: redis-data
44+
persistentVolumeClaim:
45+
claimName: redis-pvc
46+
- name: redis-config
47+
configMap:
48+
name: redis-config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: restrict-redis-access
5+
namespace: mintmaker
6+
spec:
7+
podSelector:
8+
matchLabels:
9+
app: redis
10+
ingress:
11+
- from:
12+
- podSelector: {}

Diff for: components/mintmaker/base/redis-cache/redis-pvc.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: redis-pvc
5+
namespace: mintmaker
6+
spec:
7+
accessModes:
8+
- ReadWriteOnce
9+
resources:
10+
requests:
11+
storage: 5Gi
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: redis
5+
namespace: mintmaker
6+
spec:
7+
selector:
8+
app: redis
9+
ports:
10+
- port: 6379
11+
targetPort: 6379
12+
type: ClusterIP

0 commit comments

Comments
 (0)