From 057f54347b744de02f965a99895e46f87e82b110 Mon Sep 17 00:00:00 2001 From: petar-cvit Date: Tue, 9 Apr 2024 19:43:44 +0200 Subject: [PATCH] redis init --- redis/Chart.yaml | 3 +++ redis/templates/primary.yaml | 35 +++++++++++++++++++++++++++++++++++ redis/templates/replica.yaml | 23 +++++++++++++++++++++++ redis/values.schema.json | 26 ++++++++++++++++++++++++++ redis/values.yaml | 2 ++ 5 files changed, 89 insertions(+) create mode 100644 redis/Chart.yaml create mode 100644 redis/templates/primary.yaml create mode 100644 redis/templates/replica.yaml create mode 100644 redis/values.schema.json create mode 100644 redis/values.yaml diff --git a/redis/Chart.yaml b/redis/Chart.yaml new file mode 100644 index 0000000..c8149b5 --- /dev/null +++ b/redis/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v1 +name: mysql +version: 0.0.0 diff --git a/redis/templates/primary.yaml b/redis/templates/primary.yaml new file mode 100644 index 0000000..12c4f7c --- /dev/null +++ b/redis/templates/primary.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name }}-redis +spec: + replicas: 1 + selector: + matchLabels: + app: redis + role: primary + template: + metadata: + labels: + app: redis + role: primary + spec: + containers: + - name: redis + image: "redis:{{- .Values.name }}" + ports: + - containerPort: 6379 + name: redis +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.name }}-redis +spec: + selector: + app: redis + role: primary + ports: + - protocol: TCP + port: 6379 + targetPort: 6379 diff --git a/redis/templates/replica.yaml b/redis/templates/replica.yaml new file mode 100644 index 0000000..15b1ee8 --- /dev/null +++ b/redis/templates/replica.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name }}-redis-replica +spec: + replicas: 2 + selector: + matchLabels: + app: redis + role: replica + template: + metadata: + labels: + app: redis + role: replica + spec: + containers: + - name: redis + image: redis:latest + command: ["redis-server", "--slaveof", "{{ .Values.name }}-redis", "6379"] + ports: + - containerPort: 6379 + name: redis diff --git a/redis/values.schema.json b/redis/values.schema.json new file mode 100644 index 0000000..051d17d --- /dev/null +++ b/redis/values.schema.json @@ -0,0 +1,26 @@ +{ + "properties": { + "name": { + "description": "Database name", + "type": "string" + }, + "version": { + "description": "Container image version", + "type": "string", + "enum": [ + "6.0", + "5.0" + ] + } + }, + "order": [ + "name", + "version" + ], + "required": [ + "name", + "version" + ], + "title": "Values", + "type": "object" +} diff --git a/redis/values.yaml b/redis/values.yaml new file mode 100644 index 0000000..28998bf --- /dev/null +++ b/redis/values.yaml @@ -0,0 +1,2 @@ +name: my-database +version: 6.0