a87b1c0c by Adam Heath

Add basic redis-server.

1 parent a742dade
1 ---
2 apiVersion: v1
3 kind: ConfigMap
4 metadata:
5 name: redis-config
6 data:
7 ---
8 apiVersion: v1
9 kind: Secret
10 metadata:
11 name: redis-secret
12 stringData:
13 ---
14 apiVersion: v1
15 kind: PersistentVolumeClaim
16 metadata:
17 name: redis-data
18 spec:
19 accessModes:
20 - ReadWriteOnce
21 resources:
22 requests:
23 storage: 10Gi
24 ---
25
26
1 environments:
2 default:
3 values:
4 - namespace: redis
5 namePrefix: "test-"
6 redisServer:
7 jsonPatches: []
8 strategicMergePatches: []
9 images:
10 redis: "redis:6.2.6"
11
12 ---
13 releases:
14
15 - name: {{ .Values.namePrefix }}redis-server
16 namespace: {{ .Values.namespace }}
17 chart: .
18 values:
19 - set-common-values.yaml.gotmpl
20 jsonPatches:
21 {{- if not (empty (.Values.redisServer.jsonPatches)) }}
22 {{- .Values.redisServer.jsonPatches | toYaml | indent 6 }}
23 {{- end }}
24 strategicMergePatches:
25 - apiVersion: apps/v1
26 kind: Deployment
27 metadata:
28 name: {{ .Values.namePrefix }}redis-server
29 namespace: {{ .Values.namespace }}
30 spec:
31 selector:
32 matchLabels:
33 app: {{ .Values.namePrefix }}redis-server
34 template:
35 metadata:
36 labels:
37 app: {{ .Values.namePrefix }}redis-server
38 spec:
39 volumes:
40 - name: redis-data
41 persistentVolumeClaim:
42 claimName: {{ .Values.namePrefix }}redis-data
43 - apiVersion: v1
44 kind: Service
45 metadata:
46 name: {{ .Values.namePrefix }}redis
47 namespace: {{ .Values.namespace }}
48 spec:
49 selector:
50 app: {{ .Values.namePrefix }}redis-server
51 {{- if not (empty (.Values.redisServer.strategicMergePatches)) }}
52 {{- .Values.redisServer.strategicMergePatches | toYaml | indent 6 }}
53 {{- end }}
54
1 apiVersion: kustomize.config.k8s.io/v1beta1
2 kind: Kustomization
3
4 resources:
5 - ./config.yaml
6 - ./redis-server.yaml
7
1 ---
2 apiVersion: v1
3 kind: Service
4 metadata:
5 name: redis
6 spec:
7 selector:
8 app: redis-server
9 ports:
10 - name: redis
11 protocol: TCP
12 port: 6379
13 targetPort: 6379
14 ---
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata:
18 name: redis-server
19 labels:
20 app: redis-server
21 spec:
22 replicas: 1
23 progressDeadlineSeconds: 600
24 selector:
25 matchLabels:
26 app: redis-server
27 template:
28 metadata:
29 labels:
30 app: redis-server
31 spec:
32 restartPolicy: Always
33 securityContext:
34 runAsUser: 0
35 runAsGroup: 0
36
37 volumes:
38 - name: redis-data
39 persistentVolumeClaim:
40 claimName: redis-data
41
42 containers:
43 - name: redis
44 image: redis
45 #securityContext:
46 # runAsUser: 1001
47 # runAsGroup: 1001
48 args: ["--loglevel", "warning"]
49 volumeMounts:
50 - name: redis-data
51 mountPath: /var/lib/redis
52
1 namePrefix: {{ .Values.namePrefix }}
2 namespace: {{ .Values.namespace }}
3 images:
4 - name: redis
5 newName: {{ .Values.images.redis }}
6