-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add redis/redisreplication/redissentinel/rediscluster chart (#1007
) Signed-off-by: drivebyer <[email protected]>
- Loading branch information
Showing
34 changed files
with
1,850 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ jobs: | |
- name: Install and test Redis Related Helm charts | ||
run: | | ||
kubectl cluster-info --context kind-kind | ||
chart_dirs=("redis-operator") | ||
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel") | ||
for dir in "${chart_dirs[@]}" | ||
do | ||
if [[ -f ./charts/$dir/Chart.yaml ]]; then | ||
|
@@ -104,8 +104,15 @@ jobs: | |
run: | | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo update | ||
helm dependency update charts/redis-operator | ||
helm package charts/redis-operator -d .cr-release-packages | ||
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel") | ||
for dir in "${chart_dirs[@]}" | ||
do | ||
if [[ -f ./charts/$dir/Chart.yaml ]]; then | ||
helm dependency update ./charts/$dir/ | ||
fi | ||
helm package charts/$dir -d .cr-release-packages | ||
done | ||
- name: Install chart-releaser | ||
uses: helm/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v2 | ||
name: redis-cluster | ||
description: Provides easy redis setup definitions for Kubernetes services, and deployment. | ||
version: 0.16.0 | ||
appVersion: "0.16.0" | ||
home: https://github.com/ot-container-kit/redis-operator | ||
sources: | ||
- https://github.com/ot-container-kit/redis-operator | ||
maintainers: | ||
- name: iamabhishek-dubey | ||
- name: sandy724 | ||
- name: shubham-cmyk | ||
keywords: | ||
- operator | ||
- redis | ||
- opstree | ||
- kubernetes | ||
- openshift | ||
- redis-exporter | ||
icon: https://github.com/OT-CONTAINER-KIT/redis-operator/raw/master/static/redis-operator-logo.svg | ||
type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Redis Cluster | ||
|
||
Redis is a key-value based distributed database, this helm chart is for redis cluster setup. This helm chart needs [Redis Operator](../redis-operator) inside Kubernetes cluster. The redis cluster definition can be modified or changed by [values.yaml](./values.yaml). | ||
|
||
```shell | ||
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/ | ||
|
||
helm install <my-release> ot-helm/redis-cluster \ | ||
--set redisCluster.clusterSize=3 --namespace <namespace> | ||
``` | ||
|
||
Redis setup can be upgraded by using `helm upgrade` command:- | ||
|
||
```shell | ||
helm upgrade <my-release> ot-helm/redis-cluster --install \ | ||
--set redisCluster.clusterSize=5 --namespace <namespace> | ||
``` | ||
|
||
For uninstalling the chart:- | ||
|
||
```shell | ||
helm delete <my-release> --namespace <namespace> | ||
``` | ||
|
||
## Pre-Requisities | ||
|
||
- Kubernetes 1.15+ | ||
- Helm 3.X | ||
- Redis Operator 0.7.0 | ||
|
||
## Parameters | ||
|
||
| **Name** | **Default Value** | **Description** | | ||
|------------------------------------|--------------------------------|-----------------------------------------------------------------------------------------------| | ||
| `imagePullSecrets` | [] | List of image pull secrets, in case redis image is getting pull from private registry | | ||
| `redisCluster.clusterSize` | 3 | Size of the redis cluster leader and follower nodes | | ||
| `redisCluster.clusterVersion` | v7 | Major version of Redis setup, values can be v6 or v7 | | ||
| `redisCluster.persistenceEnabled` | true | Persistence should be enabled or not in the Redis cluster setup | | ||
| `redisCluster.secretName` | redis-secret | Name of the existing secret in Kubernetes | | ||
| `redisCluster.secretKey` | password | Name of the existing secret key in Kubernetes | | ||
| `redisCluster.image` | quay.io/opstree/redis | Name of the redis image | | ||
| `redisCluster.tag` | v6.2 | Tag of the redis image | | ||
| `redisCluster.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | | ||
| `redisCluster.leaderServiceType` | ClusterIP | Kubernetes service type for Redis Leader | | ||
| `redisCluster.followerServiceType` | ClusterIP | Kubernetes service type for Redis Follower | | ||
| `redisCluster.name` | "" | Overwrites the name for the charts resources instead of the Release name | | ||
| `externalService.enabled` | false | If redis service needs to be exposed using LoadBalancer or NodePort | | ||
| `externalService.annotations` | {} | Kubernetes service related annotations | | ||
| `externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | | ||
| `externalService.port` | 6379 | Port number on which redis external service should be exposed | | ||
| `serviceMonitor.enabled` | false | Servicemonitor to monitor redis with Prometheus | | ||
| `serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. | | ||
| `serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended | | ||
| `serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running | | ||
| `redisExporter.enabled` | true | Redis exporter should be deployed or not | | ||
| `redisExporter.image` | quay.io/opstree/redis-exporter | Name of the redis exporter image | | ||
| `redisExporter.tag` | v6.2 | Tag of the redis exporter image | | ||
| `redisExporter.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis exporter image | | ||
| `redisExporter.env` | [] | Extra environment variables which needs to be added in redis exporter | | ||
| `sidecars` | [] | Sidecar for redis pods | | ||
| `nodeSelector` | {} | NodeSelector for redis statefulset | | ||
| `priorityClassName` | "" | Priority class name for the redis statefulset | | ||
| `storageSpec` | {} | Storage configuration for redis setup | | ||
| `securityContext` | {} | Security Context for redis pods for changing system or kernel level parameters | | ||
| `affinity` | {} | Affinity for node and pods for redis statefulset | | ||
| `tolerations` | [] | Tolerations for redis statefulset | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* Define common labels */}} | ||
{{- define "common.labels" -}} | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
{{- if .Values.labels }} | ||
{{- range $labelkey, $labelvalue := .Values.labels }} | ||
{{ $labelkey}}: {{ $labelvalue }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* Helper for Redis Cluster (leader & follower) */}} | ||
{{- define "redis.role" -}} | ||
{{- if .affinity }} | ||
affinity: | ||
{{- toYaml .affinity | nindent 2 }} | ||
{{- end }} | ||
{{- if .tolerations }} | ||
tolerations: | ||
{{- toYaml .tolerations | nindent 2 }} | ||
{{- end }} | ||
{{- if .pdb.enabled }} | ||
pdb: | ||
enabled: {{ .pdb.enabled }} | ||
maxUnavailable: {{ .pdb.maxUnavailable }} | ||
minAvailable: {{ .pdb.minAvailable }} | ||
{{- end }} | ||
{{- if .nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml .nodeSelector | nindent 2 }} | ||
{{- end }} | ||
{{- if .securityContext }} | ||
securityContext: | ||
{{- toYaml .securityContext | nindent 2 }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* Generate sidecar properties */}} | ||
{{- define "sidecar.properties" -}} | ||
{{- with .Values.sidecars }} | ||
name: {{ .name }} | ||
image: {{ .image }} | ||
{{- if .imagePullPolicy }} | ||
imagePullPolicy: {{ .imagePullPolicy }} | ||
{{- end }} | ||
{{- if .resources }} | ||
resources: | ||
{{ toYaml .resources | nindent 2 }} | ||
{{- end }} | ||
{{- if .env }} | ||
env: | ||
{{ toYaml .env | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* Generate init container properties */}} | ||
{{- define "initContainer.properties" -}} | ||
{{- with .Values.initContainer }} | ||
{{- if .enabled }} | ||
image: {{ .image }} | ||
{{- if .imagePullPolicy }} | ||
imagePullPolicy: {{ .imagePullPolicy }} | ||
{{- end }} | ||
{{- if .resources }} | ||
resources: | ||
{{ toYaml .resources | nindent 2 }} | ||
{{- end }} | ||
{{- if .env }} | ||
env: | ||
{{ toYaml .env | nindent 2 }} | ||
{{- end }} | ||
{{- if .command }} | ||
command: | ||
{{ toYaml .command | nindent 2 }} | ||
{{- end }} | ||
{{- if .args }} | ||
args: | ||
{{ toYaml .args | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if eq .Values.externalConfig.enabled true }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Values.redisCluster.name | default .Release.Name }}-ext-config | ||
labels: | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
data: | ||
redis-additional.conf: | | ||
{{ .Values.externalConfig.data | nindent 4 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{- if and (gt (int .Values.redisCluster.follower.replicas) 0) (eq .Values.externalService.enabled true) }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-external-service | ||
{{- if .Values.externalService.annotations }} | ||
annotations: | ||
{{ toYaml .Values.externalService.annotations | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
spec: | ||
type: {{ .Values.externalService.serviceType }} | ||
selector: | ||
app: {{ .Values.redisCluster.name | default .Release.Name }}-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.externalService.port }} | ||
targetPort: 6379 | ||
name: client | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- if and (eq .Values.serviceMonitor.enabled true) (gt (int .Values.redisCluster.follower.replicas) 0) }} | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-prometheus-monitoring | ||
labels: | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Values.redisCluster.name | default .Release.Name }}-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
endpoints: | ||
- port: redis-exporter | ||
interval: {{ .Values.serviceMonitor.interval }} | ||
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Values.serviceMonitor.namespace }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{- if and (gt (int .Values.redisCluster.leader.replicas) 0) (eq .Values.externalService.enabled true) }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-external-service | ||
{{- if .Values.externalService.annotations }} | ||
annotations: | ||
{{ toYaml .Values.externalService.annotations | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
spec: | ||
type: {{ .Values.externalService.serviceType }} | ||
selector: | ||
app: {{ .Values.redisCluster.name | default .Release.Name }}-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.externalService.port }} | ||
targetPort: 6379 | ||
name: client | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- if and (eq .Values.serviceMonitor.enabled true) (gt (int .Values.redisCluster.leader.replicas) 0) }} | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-prometheus-monitoring | ||
labels: | ||
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/component: middleware | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Values.redisCluster.name | default .Release.Name }}-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
endpoints: | ||
- port: redis-exporter | ||
interval: {{ .Values.serviceMonitor.interval }} | ||
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Values.serviceMonitor.namespace }} | ||
{{- end }} |
Oops, something went wrong.