Skip to content

Commit 3dcad72

Browse files
committed
add helm chart
1 parent 2094768 commit 3dcad72

16 files changed

+1129
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.helmignore
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v2
2+
type: application
3+
4+
name: redis-enterprise-operator
5+
description: A Helm chart for Redis Enterprise Operator for Kubernetes
6+
7+
version: 0.1.0
8+
appVersion: 100.0.1-23708
9+
10+
home: https://redis.com
11+
icon: https://redis.com/wp-content/themes/wpx/assets/images/logo-redis.svg
12+
keywords:
13+
- redis
14+
- database
15+
maintainers:
16+
- name: Redis
17+
url: https://redis.com/company/contact/
+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Redis Enterprise Operator Helm Chart
2+
3+
Official Helm chart for installing, configuring and upgrading **Redis Enterprise Operator for Kubernetes**.
4+
5+
[Redis Enterprise](https://redis.com/redis-enterprise-software/overview/) is a self-managed data platform that unlocks the full potential of Redis at enterprise scale - on premises or in the cloud.
6+
[Redis Enterprise Operator for Kubernetes](https://redis.com/redis-enterprise-software/redis-enterprise-on-kubernetes/) provides a simple, Kubernetes-native way for deploying and managing Redis Enterprise on Kubernetes.
7+
8+
## Prerequisites
9+
10+
- Kubernetes 1.23+
11+
Supported Kubernetes versions can vary according to the Kubernetes distribution being used.
12+
Please consult the [release notes](https://redis.io/docs/latest/operate/kubernetes/release-notes/) for detailed supported distributions information per operator version.
13+
- Helm 3.10+
14+
15+
## Installing the Chart
16+
17+
To install the chart:
18+
19+
```sh
20+
helm install [RELEASE_NAME] [PATH_TO_CHART]
21+
```
22+
23+
The `[PATH_TO_CHART]` may be a path to the chart root directory, or a chart archive on the local filesystem.
24+
25+
To install the chart on **OpenShift**, set the `openshift.mode=true` value:
26+
27+
```sh
28+
helm install [RELEASE_NAME] [PATH_TO_CHART] \
29+
--set openshift.mode=true
30+
```
31+
32+
To create and select a namespace for the installation, specify the `--namespace` and `--create-namespace` flags:
33+
34+
```sh
35+
helm install [RELEASE_NAME] [PATH_TO_CHART] \
36+
--namespace [NAMESPACE] \
37+
--create-namespace
38+
```
39+
40+
For example, to install the chart with release name "my-redis-enterprise" from within the chart's root directory:
41+
42+
```sh
43+
helm install my-redis-enterprise . \
44+
--namespace redis-enterprise \
45+
--create-namespace
46+
```
47+
48+
Note: the chart installation includes several jobs that configure the CRDs and admission controller used by the operator.
49+
These jobs run synchronously during the execution of `helm install` command, and may take around 1 minute to complete.
50+
To view additional progress information during the `helm install` execution, use the `--debug` flag:
51+
52+
```sh
53+
helm install [RELEASE_NAME] [PATH_TO_CHART] \
54+
--debug
55+
```
56+
57+
See [Configuration](#configuration) section below for various configuration options.
58+
See [Creating a Redis Enterprise Cluster](#creating-a-redis-enterprise-cluster) section below for instructions for creating a Redis Enterprise Cluster.
59+
See [helm install](https://helm.sh/docs/helm/helm_install/) and [Using Helm](https://helm.sh/docs/intro/using_helm/#helm-install-installing-a-package) for more information and options when installing charts.
60+
61+
## Uninstalling the Chart
62+
63+
Before uninstalling the chart, delete any custom resources managed by the Redis Enterprise Operator:
64+
65+
```sh
66+
kubectl delete redb <name>
67+
kubectl delete rerc <name>
68+
kubectl delete reaadb <name>
69+
kubectl delete rec <name>
70+
```
71+
72+
To uninstall a previously installed chart:
73+
74+
```sh
75+
helm uninstall [RELEASE_NAME]
76+
```
77+
78+
This removes all the Kubernetes resources associated with the chart and deletes the release.
79+
80+
See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for more information and options when uninstalling charts.
81+
82+
## Creating a Redis Enterprise Cluster
83+
84+
Once the chart is installed and the Redis Enterprise Operator is running, a Redis Enterprise Cluster can be created.
85+
As of now, the Redis Enterprise Cluster is created directly via custom resources, and not via Helm.
86+
87+
To create a Redis Enterprise Cluster:
88+
89+
1. Validate that the `redis-enterprise-operator` pod is in `RUNNING` state:
90+
91+
```sh
92+
kubectl get pods -n [NAMESPACE]
93+
```
94+
95+
2. Create a file for the `RedisEnterpriseCluster` custom resource:
96+
97+
```yaml
98+
apiVersion: app.redislabs.com/v1
99+
kind: RedisEnterpriseCluster
100+
metadata:
101+
name: rec
102+
spec:
103+
nodes: 3
104+
```
105+
106+
3. Apply the custom resource:
107+
108+
```sh
109+
kubectl apply -f rec.yaml -n [NAMESPACE]
110+
```
111+
112+
See [Create a Redis Enterprise cluster](https://redis.io/docs/latest/operate/kubernetes/deployment/quick-start/#create-a-redis-enterprise-cluster-rec) and [Redis Enterprise Cluster API](https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/redis_enterprise_cluster_api.md) for more information and options for creating a Redis Enterprise Cluster.
113+
114+
## Configuration
115+
116+
The chart supports several configuration options that allows to customize the behavior and capabilities of the Redis Enterprise Operator.
117+
For a list of configurable options and their descriptions, please refer to the `values.yaml` file at the root of the chart.
118+
119+
To install the chart with a customized values file:
120+
121+
```sh
122+
helm install [RELEASE_NAME] [PATH_TO_CHART] \
123+
--values [PATH_TO_VALUES_FILE]
124+
```
125+
126+
To install the chart with the default values files but with some specific values overriden:
127+
128+
```sh
129+
helm install [RELEASE_NAME] [PATH_TO_CHART] \
130+
--set key1=value1 \
131+
--set key2=value2
132+
```
133+
134+
See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing) for additional information on how to customize the chart installation.
135+
136+
## Known Limitations
137+
138+
This is a preliminary release of this Helm chart, and as of now some if its functionality is still limited:
139+
140+
- The chart only installs the Redis Enterprise Operator, but doesn't create a Redis Enterprise Cluster. See [Creating a Redis Enterprise Cluster](#creating-a-redis-enterprise-cluster) section for instructions on how to directly create a Redis Enterprise Cluster.
141+
- Several configuration options for the operator are still unsupported, including multiple REDB namespaces, rack-aware, and vault integration. These options can be enabled by following the relevant instructions in the [product documentation](https://redis.io/docs/latest/operate/kubernetes/).
142+
- CRDs installed by the chart are not removed upon chart uninstallation. These could be manually removed when the chart is uninstalled and are no longer needed, using the following command:
143+
```sh
144+
kubectl delete crds -l app=redis-enterprise
145+
```
146+
- Helm chart upgrades are not supported, nor migrations from a non-Helm deployment to a Helm deployment.
147+
- Limited testing in advanced setups such as Active-Active configurations, airgapped deployments, IPv6/dual-stack environments.
148+
- The chart is still unpublished in a "helm repo" or ArtifactHub, and thus can only be installed from a local source (chart directory/archive).
149+
- While not really a limitation, please note that this chart also installs the [admission controller](https://redis.io/docs/latest/operate/kubernetes/deployment/quick-start/#enable-the-admission-controller) by default, and there's no option to disable it (as opposed to the non-Helm deployment).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- define "redis-enterprise-operator.operator.image" }}
2+
{{- if (.Values.global).azure }}
3+
{{- with .Values.global.azure.images.operator }}
4+
{{ .registry }}/{{ .image }}@{{ .digest }}
5+
{{- end }}
6+
{{- else }}
7+
{{- $defaultRepository := ternary "registry.connect.redhat.com/redislabs/redis-enterprise-operator" "redislabs/operator-internal" .Values.openshift.mode }}
8+
{{- $repository := default $defaultRepository .Values.operator.image.repository }}
9+
{{ $repository }}:{{ .Values.operator.image.tag }}
10+
{{- end }}
11+
{{- end }}
12+
13+
{{- define "redis-enterprise-operator.annotations" }}
14+
{{- if ne .Values.versionAnnotations false -}}
15+
redis.io/helm-chart-ver: {{ .Chart.Version }}
16+
redis.io/operator-ver: {{ .Values.operator.image.tag }}
17+
{{- end }}
18+
{{- end }}
19+
20+
{{/*
21+
Evaluates to a TLS configuration for the admission webhook, either by retrieving an
22+
existing configuration from the "admission-tls" Secret, or by generating a new one.
23+
Returns a TLS configuration YAML object with a "cert" and "privateKey" keys.
24+
*/}}
25+
{{- define "redis-enterprise-operator.admissionTLSConfig" }}
26+
{{- $tlsConfig := dict }}
27+
{{- $secret := (lookup "v1" "Secret" .Release.Namespace "admission-tls") }}
28+
{{- if $secret }}
29+
{{ $tlsConfig = $secret.data }}
30+
{{- else}}
31+
{{ $cna := printf "admission.%s" .Release.Namespace }}
32+
{{ $cnb := printf "admission.%s.svc" .Release.Namespace }}
33+
{{ $cnc := printf "admission.%s.svc.cluster.local" .Release.Namespace }}
34+
{{ $cert := genSelfSignedCert $cnb nil (list $cna $cnb $cnc) (int (mul 365 5)) }}
35+
{{ $_ := set $tlsConfig "cert" ($cert.Cert | b64enc) }}
36+
{{ $_ := set $tlsConfig "privateKey" ($cert.Key | b64enc) }}
37+
{{- end }}
38+
{{ $tlsConfig | toYaml | nindent 2 }}
39+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: admission
5+
labels:
6+
app: redis-enterprise
7+
annotations:
8+
{{- include "redis-enterprise-operator.annotations" . | nindent 4}}
9+
spec:
10+
ports:
11+
- port: 443
12+
protocol: TCP
13+
targetPort: 8443
14+
selector:
15+
name: redis-enterprise-operator
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: redis-enterprise-crds
6+
annotations:
7+
"redis/operator-ver": {{ .Values.operator.image.tag }}
8+
"redis/helm-chart-ver": {{ .Chart.Version }}
9+
"helm.sh/hook": pre-install, pre-upgrade
10+
"helm.sh/hook-weight": "-4"
11+
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
12+
labels:
13+
app: redis-enterprise
14+
spec:
15+
template:
16+
metadata:
17+
labels:
18+
app: redis-enterprise
19+
spec:
20+
containers:
21+
- name: gatekeeper-crds
22+
image: {{ include "redis-enterprise-operator.operator.image" . | printf "%s" | trim }}
23+
securityContext:
24+
allowPrivilegeEscalation: false
25+
capabilities:
26+
drop: ["ALL"]
27+
runAsNonRoot: true
28+
seccompProfile:
29+
type: "RuntimeDefault"
30+
command:
31+
- crd-installer
32+
args:
33+
- "-action=applyCRD"
34+
- "-crdPaths=/crds/rec_crd.yaml,/crds/redb_crd.yaml,/crds/reaadb_crd.yaml,/crds/rerc_crd.yaml"
35+
resources:
36+
limits:
37+
cpu: 100m
38+
memory: 100Mi
39+
serviceAccountName: redis-enterprise-crds
40+
restartPolicy: OnFailure
41+
imagePullSecrets:
42+
{{- range .Values.imagePullSecrets }}
43+
- name: {{ . }}
44+
{{- end }}
45+
46+
---
47+
apiVersion: rbac.authorization.k8s.io/v1
48+
kind: ClusterRole
49+
metadata:
50+
name: redis-enterprise-crds
51+
annotations:
52+
"redis/operator-ver": {{ .Values.operator.image.tag }}
53+
"redis/helm-chart-ver": {{ .Chart.Version }}
54+
"helm.sh/hook": pre-install, pre-upgrade
55+
"helm.sh/hook-weight": "-5"
56+
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
57+
labels:
58+
app: redis-enterprise
59+
rules:
60+
- apiGroups: ["apiextensions.k8s.io"]
61+
resources: ["customresourcedefinitions"]
62+
verbs: ["create", "get", "list", "watch", "patch"]
63+
---
64+
apiVersion: rbac.authorization.k8s.io/v1
65+
kind: ClusterRoleBinding
66+
metadata:
67+
name: redis-enterprise-crds
68+
annotations:
69+
"redis/operator-ver": {{ .Values.operator.image.tag }}
70+
"redis/helm-chart-ver": {{ .Chart.Version }}
71+
"helm.sh/hook": pre-install, pre-upgrade
72+
"helm.sh/hook-weight": "-5"
73+
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
74+
labels:
75+
app: redis-enterprise
76+
roleRef:
77+
apiGroup: rbac.authorization.k8s.io
78+
kind: ClusterRole
79+
name: redis-enterprise-crds
80+
subjects:
81+
- kind: ServiceAccount
82+
name: redis-enterprise-crds
83+
namespace: {{ .Release.Namespace }}
84+
---
85+
apiVersion: v1
86+
kind: ServiceAccount
87+
metadata:
88+
name: redis-enterprise-crds
89+
namespace: {{ .Release.Namespace }}
90+
annotations:
91+
"redis/operator-ver": {{ .Values.operator.image.tag }}
92+
"redis/helm-chart-ver": {{ .Chart.Version }}
93+
"helm.sh/hook": pre-install, pre-upgrade
94+
"helm.sh/hook-weight": "-5"
95+
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
96+
labels:
97+
app: redis-enterprise

0 commit comments

Comments
 (0)