Skip to content

Commit a3f9862

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 e48b0bd commit a3f9862

File tree

7 files changed

+124
-0
lines changed

7 files changed

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