Skip to content

Commit 8fbc68c

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 8fbc68c

File tree

7 files changed

+122
-0
lines changed

7 files changed

+122
-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,49 @@
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+
serviceAccountName: mintmaker-controller-manager
19+
containers:
20+
- name: redis
21+
image: registry.redhat.io/rhel9/redis-7:9.5
22+
ports:
23+
- containerPort: 6379
24+
command: ["container-entrypoint"]
25+
args: ["run-redis"]
26+
resources:
27+
requests:
28+
memory: "800Mi"
29+
cpu: "0.75"
30+
limits:
31+
memory: "1Gi"
32+
cpu: "1"
33+
securityContext:
34+
runAsNonRoot: true
35+
runAsUser: 1001
36+
readOnlyRootFilesystem: true
37+
volumeMounts:
38+
- name: redis-data
39+
mountPath: /var/lib/redis/data
40+
- name: redis-config
41+
mountPath: /etc/redis/redis.conf
42+
subPath: redis.conf
43+
volumes:
44+
- name: redis-data
45+
persistentVolumeClaim:
46+
claimName: redis-pvc
47+
- name: redis-config
48+
configMap:
49+
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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: redis-pvc
5+
namespace: mintmaker
6+
spec:
7+
accessModes:
8+
- ReadWriteOnce
9+
mountOptions:
10+
- dir_mode=0777
11+
- file_mode=0777
12+
resources:
13+
requests:
14+
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)