mirror of
https://github.com/bitnami/charts.git
synced 2026-03-13 14:57:24 +08:00
[bitnami/redis-cluster] New Redis cluster topology (#2018)
* [bitnami/redis] New Redis cluster topology Signed-off-by: Miguel A. Cabrera Minagorri <macabrera@bitnami.com> * Move the PR to a new Chart instead of override the old Redis * Remove the standalone option * Adapt to Rediscluster container * Change templates from redis to redis-cluster * Support only LoadBalancer for external access * Move persistence from /data to /bitnami * [bitnami/redis-cluster Adapt the Helm Chart to the new container Signed-off-by: Miguel A. Cabrera Minagorri <macabrera@bitnami.com> * Adapt to the container refactorization * Add job to add Redis Nodes to the cluster * Address requested changes * Update common dependency * Remove common dependency until we fix the CI/CD
This commit is contained in:
committed by
GitHub
parent
87cd81bacb
commit
2f3891c411
3
bitnami/redis-cluster/.helmignore
Normal file
3
bitnami/redis-cluster/.helmignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.git
|
||||
# OWNERS file for Kubernetes
|
||||
OWNERS
|
||||
19
bitnami/redis-cluster/Chart.yaml
Normal file
19
bitnami/redis-cluster/Chart.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
name: redis-cluster
|
||||
version: 1.0.0
|
||||
appVersion: 5.0.7
|
||||
description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
|
||||
keywords:
|
||||
- redis
|
||||
- keyvalue
|
||||
- database
|
||||
home: http://redis.io/
|
||||
icon: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-redis
|
||||
maintainers:
|
||||
- name: Bitnami
|
||||
email: containers@bitnami.com
|
||||
- name: desaintmartin
|
||||
email: cedric@desaintmartin.fr
|
||||
engine: gotpl
|
||||
448
bitnami/redis-cluster/README.md
Normal file
448
bitnami/redis-cluster/README.md
Normal file
@@ -0,0 +1,448 @@
|
||||
|
||||
# Redis
|
||||
|
||||
[Redis](http://redis.io/) is an advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```bash
|
||||
# Testing configuration
|
||||
$ helm install my-release bitnami/redis-cluster
|
||||
```
|
||||
|
||||
```bash
|
||||
# Production configuration
|
||||
$ helm install my-release bitnami/redis-cluster --values values-production.yaml
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [Redis](https://github.com/bitnami/bitnami-docker-redis) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.12+
|
||||
- Helm 2.11+ or Helm 3.0-beta3+
|
||||
- PV provisioner support in the underlying infrastructure
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm install my-release bitnami/redis-cluster
|
||||
```
|
||||
|
||||
The command deploys Redis on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||
|
||||
NOTE: if you get a timeout error waiting for the hook to complete increase the default timeout (300s) to a higher one, for example:
|
||||
|
||||
```
|
||||
helm install --timeout 600s myrelease bitnami/redis-cluster
|
||||
```
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Parameters
|
||||
|
||||
The following table lists the configurable parameters of the Redis chart and their default values.
|
||||
|
||||
#### Global parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `global.imageRegistry` | Global Docker image registry | `nil` |
|
||||
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
|
||||
| `global.redis.password` | Redis password (overrides `password`) | `nil` |
|
||||
|
||||
#### Common parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `image.registry` | Redis Image registry | `docker.io` |
|
||||
| `image.repository` | Redis Image name | `bitnami/redis` |
|
||||
| `image.tag` | Redis Image tag | `{TAG_NAME}` |
|
||||
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||
| `nameOverride` | String to partially override redis.fullname template with a string (will prepend the release name) | `nil` |
|
||||
| `fullnameOverride` | String to fully override redis.fullname template with a string | `nil` |
|
||||
| `existingSecret` | Name of existing secret object (for password authentication) | `nil` |
|
||||
| `existingSecretPasswordKey` | Name of key containing password to be retrieved from the existing secret | `nil` |
|
||||
| `usePassword` | Use password | `true` |
|
||||
| `usePasswordFile` | Mount passwords as files instead of environment variables | `false` |
|
||||
| `password` | Redis password (ignored if existingSecret set) | Randomly generated |
|
||||
| `configmap` | Additional common Redis node configuration (this value is evaluated as a template) | See values.yaml |
|
||||
| `clusterDomain` | Kubernetes DNS Domain name to use | `cluster.local` |
|
||||
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
|
||||
| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
|
||||
| `networkPolicy.ingressNSMatchLabels` | Allow connections from other namespaces | `{}` |
|
||||
| `networkPolicy.ingressNSPodMatchLabels` | For other namespaces match by pod labels and namespace labels | `{}` |
|
||||
| `podSecurityContext.enabled` | Enable pods' security context | `true` |
|
||||
| `podSecurityContext.fsGroup` | Group ID for the pods. | `1001` |
|
||||
| `podSecurityContext.runAsUser` | User ID for the pods. | `1001` |
|
||||
| `podSecurityContext.sysctls` | Set namespaced sysctls for the pods. | `nil` |
|
||||
| `containerSecurityContext.enabled` | Enable container's security context | `true` |
|
||||
| `containerSecurityContext.fsGroup` | Group ID for the containers. | `1001` |
|
||||
| `containerSecurityContext.runAsUser` | User ID for the containers. | `1001` |
|
||||
| `containerSecurityContext.sysctls` | Set namespaced sysctls for the containers. | `nil` |
|
||||
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` |
|
||||
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the fullname template |
|
||||
| `rbac.create` | Specifies whether RBAC resources should be created | `false` |
|
||||
| `rbac.role.rules` | Rules to create | `[]` |
|
||||
| `persistence.enabled` | Use a PVC to persist data. | `true` |
|
||||
| `persistence.path` | Path to mount the volume at, to use other images | `/bitnami/redis/data` |
|
||||
| `persistence.subPath` | Subdirectory of the volume to mount at | `""` |
|
||||
| `persistence.storageClass` | Storage class of backing PVC | `generic` |
|
||||
| `persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
|
||||
| `persistence.size` | Size of data volume | `8Gi` |
|
||||
| `persistence.matchLabels` | matchLabels persistent volume selector | `{}` |
|
||||
| `persistence.matchExpressions` | matchExpressions persistent volume selector | `{}` |
|
||||
| `statefulset.updateStrategy` | Update strategy for StatefulSet | onDelete |
|
||||
| `statefulset.rollingUpdatePartition` | Partition update strategy | `nil` |
|
||||
| `podLabels` | Additional labels for Redis pod | {} |
|
||||
| `podAnnotations` | Additional annotations for Redis pod | {} |
|
||||
| `redisPort` | Redis port. | `6379` |
|
||||
| `command` | Redis entrypoint string. The command `redis-server` is executed if this is not provided. | `nil` |
|
||||
| `args` | Arguments for the provided command if needed | `nil` |
|
||||
| `configmap` | Additional Redis configuration for the nodes (this value is evaluated as a template) | `nil` |
|
||||
| `extraFlags` | Redis additional command line flags | [] |
|
||||
| `nodeSelector` | Redis Node labels for pod assignment | {"beta.kubernetes.io/arch": "amd64"} |
|
||||
| `tolerations` | Toleration labels for Redis pod assignment | [] |
|
||||
| `affinity` | Affinity settings for Redis pod assignment | {} |
|
||||
| `schedulerName` | Name of an alternate scheduler | `nil` |
|
||||
| `service.port` | Kubernetes Service port. | `6379` |
|
||||
| `service.annotations` | annotations for redis service | {} |
|
||||
| `service.labels` | Additional labels for redis service | {} |
|
||||
| `resources` | Redis CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` |
|
||||
| `livenessProbe.enabled` | Turn on and off liveness probe. | `true` |
|
||||
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated. | `30` |
|
||||
| `livenessProbe.periodSeconds` | How often to perform the probe. | `30` |
|
||||
| `livenessProbe.timeoutSeconds` | When the probe times out. | `5` |
|
||||
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
|
||||
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||
| `readinessProbe.enabled` | Turn on and off readiness probe. | `true` |
|
||||
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated. | `5` |
|
||||
| `readinessProbe.periodSeconds` | How often to perform the probe. | `10` |
|
||||
| `readinessProbe.timeoutSeconds` | When the probe times out. | `1` |
|
||||
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
|
||||
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `5` |
|
||||
| `priorityClassName` | Redis Master pod priorityClassName | {} |
|
||||
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the registry (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
|
||||
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
|
||||
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` |
|
||||
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `buster` |
|
||||
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
|
||||
| `volumePermissions.resources` | Init container volume-permissions CPU/Memory resource requests/limits | {} |
|
||||
| `volumePermissions.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `extraVolumes` | Array of extra volumes to be added to all pods (evaluated as a template). Requires setting `extraVolumeMounts` | `[]` |
|
||||
| `extraVolumeMounts` | Array of extra volume mounts to be added to all pods (evaluated as a template). Normally used with `extraVolumes` | `[]` |
|
||||
| `extraEnvVars` | Array containing extra env vars to be added to all pods (evaluated as a template) | `[]` |
|
||||
| `extraEnvVarsConfigMap` | ConfigMap containing extra env vars to be added to all pods (evaluated as a template) | `nil` |
|
||||
| `extraEnvVarsSecret` | Secret containing extra env vars to be added to all pods (evaluated as a template) | `nil` |
|
||||
| `extraInitContainers` | Init containers to add to the cronjob container | {} |
|
||||
| `podSecurityPolicy.create` | Specifies whether a PodSecurityPolicy should be created | `false` |
|
||||
| `sidecars` | Attach additional containers to the pod (evaluated as a template) | `nil`
|
||||
|
||||
#### Redis cluster parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `cluster.init` | Enable the creation of a job that initializes the Redis Cluster | `true` |
|
||||
| `cluster.activeDeadlineSeconds` | Number of seconds that the job to create the cluster will be waiting for the nodes to be ready | `600` |
|
||||
| `cluster.nodes` | Number of nodes in the Redis cluster | `6` |
|
||||
| `cluster.replicas` | Number of replicas for every master in the cluster | `1` |
|
||||
| `cluster.busPort` | Port for the Redis gossip protocol | `16379` |
|
||||
| `cluster.externalAccess.enabled` | Enable access to the Redis cluster from Outside the Kubernetes Cluster | `false` |
|
||||
| `cluster.externalAccess.service.type` | Type for the services used to expose every Pod | `LoadBalancer` |
|
||||
| `cluster.externalAccess.service.port` | Port for the services used to expose every Pod | `6379` |
|
||||
| `cluster.externalAccess.service.loadBalancerIP` | Array of LoadBalancer IPs used to expose every Pod of the Redis cluster when `cluster.externalAccess.service.type` is `LoadBalancer` | `[]` |
|
||||
| `cluster.externalAccess.service.annotations` | Annotations to add to the services used to expose every Pod of the Redis Cluster | `{}` |
|
||||
| `cluster.update.addNodes` | Boolean to specify if you want to add nodes after the upgrade | `false` |
|
||||
| `cluster.update.currentNumberOfNodes` | Number of currently deployed Redis nodes | `6` |
|
||||
| `cluster.update.newExternalIPs` | External IPs obtained from the services for the new nodes to add to the cluster | `nil` |
|
||||
|
||||
#### Metrics sidecar parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
|
||||
| `metrics.image.registry` | Redis exporter image registry | `docker.io` |
|
||||
| `metrics.image.repository` | Redis exporter image name | `bitnami/redis-exporter` |
|
||||
| `metrics.image.tag` | Redis exporter image tag | `{TAG_NAME}` |
|
||||
| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||
| `metrics.extraArgs` | Extra arguments for the binary; possible values [here](https://github.com/oliver006/redis_exporter#flags) | {} |
|
||||
| `metrics.podLabels` | Additional labels for Metrics exporter pod | {} |
|
||||
| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | {} |
|
||||
| `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` |
|
||||
| `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
|
||||
| `metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` |
|
||||
| `metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
|
||||
| `metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
|
||||
| `metrics.service.type` | Kubernetes Service type (redis metrics) | `ClusterIP` |
|
||||
| `metrics.service.annotations` | Annotations for the services to monitor. | {} |
|
||||
| `metrics.service.labels` | Additional labels for the metrics service | {} |
|
||||
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
|
||||
| `metrics.priorityClassName` | Metrics exporter pod priorityClassName | {} |
|
||||
| `metrics.prometheusRule.enabled` | Set this to true to create prometheusRules for Prometheus operator | `false` |
|
||||
| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so prometheusRules will be discovered by Prometheus | `{}` |
|
||||
| `metrics.prometheusRule.namespace` | namespace where prometheusRules resource should be created | Same namespace as redis |
|
||||
| `metrics.prometheusRule.rules` | [rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) to be created, check values for an example. | `[]` |
|
||||
|
|
||||
|
||||
#### Sysctl Image parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `sysctlImage.enabled` | Enable an init container to modify Kernel settings | `false` |
|
||||
| `sysctlImage.command` | sysctlImage command to execute | [] |
|
||||
| `sysctlImage.registry` | sysctlImage Init container registry | `docker.io` |
|
||||
| `sysctlImage.repository` | sysctlImage Init container name | `bitnami/minideb` |
|
||||
| `sysctlImage.tag` | sysctlImage Init container tag | `buster` |
|
||||
| `sysctlImage.pullPolicy` | sysctlImage Init container pull policy | `Always` |
|
||||
| `sysctlImage.mountHostSys` | Mount the host `/sys` folder to `/host-sys` | `false` |
|
||||
| `sysctlImage.resources` | sysctlImage Init container CPU/Memory resource requests/limits | {} |
|
||||
| `sysctlImage.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install my-release \
|
||||
--set password=secretpassword \
|
||||
bitnami/redis-cluster
|
||||
```
|
||||
|
||||
The above command sets the Redis server password to `secretpassword`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
```bash
|
||||
$ helm install my-release -f values.yaml bitnami/redis-cluster
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
> **Note for minikube users**: Current versions of minikube (v0.24.1 at the time of writing) provision `hostPath` persistent volumes that are only writable by root. Using chart defaults cause pod failure for the Redis pod as it attempts to write to the `/bitnami` directory. Consider installing Redis with `--set persistence.enabled=false`. See minikube issue [1990](https://github.com/kubernetes/minikube/issues/1990) for more information.
|
||||
|
||||
## Configuration and installation details
|
||||
|
||||
### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
|
||||
|
||||
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
|
||||
|
||||
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
|
||||
|
||||
### Production configuration
|
||||
|
||||
This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one.
|
||||
|
||||
- Enable NetworkPolicy:
|
||||
```diff
|
||||
- networkPolicy.enabled: false
|
||||
+ networkPolicy.enabled: true
|
||||
```
|
||||
|
||||
- Start a side-car prometheus exporter:
|
||||
```diff
|
||||
- metrics.enabled: false
|
||||
+ metrics.enabled: true
|
||||
```
|
||||
|
||||
### Cluster topology
|
||||
|
||||
The Helm Chart will deploy by default 3 redis masters and 3 replicas. By default the Redis Cluster is not accessible from outside the Kubernetes cluster, to the Redis cluster to the outside set `cluster.externalAccess.enabled=true`, it will create in the first installation only 6 LoadBalancer services, one for each Redis node, once you have the external IPs of each service you will need to perform an upgrade passing those IPs to the `cluster.externalAccess.service.loadbalancerIP` array.
|
||||
|
||||
The replicas will be read-only replicas of the masters. By default only one service is exposed (when not using the external access mode). You will connect your client to the exposed service, regardless you need to read or write. When a write operation arrives to a replica it will redirect the client to the master node. For example, using `redis-cli` you will need to provide the `-c` flag for `redis-cli` to follow the redirection automatically.
|
||||
|
||||
Using the external access mode, you can connect to any of the pods and the slaves will redirect the client in the same way as explained before, but the all the IPs will be public.
|
||||
|
||||
In case the master crashes, one of the slaves will be promoted to master. The slots stored by the crashed master will be unavailable until the slave finish the promotion. If a master and all his slaves crash, the cluster will be down until one of them is up again. To avoid downtime, it is possible to configure the number of Redis nodes with `cluster.nodes` and the number of replicas that will be assigned to each master with `cluster.replicas`. For example:
|
||||
- `cluster.nodes=9` ( 3 master plus 2 replicas for each master)
|
||||
- `cluster.replicas=2`
|
||||
|
||||
Providing the values above, the cluster will have 3 masters and, each master, will have 2 replicas.
|
||||
|
||||
> NOTE: By default `cluster.init` will be set to `true` in order to initialize the Redis Cluster in the first installation. If for testing purpose you only want to deploy or upgrade the nodes but avoiding the creation of the cluster you can set `cluster.init` to `false`.
|
||||
|
||||
#### Adding a new node to the cluster
|
||||
|
||||
There is a job that will be executed using a `post-upgrade` hook that will allow you to add a new node. To use it, you should provide some parameters to the upgrade:
|
||||
|
||||
- Pass as `password` the password used in the installation time. If you did not provide a password follow the intructions from the NOTES.txt to get the generated password.
|
||||
- Set the desired number of nodes at `cluster.nodes`.
|
||||
- Set the number of current nodes at `cluster.update.currentNumberOfNodes`.
|
||||
- Set to true `cluster.update.addNodes`.
|
||||
|
||||
The following will be an example to add one more node:
|
||||
|
||||
```
|
||||
helm upgrade --timeout 600s <release> --set "password=${REDIS_PASSWORD},cluster.nodes=7,cluster.update.addNodes=true,cluster.update.currentNumberOfNodes=6" bitnami/redis-cluster
|
||||
```
|
||||
|
||||
Where `REDIS_PASSWORD` is the password obtained with the command that appears after the first installation of the Helm Chart.
|
||||
The cluster will continue up while restarting pods one by one as the quorum is not lost.
|
||||
|
||||
##### External Access
|
||||
|
||||
If you are using external access, to add a new node you will need to perform two upgrades. First upgrade the release to add a new Redis node and to get a LoadBalancerIP service. For example:
|
||||
|
||||
```
|
||||
helm upgrade <release> --set "password=${REDIS_PASSWORD},cluster.externalAccess.enabled=true,cluster.externalAccess.service.type=LoadBalancer,cluster.externalAccess.service.loadBalancerIP[0]=<loadBalancerip-0>,cluster.externalAccess.service.loadBalancerIP[1]=<loadbalanacerip-1>,cluster.externalAccess.service.loadBalancerIP[2]=<loadbalancerip-2>,cluster.externalAccess.service.loadBalancerIP[3]=<loadbalancerip-3>,cluster.externalAccess.service.loadBalancerIP[4]=<loadbalancerip-4>,cluster.externalAccess.service.loadBalancerIP[5]=<loadbalancerip-5>,cluster.externalAccess.service.loadBalancerIP[6]=,cluster.nodes=7,cluster.init=false bitnami/redis-cluster
|
||||
```
|
||||
|
||||
> Important here to provide the loadBalancerIP parameters for the new nodes empty to not get an index error.
|
||||
|
||||
As we want to add a new node, we are setting `cluster.nodes=7` and we leave empty the LoadBalancerIP for the new node, so the cluster will provide the correct one.
|
||||
`REDIS_PASSWORD` is the password obtained with the command that appears after the first installation of the Helm Chart.
|
||||
At this point, you will have a new Redis Pod that will remain in `crashLoopBackOff` state until we provide the LoadBalancerIP for the new service.
|
||||
Now, wait until the cluster provides the new LoadBalancerIP for the new service and perform the second upgrade:
|
||||
|
||||
```
|
||||
helm upgrade <release> --set "password=${REDIS_PASSWORD},cluster.externalAccess.enabled=true,cluster.externalAccess.service.type=LoadBalancer,cluster.externalAccess.service.loadBalancerIP[0]=<loadbalancerip-0>,cluster.externalAccess.service.loadBalancerIP[1]=<loadbalancerip-1>,cluster.externalAccess.service.loadBalancerIP[2]=<loadbalancerip-2>,cluster.externalAccess.service.loadBalancerIP[3]=<loadbalancerip-3>,cluster.externalAccess.service.loadBalancerIP[4]=<loadbalancerip-4>,cluster.externalAccess.service.loadBalancerIP[5]=<loadbalancerip-5>,cluster.externalAccess.service.loadBalancerIP[6]=<loadbalancerip-6>,cluster.nodes=7,cluster.init=false,cluster.update.addNodes=true,cluster.update.newExternalIPs[0]=<load-balancerip-6>" bitnami/redis-cluster
|
||||
```
|
||||
|
||||
Note we are providing the new IPs at `cluster.update.newExternalIPs`, the flag `cluster.update.addNodes=true` to enable the creation of the Job that adds a new node and now we are setting the LoadBalancerIP of the new service instead of leave it empty.
|
||||
|
||||
> NOTE: To avoid the creation of the Job that initializes the Redis Cluster again, you will need to provide `cluster.init=false`.
|
||||
|
||||
#### Scale down the cluster
|
||||
|
||||
To scale down the redis cluster just perform a normal upgrade setting the `cluster.nodes` value to the desired number of nodes. It should not be less than `6`. Also it is needed to provide the password using the `password`. For example, having more than 6 nodes, to scale down the cluster to 6 nodes:
|
||||
|
||||
```
|
||||
helm upgrade --timeout 600s <release> --set "password=${REDIS_PASSWORD},cluster.nodes=6" .
|
||||
```
|
||||
|
||||
The cluster will continue working during the update as long as the quorum is not lost.
|
||||
|
||||
> NOTE: To avoid the creation of the Job that initializes the Redis Cluster again, you will need to provide `cluster.init=false`.
|
||||
|
||||
### Using password file
|
||||
To use a password file for Redis you need to create a secret containing the password.
|
||||
|
||||
> *NOTE*: It is important that the file with the password must be called `redis-password`
|
||||
|
||||
And then deploy the Helm Chart using the secret name as parameter:
|
||||
|
||||
```console
|
||||
usePassword=true
|
||||
usePasswordFile=true
|
||||
existingSecret=redis-password-secret
|
||||
metrics.enabled=true
|
||||
```
|
||||
|
||||
### Sidecars and Init Containers
|
||||
|
||||
If you have a need for additional containers to run within the same pod as Redis (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec.
|
||||
|
||||
```yaml
|
||||
sidecars:
|
||||
- name: your-image-name
|
||||
image: your-image
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: portname
|
||||
containerPort: 1234
|
||||
```
|
||||
|
||||
Similarly, you can add extra init containers using the `initContainers` parameter.
|
||||
|
||||
```yaml
|
||||
initContainers:
|
||||
- name: your-image-name
|
||||
image: your-image
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: portname
|
||||
containerPort: 1234
|
||||
```
|
||||
|
||||
### Adding extra environment variables
|
||||
|
||||
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property.
|
||||
|
||||
```yaml
|
||||
extraEnvVars:
|
||||
- name: REDIS_WHATEVER
|
||||
value: value
|
||||
```
|
||||
|
||||
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `extraEnvVarsCM` or the `extraEnvVarsSecret` values.
|
||||
|
||||
### Metrics
|
||||
|
||||
The chart optionally can start a metrics exporter for [prometheus](https://prometheus.io). The metrics endpoint (port 9121) is exposed in the service. Metrics can be scraped from within the cluster using something similar as the described in the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml). If metrics are to be scraped from outside the cluster, the Kubernetes API proxy can be utilized to access the endpoint.
|
||||
|
||||
### Host Kernel Settings
|
||||
Redis may require some changes in the kernel of the host machine to work as expected, in particular increasing the `somaxconn` value and disabling transparent huge pages.
|
||||
To do so, you can set up a privileged initContainer with the `sysctlImage` config values, for example:
|
||||
```
|
||||
sysctlImage:
|
||||
enabled: true
|
||||
mountHostSys: true
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |-
|
||||
install_packages procps
|
||||
sysctl -w net.core.somaxconn=10000
|
||||
echo never > /host-sys/kernel/mm/transparent_hugepage/enabled
|
||||
```
|
||||
|
||||
Alternatively, for Kubernetes 1.12+ you can set `podSecurityContext.sysctls` which will configure sysctls for master and slave pods. Example:
|
||||
|
||||
```yaml
|
||||
podSecurityContext:
|
||||
sysctls:
|
||||
- name: net.core.somaxconn
|
||||
value: "10000"
|
||||
```
|
||||
|
||||
Note that this will not disable transparent huge tables.
|
||||
|
||||
## Helm Upgrade
|
||||
|
||||
By default `cluster.init` will be set to `true` in order to initialize the Redis Cluster in the first installation. If for testing purpose you only want to deploy or upgrade the nodes but avoiding the creation of the cluster you can set `cluster.init` to `false`.
|
||||
|
||||
## Persistence
|
||||
|
||||
By default, the chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at the `/bitnami` path. The volume is created using dynamic volume provisioning. If a Persistent Volume Claim already exists, specify it during installation.
|
||||
|
||||
## NetworkPolicy
|
||||
|
||||
To enable network policy for Redis, install
|
||||
[a networking plugin that implements the Kubernetes NetworkPolicy spec](https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy#before-you-begin),
|
||||
and set `networkPolicy.enabled` to `true`.
|
||||
|
||||
For Kubernetes v1.5 & v1.6, you must also turn on NetworkPolicy by setting
|
||||
the DefaultDeny namespace annotation. Note: this will enforce policy for _all_ pods in the namespace:
|
||||
|
||||
kubectl annotate namespace default "net.beta.kubernetes.io/network-policy={\"ingress\":{\"isolation\":\"DefaultDeny\"}}"
|
||||
|
||||
With NetworkPolicy enabled, only pods with the generated client label will be
|
||||
able to connect to Redis. This label will be displayed in the output
|
||||
after a successful install.
|
||||
|
||||
With `networkPolicy.ingressNSMatchLabels` pods from other namespaces can connect to redis. Set `networkPolicy.ingressNSPodMatchLabels` to match pod labels in matched namespace. For example, for a namespace labeled `redis=external` and pods in that namespace labeled `redis-client=true` the fields should be set:
|
||||
|
||||
```
|
||||
networkPolicy:
|
||||
enabled: true
|
||||
ingressNSMatchLabels:
|
||||
redis: external
|
||||
ingressNSPodMatchLabels:
|
||||
redis-client: true
|
||||
```
|
||||
64
bitnami/redis-cluster/templates/NOTES.txt
Normal file
64
bitnami/redis-cluster/templates/NOTES.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
** Please be patient while the chart is being deployed **
|
||||
|
||||
{{ if .Values.usePassword }}
|
||||
To get your password run:
|
||||
|
||||
export REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "redis-cluster.secretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode)
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
|
||||
To connect to your Redis server from outside the cluster check the following information:
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "redis-cluster.fullname" . }}'
|
||||
|
||||
You will have a different external IP for each Redis node. Get the external ip from `-external` suffixed services: `kubectl get svc`.
|
||||
Redis port: {{ .Values.cluster.externalAccess.service.port }}
|
||||
|
||||
{{- if not .Values.cluster.externalAccess.service.loadBalancerIP }}
|
||||
Once the LoadBalancerIPs are ready, you need to provide them and perform a Helm Upgrade:
|
||||
|
||||
helm upgrade {{ .Release.Name }} --set "cluster.externalAccess.enabled=true,cluster.externalAccess.service.type=LoadBalancer{{- $root := . }}{{ $count := .Values.cluster.nodes | int }}{{ range $i, $v := until $count }},cluster.externalAccess.service.loadBalancerIP[{{ $i }}]=load-balancerip-{{- $i }}{{- end }}" bitnami/redis
|
||||
Where loadbalancer-ip-i are the LoadBalancerIPs provided by the cluster.
|
||||
{{- else -}}
|
||||
{{- if .Values.cluster.init -}}
|
||||
INFO: The Job to create the cluster will be created.
|
||||
{{- end -}}
|
||||
|
||||
To connect to your database from outside the cluster execute the following commands:
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "redis-cluster.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
redis-cli -c -h $SERVICE_IP -p {{ .Values.service.port }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- else }}
|
||||
|
||||
You have deployed a Redis Cluster accessible only from within you Kubernetes Cluster.
|
||||
|
||||
{{- if .Values.cluster.init -}}
|
||||
INFO: The Job to create the cluster will be created.
|
||||
{{- end -}}
|
||||
|
||||
To connect to your Redis cluster:
|
||||
|
||||
1. Run a Redis pod that you can use as a client:
|
||||
|
||||
kubectl run --namespace {{ .Release.Namespace }} {{ template "redis-cluster.fullname" . }}-client --rm --tty -i --restart='Never' \
|
||||
{{ if .Values.usePassword }} --env REDIS_PASSWORD=$REDIS_PASSWORD \{{ end }}
|
||||
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "redis-cluster.fullname" . }}-client=true" \{{- end }}
|
||||
--image {{ template "redis-cluster.image" . }} -- bash
|
||||
|
||||
2. Connect using the Redis CLI:
|
||||
|
||||
redis-cli -c -h {{ template "redis-cluster.fullname" . }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
|
||||
|
||||
{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||
Note: Since NetworkPolicy is enabled, only pods with label
|
||||
{{ template "redis-cluster.fullname" . }}-client=true"
|
||||
will be able to connect to redis.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "redis-cluster.validateValues" . }}
|
||||
{{- include "redis-cluster.checkRollingTags" . }}
|
||||
367
bitnami/redis-cluster/templates/_helpers.tpl
Normal file
367
bitnami/redis-cluster/templates/_helpers.tpl
Normal file
@@ -0,0 +1,367 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "redis-cluster.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Expand the chart plus release name (used by the chart label)
|
||||
*/}}
|
||||
{{- define "redis-cluster.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "redis-cluster.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for networkpolicy.
|
||||
*/}}
|
||||
{{- define "networkPolicy.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiGroup for PodSecurityPolicy.
|
||||
*/}}
|
||||
{{- define "podSecurityPolicy.apiGroup" -}}
|
||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "policy" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for PodSecurityPolicy.
|
||||
*/}}
|
||||
{{- define "podSecurityPolicy.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "policy/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Redis image name
|
||||
*/}}
|
||||
{{- define "redis-cluster.image" -}}
|
||||
{{- $registryName := .Values.image.registry -}}
|
||||
{{- $repositoryName := .Values.image.repository -}}
|
||||
{{- $tag := .Values.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the metrics image)
|
||||
*/}}
|
||||
{{- define "redis-cluster.metrics.image" -}}
|
||||
{{- $registryName := .Values.metrics.image.registry -}}
|
||||
{{- $repositoryName := .Values.metrics.image.repository -}}
|
||||
{{- $tag := .Values.metrics.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the init container volume-permissions image)
|
||||
*/}}
|
||||
{{- define "redis-cluster.volumePermissions.image" -}}
|
||||
{{- $registryName := .Values.volumePermissions.image.registry -}}
|
||||
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
|
||||
{{- $tag := .Values.volumePermissions.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "redis-cluster.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "redis-cluster.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the password secret.
|
||||
*/}}
|
||||
{{- define "redis-cluster.secretName" -}}
|
||||
{{- if .Values.existingSecret -}}
|
||||
{{- printf "%s" .Values.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "redis-cluster.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the password key to be retrieved from Redis secret.
|
||||
*/}}
|
||||
{{- define "redis-cluster.secretPasswordKey" -}}
|
||||
{{- if and .Values.existingSecret .Values.existingSecretPasswordKey -}}
|
||||
{{- printf "%s" .Values.existingSecretPasswordKey -}}
|
||||
{{- else -}}
|
||||
{{- printf "redis-password" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return Redis password
|
||||
*/}}
|
||||
{{- define "redis-cluster.password" -}}
|
||||
{{- if not (empty .Values.global.redis.password) }}
|
||||
{{- .Values.global.redis.password -}}
|
||||
{{- else if not (empty .Values.password) -}}
|
||||
{{- .Values.password -}}
|
||||
{{- else -}}
|
||||
{{- randAlphaNum 10 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return sysctl image
|
||||
*/}}
|
||||
{{- define "redis-cluster.sysctl.image" -}}
|
||||
{{- $registryName := default "docker.io" .Values.sysctlImage.registry -}}
|
||||
{{- $repositoryName := .Values.sysctlImage.repository -}}
|
||||
{{- $tag := default "buster" .Values.sysctlImage.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "redis-cluster.imagePullSecrets" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
Also, we can not use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.global.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.sysctlImage.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.sysctlImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.sysctlImage.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.sysctlImage.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check if there are rolling tags in the images */}}
|
||||
{{- define "redis-cluster.checkRollingTags" -}}
|
||||
{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
*/}}
|
||||
{{- define "redis-cluster.storageClass" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
*/}}
|
||||
{{- if .Values.global -}}
|
||||
{{- if .Values.global.storageClass -}}
|
||||
{{- if (eq "-" .Values.global.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Determines whether or not to create the Statefulset
|
||||
*/}}
|
||||
{{- define "redis-cluster.createStatefulSet" -}}
|
||||
{{- if not .Values.cluster.externalAccess.enabled -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.service.loadBalancerIP -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "redis-cluster.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "redis-cluster.name" . }}
|
||||
helm.sh/chart: {{ include "redis-cluster.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "redis-cluster.matchLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "redis-cluster.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "redis-cluster.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "redis-cluster.validateValues.updateParameters" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of Redis Cluster - check update parameters */}}
|
||||
{{- define "redis-cluster.validateValues.updateParameters" -}}
|
||||
{{- if and .Values.cluster.update.addNodes ( or (and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.service.loadBalancerIP) ( not .Values.cluster.externalAccess.enabled )) -}}
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
{{- if not .Values.cluster.update.newExternalIPs -}}
|
||||
redis-cluster: newExternalIPs
|
||||
You must provide the newExternalIPs to perform the cluster upgrade when using external access.
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
{{- if not .Values.cluster.update.currentNumberOfNodes -}}
|
||||
redis-cluster: currentNumberOfNodes
|
||||
You must provide the currentNumberOfNodes to perform an upgrade when not using external access.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.render" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
1381
bitnami/redis-cluster/templates/configmap.yaml
Normal file
1381
bitnami/redis-cluster/templates/configmap.yaml
Normal file
File diff suppressed because it is too large
Load Diff
18
bitnami/redis-cluster/templates/headless-svc.yaml
Normal file
18
bitnami/redis-cluster/templates/headless-svc.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}-headless
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ .Values.redisPort }}
|
||||
targetPort: tcp-redis
|
||||
- name: tcp-redis-bus
|
||||
port: {{ .Values.cluster.busPort }}
|
||||
targetPort: tcp-redis-bus
|
||||
selector: {{- include "redis-cluster.matchLabels" . | nindent 4 }}
|
||||
|
||||
51
bitnami/redis-cluster/templates/init-cluster.yaml
Normal file
51
bitnami/redis-cluster/templates/init-cluster.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
{{- if and .Values.cluster.init (or (and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.service.loadBalancerIP) ( not .Values.cluster.externalAccess.enabled )) }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}-cluster-create
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
spec:
|
||||
activeDeadlineSeconds: {{ .Values.cluster.initTimeout }}
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: trigger
|
||||
image: "{{ template "redis-cluster.image" . }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if .Values.containerSecurityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.containerSecurityContext.runAsUser }}
|
||||
{{- end }}
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
command: ['/bin/bash', '-c']
|
||||
args:
|
||||
- |
|
||||
ips=($(echo "{{ .Values.cluster.externalAccess.service.loadBalancerIP }}" | cut -d [ -f2 | cut -d ] -f 1))
|
||||
export REDIS_NODES="${ips[@]}"
|
||||
/entrypoint.sh /run.sh
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.cluster.externalAccess.service.port | quote }}
|
||||
{{- else }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.redisPort | quote }}
|
||||
- name: REDIS_NODES
|
||||
value: "{{ $count := .Values.cluster.nodes | int }}{{ range $i, $v := until $count }}{{ include "redis-cluster.fullname" $ }}-{{ $i }}.{{ template "redis-cluster.fullname" $ }}-headless {{ end }}"
|
||||
{{- end }}
|
||||
{{- if .Values.usePassword }}
|
||||
- name: REDISCLI_AUTH
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "redis-cluster.secretName" . }}
|
||||
key: {{ template "redis-cluster.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
- name: REDIS_CLUSTER_CREATOR
|
||||
value: "yes"
|
||||
- name: REDIS_CLUSTER_REPLICAS
|
||||
value: {{ .Values.cluster.replicas | quote }}
|
||||
restartPolicy: OnFailure
|
||||
{{- end }}
|
||||
24
bitnami/redis-cluster/templates/metrics-prometheus.yaml
Normal file
24
bitnami/redis-cluster/templates/metrics-prometheus.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- if and (.Values.metrics.enabled) (.Values.metrics.serviceMonitor.enabled) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
{{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: metrics
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{- include "redis-cluster.matchLabels" . | nindent 6 }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
{{- end -}}
|
||||
24
bitnami/redis-cluster/templates/metrics-svc.yaml
Normal file
24
bitnami/redis-cluster/templates/metrics-svc.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}-metrics
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
{{- if .Values.metrics.service.labels -}}
|
||||
{{- toYaml .Values.metrics.service.labels | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.metrics.service.annotations }}
|
||||
annotations: {{- toYaml .Values.metrics.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.metrics.service.type }}
|
||||
{{- if eq .Values.metrics.service.type "LoadBalancer" }} {{ if .Values.metrics.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
ports:
|
||||
- name: metrics
|
||||
port: 9121
|
||||
targetPort: http-metrics
|
||||
selector: {{- include "redis-cluster.matchLabels" $ | nindent 4 }}
|
||||
{{- end }}
|
||||
59
bitnami/redis-cluster/templates/networkpolicy.yaml
Normal file
59
bitnami/redis-cluster/templates/networkpolicy.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ template "networkPolicy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: {{ template "redis-cluster.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
egress:
|
||||
# Allow dns resolution
|
||||
- ports:
|
||||
- port: 53
|
||||
protocol: UDP
|
||||
# Allow outbound connections to other cluster pods
|
||||
- ports:
|
||||
- port: {{ .Values.redisPort }}
|
||||
- port: {{ .Values.cluster.busPort }}
|
||||
to:
|
||||
- podSelector:
|
||||
matchLabels: {{- include "redis-cluster.matchLabels" . | nindent 14 }}
|
||||
ingress:
|
||||
# Allow inbound connections
|
||||
- ports:
|
||||
- port: {{ .Values.redisPort }}
|
||||
- port: {{ .Values.cluster.busPort }}
|
||||
{{- if not .Values.networkPolicy.allowExternal }}
|
||||
from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{ template "redis-cluster.fullname" . }}-client: "true"
|
||||
- podSelector:
|
||||
matchLabels: {{- include "redis-cluster.matchLabels" . | nindent 14 }}
|
||||
{{- if .Values.networkPolicy.ingressNSMatchLabels }}
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
{{- range $key, $value := .Values.networkPolicy.ingressNSMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- range $key, $value := .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
# Allow prometheus scrapes for metrics
|
||||
- ports:
|
||||
- port: 9121
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
19
bitnami/redis-cluster/templates/prometheusrule.yaml
Normal file
19
bitnami/redis-cluster/templates/prometheusrule.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
{{- with .Values.metrics.prometheusRule.namespace }}
|
||||
namespace: {{ . }}
|
||||
{{- end }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.prometheusRule.additionalLabels }}
|
||||
{{- toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.metrics.prometheusRule.rules }}
|
||||
groups:
|
||||
- name: {{ template "redis-cluster.name" $ }}
|
||||
rules: {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
38
bitnami/redis-cluster/templates/psp.yaml
Normal file
38
bitnami/redis-cluster/templates/psp.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
{{- if .Values.podSecurityPolicy.create }}
|
||||
apiVersion: {{ template "podSecurityPolicy.apiVersion" . }}
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
allowPrivilegeEscalation: false
|
||||
fsGroup:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.podSecurityContext.fsGroup }}
|
||||
max: {{ .Values.podSecurityContext.fsGroup }}
|
||||
hostIPC: false
|
||||
hostNetwork: false
|
||||
hostPID: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: false
|
||||
requiredDropCapabilities:
|
||||
- ALL
|
||||
runAsUser:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.podSecurityContext.runAsUser }}
|
||||
max: {{ .Values.podSecurityContext.runAsUser }}
|
||||
seLinux:
|
||||
rule: 'RunAsAny'
|
||||
supplementalGroups:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.podSecurityContext.runAsUser }}
|
||||
max: {{ .Values.podSecurityContext.runAsUser }}
|
||||
volumes:
|
||||
- 'configMap'
|
||||
- 'secret'
|
||||
- 'emptyDir'
|
||||
- 'persistentVolumeClaim'
|
||||
{{- end }}
|
||||
17
bitnami/redis-cluster/templates/redis-role.yaml
Normal file
17
bitnami/redis-cluster/templates/redis-role.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
rules:
|
||||
{{- if .Values.podSecurityPolicy.create }}
|
||||
- apiGroups: ['{{ template "podSecurityPolicy.apiGroup" . }}']
|
||||
resources: ['podsecuritypolicies']
|
||||
verbs: ['use']
|
||||
resourceNames: [{{ template "redis-cluster.fullname" . }}]
|
||||
{{- end -}}
|
||||
{{- if .Values.rbac.role.rules }}
|
||||
{{- toYaml .Values.rbac.role.rules | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
14
bitnami/redis-cluster/templates/redis-rolebinding.yaml
Normal file
14
bitnami/redis-cluster/templates/redis-rolebinding.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "redis-cluster.serviceAccountName" . }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,7 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.serviceAccountName" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
{{- end -}}
|
||||
338
bitnami/redis-cluster/templates/redis-statefulset.yaml
Normal file
338
bitnami/redis-cluster/templates/redis-statefulset.yaml
Normal file
@@ -0,0 +1,338 @@
|
||||
{{- if (include "redis-cluster.createStatefulSet" .) }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "redis-cluster.matchLabels" . | nindent 6 }}
|
||||
{{- if .Values.updateStrategy }}
|
||||
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
replicas: {{ .Values.cluster.nodes }}
|
||||
serviceName: {{ include "redis-cluster.fullname" . }}-headless
|
||||
podManagementPolicy: "Parallel"
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 8 }}
|
||||
{{- if .Values.podLabels }}
|
||||
{{- toYaml .Values.podLabels | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podLabels }}
|
||||
{{- toYaml .Values.metrics.podLabels | nindent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/scripts: {{ include (print $.Template.BasePath "/scripts-configmap.yaml") . | sha256sum }}
|
||||
{{- if not .Values.existingSecret }}
|
||||
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{- toYaml .Values.podAnnotations | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
||||
{{- toYaml .Values.metrics.podAnnotations | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "redis-cluster.imagePullSecrets" . | nindent 6 }}
|
||||
{{- if .Values.podSecurityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.podSecurityContext.fsGroup }}
|
||||
{{- if .Values.podSecurityContext.sysctls }}
|
||||
sysctls:
|
||||
{{- toYaml .Values.podSecurityContext.sysctls | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: "{{ template "redis-cluster.serviceAccountName" . }}"
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: "{{ .Values.priorityClassName }}"
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.schedulerName }}
|
||||
schedulerName: {{ .Values.schedulerName | quote }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "redis-cluster.fullname" . }}
|
||||
image: "{{ include "redis-cluster.image" . }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if .Values.containerSecurityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.containerSecurityContext.runAsUser }}
|
||||
{{- end }}
|
||||
{{- if .Values.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.args }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if and (not .Values.command) (not .Values.args) }}
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
command: ['/bin/bash', '-c']
|
||||
args:
|
||||
- |
|
||||
pod_index=($(echo "$POD_NAME" | tr "-" "\n"))
|
||||
pod_index="${pod_index[-1]}"
|
||||
ips=($(echo "{{ .Values.cluster.externalAccess.service.loadBalancerIP }}" | cut -d [ -f2 | cut -d ] -f 1))
|
||||
export REDIS_CLUSTER_ANNOUNCE_IP="${ips[$pod_index]}"
|
||||
export REDIS_NODES="${ips[@]}"
|
||||
/entrypoint.sh /run.sh
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
- name: REDIS_CLUSTER_DYNAMIC_IPS
|
||||
value: "no"
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
{{- else }}
|
||||
- name: REDIS_NODES
|
||||
value: "{{ $count := .Values.cluster.nodes | int }}{{ range $i, $v := until $count }}{{ include "redis-cluster.fullname" $ }}-{{ $i }}.{{ template "redis-cluster.fullname" $ }}-headless {{ end }}"
|
||||
{{- end }}
|
||||
{{- if .Values.usePassword }}
|
||||
- name: REDISCLI_AUTH
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "redis-cluster.secretName" . }}
|
||||
key: {{ template "redis-cluster.secretPasswordKey" . }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: REDIS_PASSWORD_FILE
|
||||
value: "/opt/bitnami/redis/secrets/redis-password"
|
||||
{{- else }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "redis-cluster.secretName" . }}
|
||||
key: {{ template "redis-cluster.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: "yes"
|
||||
{{- end }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.redisPort | quote }}
|
||||
{{- if .Values.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.extraEnvVars "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.extraEnvVarsConfigMap .Values.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.extraEnvVarsConfigMap }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.extraEnvVarsConfigMap "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
containerPort: {{ .Values.redisPort }}
|
||||
- name: tcp-redis-bus
|
||||
containerPort: {{ .Values.cluster.busPort }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /scripts/ping_liveness_local.sh {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /scripts/ping_readiness_local.sh {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.resources }}
|
||||
resources:
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.resources "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: redis-password
|
||||
mountPath: /opt/bitnami/redis/secrets/
|
||||
{{- end }}
|
||||
- name: redis-data
|
||||
mountPath: {{ .Values.persistence.path }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
- name: default-config
|
||||
mountPath: /opt/bitnami/redis/etc/redis-default.conf
|
||||
subPath: redis-default.conf
|
||||
- name: redis-tmp-conf
|
||||
mountPath: /opt/bitnami/redis/etc/
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ template "redis-cluster.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
{{- if .Values.usePasswordFile }}
|
||||
export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
redis_exporter{{- range $key, $value := .Values.metrics.extraArgs }} --{{ $key }}={{ $value }}{{- end }}
|
||||
env:
|
||||
- name: REDIS_ALIAS
|
||||
value: {{ template "redis-cluster.fullname" . }}
|
||||
{{- if and .Values.usePassword (not .Values.usePasswordFile) }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "redis-cluster.secretName" . }}
|
||||
key: {{ template "redis-cluster.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: REDIS_PASSWORD_FILE
|
||||
value: "/opt/bitnami/redis/secrets/redis-password"
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: redis-password
|
||||
mountPath: /secrets/
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http-metrics
|
||||
containerPort: 9121
|
||||
resources:
|
||||
{{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled (and .Values.persistence.enabled .Values.containerSecurityContext.enabled) }}
|
||||
{{- if or $needsVolumePermissions .Values.sysctlImage.enabled }}
|
||||
initContainers:
|
||||
{{- if $needsVolumePermissions }}
|
||||
- name: volume-permissions
|
||||
image: "{{ template "redis-cluster.volumePermissions.image" . }}"
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command: ["/bin/chown", "-R", "{{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.containerSecurityContext.fsGroup }}", "{{ .Values.persistence.path }}"]
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
resources:
|
||||
{{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: redis-data
|
||||
mountPath: {{ .Values.persistence.path }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.sysctlImage.enabled }}
|
||||
- name: init-sysctl
|
||||
image: {{ template "redis-cluster.sysctl.image" . }}
|
||||
imagePullPolicy: {{ default "" .Values.sysctlImage.pullPolicy | quote }}
|
||||
resources:
|
||||
{{- toYaml .Values.sysctlImage.resources | nindent 12 }}
|
||||
{{- if .Values.sysctlImage.mountHostSys }}
|
||||
volumeMounts:
|
||||
- name: host-sys
|
||||
mountPath: /host-sys
|
||||
{{- end }}
|
||||
command:
|
||||
{{- toYaml .Values.sysctlImage.command | nindent 12 }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
runAsUser: 0
|
||||
{{- end }}
|
||||
{{- if .Values.extraInitContainers }}
|
||||
{{- range $key, $value := .Values.extraInitContainers }}
|
||||
- name: "{{ $key }}"
|
||||
{{- toYaml $value | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $ ) | nindent 6 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: {{ include "redis-cluster.fullname" . }}-scripts
|
||||
defaultMode: 0755
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: redis-password
|
||||
secret:
|
||||
secretName: {{ include "redis-cluster.secretName" . }}
|
||||
items:
|
||||
- key: {{ include "redis-cluster.secretPasswordKey" . }}
|
||||
path: redis-password
|
||||
{{- end }}
|
||||
- name: default-config
|
||||
configMap:
|
||||
name: {{ include "redis-cluster.fullname" . }}-default
|
||||
{{- if not .Values.persistence.enabled }}
|
||||
- name: "redis-data"
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.sysctlImage.mountHostSys }}
|
||||
- name: host-sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
{{- end }}
|
||||
- name: redis-tmp-conf
|
||||
emptyDir: {}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $ ) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: redis-data
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 10 }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- include "redis-cluster.storageClass" . | nindent 10 }}
|
||||
selector:
|
||||
{{- if .Values.persistence.matchLabels }}
|
||||
matchLabels:
|
||||
{{- toYaml .Values.persistence.matchLabels | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.persistence.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{- toYaml .Values.persistence.matchExpressions | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
updateStrategy:
|
||||
type: {{ .Values.statefulset.updateStrategy }}
|
||||
{{- if .Values.statefulset.rollingUpdatePartition }}
|
||||
{{- if (eq "Recreate" .Values.statefulset.updateStrategy) }}
|
||||
rollingUpdate: null
|
||||
{{- else }}
|
||||
rollingUpdate:
|
||||
partition: {{ .Values.statefulset.rollingUpdatePartition }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
18
bitnami/redis-cluster/templates/redis-svc.yaml
Normal file
18
bitnami/redis-cluster/templates/redis-svc.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
{{- if .Values.service.labels -}}
|
||||
{{ toYaml .Values.service.labels | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: tcp-redis
|
||||
selector: {{- include "redis-cluster.matchLabels" $ | nindent 4 }}
|
||||
42
bitnami/redis-cluster/templates/scripts-configmap.yaml
Normal file
42
bitnami/redis-cluster/templates/scripts-configmap.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "redis-cluster.fullname" . }}-scripts
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
data:
|
||||
ping_readiness_local.sh: |-
|
||||
{{- if .Values.usePasswordFile }}
|
||||
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
||||
export REDISCLI_AUTH=$password_aux
|
||||
{{- else }}
|
||||
export REDISCLI_AUTH=$REDIS_PASSWORD
|
||||
{{- end }}
|
||||
response=$(
|
||||
timeout -s 9 $1 \
|
||||
redis-cli \
|
||||
-h localhost \
|
||||
-p $REDIS_PORT \
|
||||
ping
|
||||
)
|
||||
if [ "$response" != "PONG" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
ping_liveness_local.sh: |-
|
||||
{{- if .Values.usePasswordFile }}
|
||||
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
||||
export REDISCLI_AUTH=$password_aux
|
||||
{{- else }}
|
||||
export REDISCLI_AUTH=$REDIS_PASSWORD
|
||||
{{- end }}
|
||||
response=$(
|
||||
timeout -s 9 $1 \
|
||||
redis-cli \
|
||||
-h localhost \
|
||||
-p $REDIS_PORT \
|
||||
ping
|
||||
)
|
||||
if [ "$response" != "PONG" ] && [ "$response" != "LOADING Redis is loading the dataset in memory" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
10
bitnami/redis-cluster/templates/secret.yaml
Normal file
10
bitnami/redis-cluster/templates/secret.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- if and .Values.usePassword (not .Values.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
redis-password: {{ include "redis-cluster.password" . | b64enc | quote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
{{- $fullName := include "redis-cluster.fullname" . }}
|
||||
{{- $nodesCount := .Values.cluster.nodes | int }}
|
||||
{{- $root := . }}
|
||||
|
||||
{{- range $i, $e := until $nodesCount }}
|
||||
{{- $targetPod := printf "%s-%d" (printf "%s" $fullName) $i }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" $ }}-{{ $i }}-svc
|
||||
labels: {{- include "redis-cluster.labels" $ | nindent 4 }}
|
||||
pod: {{ $targetPod }}
|
||||
annotations: {{ include "common.tplvalues.render" ( dict "value" $root.Values.cluster.externalAccess.service.annotations "context" $) | nindent 4 }}
|
||||
spec:
|
||||
type: {{ $root.Values.cluster.externalAccess.service.type }}
|
||||
{{- if $root.Values.cluster.externalAccess.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ index $root.Values.cluster.externalAccess.service.loadBalancerIP $i }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ $root.Values.cluster.externalAccess.service.port }}
|
||||
targetPort: tcp-redis
|
||||
- name: tcp-redis-bus
|
||||
targetPort: tcp-redis-bus
|
||||
port: {{ $root.Values.cluster.busPort }}
|
||||
selector: {{- include "redis-cluster.matchLabels" $ | nindent 4 }}
|
||||
statefulset.kubernetes.io/pod-name: {{ $targetPod }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
62
bitnami/redis-cluster/templates/update-cluster.yaml
Normal file
62
bitnami/redis-cluster/templates/update-cluster.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
{{- if and .Values.cluster.update.addNodes ( or (and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.service.loadBalancerIP) ( not .Values.cluster.externalAccess.enabled )) }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "redis-cluster.fullname" . }}-cluster-update
|
||||
labels: {{- include "redis-cluster.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-upgrade
|
||||
spec:
|
||||
activeDeadlineSeconds: {{ .Values.cluster.initTimeout }}
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: trigger
|
||||
image: "{{ template "redis-cluster.image" . }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if .Values.containerSecurityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.containerSecurityContext.runAsUser }}
|
||||
{{- end }}
|
||||
command: ['/bin/bash', '-c']
|
||||
args:
|
||||
- |
|
||||
. /opt/bitnami/scripts/libnet.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
for nodeIp in $(echo "{{ .Values.cluster.update.newExternalIPs }}" | cut -d [ -f2 | cut -d ] -f 1 ); do
|
||||
while [[ $(redis-cli -h "$nodeIp" -p "$REDIS_PORT" ping) != 'PONG' ]]; do
|
||||
echo "Node $nodeIp not ready, waiting for all the nodes to be ready..."
|
||||
sleep 5
|
||||
done
|
||||
redis-cli --cluster add-node "${nodeIp}:${REDIS_PORT}" "{{ index .Values.cluster.externalAccess.service.loadBalancerIP 0 }}:${REDIS_PORT}"
|
||||
done
|
||||
{{- else }}
|
||||
for node in $(seq $((1+{{ .Values.cluster.update.currentNumberOfNodes }})) {{ .Values.cluster.nodes }}); do
|
||||
new_node_index="$(($node - 1))"
|
||||
new_node_ip=$(wait_for_dns_lookup {{ template "redis-cluster.fullname" . }}-"$new_node_index".{{ template "redis-cluster.fullname" . }}-headless 120 5)
|
||||
while [[ $(redis-cli -h "$new_node_ip" -p "$REDIS_PORT" ping) != 'PONG' ]]; do
|
||||
echo "Node $new_node_ip not ready, waiting for all the nodes to be ready..."
|
||||
sleep 5
|
||||
done
|
||||
firstNodeIp=$(wait_for_dns_lookup {{ template "redis-cluster.fullname" . }}-0.{{ template "redis-cluster.fullname" . }}-headless 120 5)
|
||||
redis-cli --cluster add-node "${new_node_ip}:${REDIS_PORT}" "${firstNodeIp}:${REDIS_PORT}"
|
||||
done
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.cluster.externalAccess.enabled }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.cluster.externalAccess.service.port | quote }}
|
||||
{{- else }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.redisPort | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePassword }}
|
||||
- name: REDISCLI_AUTH
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "redis-cluster.secretName" . }}
|
||||
key: {{ template "redis-cluster.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
{{- end }}
|
||||
485
bitnami/redis-cluster/values-production.yaml
Normal file
485
bitnami/redis-cluster/values-production.yaml
Normal file
@@ -0,0 +1,485 @@
|
||||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
|
||||
##
|
||||
global:
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
redis: {}
|
||||
|
||||
## Bitnami Redis image version
|
||||
## ref: https://hub.docker.com/r/bitnami/redis/tags/
|
||||
##
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-cluster
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 5.0.8-debian-10-r0
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## String to partially override redis.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override redis.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
## Redis Cluster settings
|
||||
##
|
||||
cluster:
|
||||
## Enable the creation of a Job that will execute the proper command to create the Redis Cluster.
|
||||
##
|
||||
init: true
|
||||
## Number of seconds the Job to create the cluster will be waiting for the Nodes to be ready.
|
||||
##
|
||||
activeDeadlineSeconds: 600
|
||||
## Number of Redis nodes to be deployed
|
||||
##
|
||||
nodes: 6
|
||||
## Parameter to be passed as --cluster-replicas to the redic-cli --cluster create
|
||||
## 1 means that we want a replica for every master created
|
||||
##
|
||||
replicas: 1
|
||||
## The busPort should be obtained adding 10000 to the redisPort. By default: 10000 + 6379 = 16379
|
||||
##
|
||||
busPort: 16379
|
||||
|
||||
## Configuration to access the Redis Cluster from outside the Kubernetes cluster
|
||||
externalAccess:
|
||||
enabled: false
|
||||
service:
|
||||
## Type of service for external access. At this moment only LoadBalancer is supported.
|
||||
##
|
||||
type: LoadBalancer
|
||||
## Port used when service type is LoadBalancer
|
||||
##
|
||||
port: 6379
|
||||
## Array of load balancer IPs for each Redis node. Length must be the same as cluster.nodes
|
||||
##
|
||||
loadBalancerIP: []
|
||||
## Service annotations done as key:value pairs
|
||||
annotations: {}
|
||||
|
||||
## This section allows to update the Redis cluster nodes.
|
||||
##
|
||||
update:
|
||||
## Setting this to true a hook will add nodes to the Redis cluster after the upgrade.
|
||||
## currentNumberOfNodes is required
|
||||
##
|
||||
addNodes: false
|
||||
## Set to the number of nodes that are already deployed
|
||||
##
|
||||
currentNumberOfNodes: 6
|
||||
## When using external access set the new externalIPs here as an array
|
||||
##
|
||||
newExternalIPs: []
|
||||
|
||||
## Specifies the Kubernetes Cluster's Domain Name.
|
||||
##
|
||||
clusterDomain: cluster.local
|
||||
|
||||
networkPolicy:
|
||||
## Specifies whether a NetworkPolicy should be created
|
||||
##
|
||||
enabled: true
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client label will have network access to the port Redis is listening
|
||||
## on. When true, Redis will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
# allowExternal: true
|
||||
|
||||
## Allow connections from other namespacess. Just set label for namespace and set label for pods (optional).
|
||||
##
|
||||
ingressNSMatchLabels: {}
|
||||
ingressNSPodMatchLabels: {}
|
||||
|
||||
serviceAccount:
|
||||
## Specifies whether a ServiceAccount should be created
|
||||
##
|
||||
create: false
|
||||
## The name of the ServiceAccount to use.
|
||||
## If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
|
||||
rbac:
|
||||
## Specifies whether RBAC resources should be created
|
||||
##
|
||||
create: false
|
||||
|
||||
role:
|
||||
## Rules to create. It follows the role specification
|
||||
# rules:
|
||||
# - apiGroups:
|
||||
# - extensions
|
||||
# resources:
|
||||
# - podsecuritypolicies
|
||||
# verbs:
|
||||
# - use
|
||||
# resourceNames:
|
||||
# - gce.unprivileged
|
||||
rules: []
|
||||
|
||||
## Redis pod Security Context
|
||||
podSecurityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
## sysctl settings
|
||||
##
|
||||
## Uncomment the setting below to increase the net.core.somaxconn value
|
||||
##
|
||||
# sysctls:
|
||||
# - name: net.core.somaxconn
|
||||
# value: "10000"
|
||||
|
||||
## Containers Security Context
|
||||
containerSecurityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
## sysctl settings
|
||||
##
|
||||
## Uncomment the setting below to increase the net.core.somaxconn value
|
||||
##
|
||||
# sysctls:
|
||||
# - name: net.core.somaxconn
|
||||
# value: "10000"
|
||||
|
||||
## Use password authentication
|
||||
usePassword: true
|
||||
## Redis password
|
||||
## Defaults to a random 10-character alphanumeric string if not set and usePassword is true
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#setting-the-server-password-on-first-run
|
||||
##
|
||||
password: ""
|
||||
## Use existing secret (ignores previous password)
|
||||
# existingSecret:
|
||||
## Password key to be retrieved from Redis secret
|
||||
##
|
||||
# existingSecretPasswordKey:
|
||||
|
||||
## Mount secrets as files instead of environment variables
|
||||
usePasswordFile: false
|
||||
|
||||
# Redis port
|
||||
redisPort: 6379
|
||||
|
||||
##
|
||||
## Redis parameters
|
||||
##
|
||||
|
||||
## Custom command to override image cmd
|
||||
##
|
||||
# command: []
|
||||
|
||||
## Custom args for the cutom commad:
|
||||
# args: []
|
||||
|
||||
## Additional Redis configuration for the nodes
|
||||
## ref: https://redis.io/topics/config
|
||||
##
|
||||
configmap:
|
||||
## Redis additional command line flags
|
||||
##
|
||||
## Can be used to specify command line flags, for example:
|
||||
##
|
||||
## extraFlags:
|
||||
## - "--maxmemory-policy volatile-ttl"
|
||||
## - "--repl-backlog-size 1024mb"
|
||||
extraFlags: []
|
||||
|
||||
## Redis additional annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||
podAnnotations: {}
|
||||
|
||||
## Redis resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 256Mi
|
||||
# cpu: 100m
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## Configure extra options for Redis liveness and readiness probes
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
##
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
|
||||
## Redis Node selectors and tolerations for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
##
|
||||
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
|
||||
# tolerations: []
|
||||
## Redis pod/node affinity/anti-affinity
|
||||
##
|
||||
affinity: {}
|
||||
|
||||
## Redis Service properties for standalone mode.
|
||||
service:
|
||||
port: 6379
|
||||
|
||||
## Provide any additional annotations which may be required. This can be used to
|
||||
## set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## Redis images.
|
||||
path: /bitnami/redis/data
|
||||
## The subdirectory of the volume to mount to, useful in dev environments
|
||||
## and one PV for multiple services.
|
||||
subPath: ""
|
||||
## Redis data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass: "-"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 8Gi
|
||||
## Persistent Volume selectors
|
||||
## https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector
|
||||
matchLabels: {}
|
||||
matchExpressions: {}
|
||||
|
||||
## Update strategy, can be set to RollingUpdate or onDelete by default.
|
||||
## https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||
statefulset:
|
||||
updateStrategy: RollingUpdate
|
||||
## Partition update strategy
|
||||
## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
|
||||
# rollingUpdatePartition:
|
||||
|
||||
## Redis pod priorityClassName
|
||||
# priorityClassName: {}
|
||||
|
||||
## Prometheus Exporter / Metrics
|
||||
##
|
||||
metrics:
|
||||
enabled: true
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-exporter
|
||||
tag: 1.4.0-debian-10-r16
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Metrics exporter resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
# resources: {}
|
||||
|
||||
## Extra arguments for Metrics exporter, for example:
|
||||
## extraArgs:
|
||||
## check-keys: myKey,myOtherKey
|
||||
# extraArgs: {}
|
||||
|
||||
## Metrics exporter pod Annotation and Labels
|
||||
podAnnotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9121"
|
||||
# podLabels: {}
|
||||
|
||||
# Enable this if you're using https://github.com/coreos/prometheus-operator
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
## Specify a namespace if needed
|
||||
# namespace: monitoring
|
||||
# fallback to the prometheus default unless specified
|
||||
# interval: 10s
|
||||
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
|
||||
## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1)
|
||||
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
|
||||
selector:
|
||||
prometheus: kube-prometheus
|
||||
|
||||
## Custom PrometheusRule to be defined
|
||||
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
namespace: ""
|
||||
rules: []
|
||||
## These are just examples rules, please adapt them to your needs.
|
||||
## Make sure to constraint the rules to the current postgresql service.
|
||||
# - alert: RedisDown
|
||||
# expr: redis_up{service="{{ template "redis-cluster.fullname" . }}-metrics"} == 0
|
||||
# for: 2m
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} down
|
||||
# description: Redis instance {{ "{{ $instance }}" }} is down.
|
||||
# - alert: RedisMemoryHigh
|
||||
# expr: >
|
||||
# redis_memory_used_bytes{service="{{ template "redis-cluster.fullname" . }}-metrics"} * 100
|
||||
# /
|
||||
# redis_memory_max_bytes{service="{{ template "redis-cluster.fullname" . }}-metrics"}
|
||||
# > 90 =< 100
|
||||
# for: 2m
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} is using too much memory
|
||||
# description: Redis instance {{ "{{ $instance }}" }} is using {{ "{{ $value }}" }}% of its available memory.
|
||||
# - alert: RedisKeyEviction
|
||||
# expr: increase(redis_evicted_keys_total{service="{{ template "redis-cluster.fullname" . }}-metrics"}[5m]) > 0
|
||||
# for: 1s
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} has evicted keys
|
||||
# description: Redis instance {{ "{{ $instance }}" }} has evicted {{ "{{ $value }}" }} keys in the last 5 minutes.
|
||||
|
||||
## Metrics exporter pod priorityClassName
|
||||
# priorityClassName: {}
|
||||
service:
|
||||
type: ClusterIP
|
||||
## Use serviceLoadBalancerIP to request a specific static IP,
|
||||
## otherwise leave blank
|
||||
# loadBalancerIP:
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
##
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
resources: {}
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 128Mi
|
||||
# cpu: 100m
|
||||
|
||||
## Sysctl InitContainer
|
||||
## used to perform sysctl operation to modify Kernel settings (needed sometimes to avoid warnings)
|
||||
sysctlImage:
|
||||
enabled: false
|
||||
command: []
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
mountHostSys: false
|
||||
resources: {}
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 128Mi
|
||||
# cpu: 100m
|
||||
|
||||
## PodSecurityPolicy configuration
|
||||
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||
##
|
||||
podSecurityPolicy:
|
||||
## Specifies whether a PodSecurityPolicy should be created
|
||||
##
|
||||
create: false
|
||||
|
||||
## Array to add extra volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
|
||||
## Array to add extra mounts (normally used with extraVolumes)
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
|
||||
## An array to add extra env vars
|
||||
## For example:
|
||||
## extraEnvVars:
|
||||
## - name: MY_ENV_VAR
|
||||
## value: env_var_value
|
||||
##
|
||||
extraEnvVars: []
|
||||
|
||||
## Name of a ConfigMap containing extra env vars
|
||||
##
|
||||
extraEnvVarsConfigMap:
|
||||
|
||||
## Name of a Secret containing extra env vars
|
||||
##
|
||||
extraEnvVarsSecret:
|
||||
|
||||
## Add your own init container or uncomment and modify the given example.
|
||||
##
|
||||
extraInitContainers: {}
|
||||
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
sidecars: {}
|
||||
## e.g.
|
||||
# - name: your-image-name
|
||||
# image: your-image
|
||||
# imagePullPolicy: Always
|
||||
# ports:
|
||||
# - name: portname
|
||||
# containerPort: 1234
|
||||
485
bitnami/redis-cluster/values.yaml
Normal file
485
bitnami/redis-cluster/values.yaml
Normal file
@@ -0,0 +1,485 @@
|
||||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
|
||||
##
|
||||
global:
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
redis: {}
|
||||
|
||||
## Bitnami Redis image version
|
||||
## ref: https://hub.docker.com/r/bitnami/redis/tags/
|
||||
##
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-cluster
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 5.0.8-debian-10-r0
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## String to partially override redis.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override redis.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
## Redis Cluster settings
|
||||
##
|
||||
cluster:
|
||||
## Enable the creation of a Job that will execute the proper command to create the Redis Cluster.
|
||||
##
|
||||
init: true
|
||||
## Number of seconds the Job to create the cluster will be waiting for the Nodes to be ready.
|
||||
##
|
||||
activeDeadlineSeconds: 600
|
||||
## Number of Redis nodes to be deployed
|
||||
##
|
||||
nodes: 6
|
||||
## Parameter to be passed as --cluster-replicas to the redic-cli --cluster create
|
||||
## 1 means that we want a replica for every master created
|
||||
##
|
||||
replicas: 1
|
||||
## The busPort should be obtained adding 10000 to the redisPort. By default: 10000 + 6379 = 16379
|
||||
##
|
||||
busPort: 16379
|
||||
|
||||
## Configuration to access the Redis Cluster from outside the Kubernetes cluster
|
||||
externalAccess:
|
||||
enabled: false
|
||||
service:
|
||||
## Type of service for external access. At this moment only LoadBalancer is supported.
|
||||
##
|
||||
type: LoadBalancer
|
||||
## Port used when service type is LoadBalancer
|
||||
##
|
||||
port: 6379
|
||||
## Array of load balancer IPs for each Redis node. Length must be the same as cluster.nodes
|
||||
##
|
||||
loadBalancerIP: []
|
||||
## Service annotations done as key:value pairs
|
||||
annotations: {}
|
||||
|
||||
## This section allows to update the Redis cluster nodes.
|
||||
##
|
||||
update:
|
||||
## Setting this to true a hook will add nodes to the Redis cluster after the upgrade.
|
||||
## currentNumberOfNodes is required
|
||||
##
|
||||
addNodes: false
|
||||
## Set to the number of nodes that are already deployed
|
||||
##
|
||||
currentNumberOfNodes: 6
|
||||
## When using external access set the new externalIPs here as an array
|
||||
##
|
||||
newExternalIPs: []
|
||||
|
||||
## Specifies the Kubernetes Cluster's Domain Name.
|
||||
##
|
||||
clusterDomain: cluster.local
|
||||
|
||||
networkPolicy:
|
||||
## Specifies whether a NetworkPolicy should be created
|
||||
##
|
||||
enabled: false
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client label will have network access to the port Redis is listening
|
||||
## on. When true, Redis will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
# allowExternal: true
|
||||
|
||||
## Allow connections from other namespacess. Just set label for namespace and set label for pods (optional).
|
||||
##
|
||||
ingressNSMatchLabels: {}
|
||||
ingressNSPodMatchLabels: {}
|
||||
|
||||
serviceAccount:
|
||||
## Specifies whether a ServiceAccount should be created
|
||||
##
|
||||
create: false
|
||||
## The name of the ServiceAccount to use.
|
||||
## If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
|
||||
rbac:
|
||||
## Specifies whether RBAC resources should be created
|
||||
##
|
||||
create: false
|
||||
|
||||
role:
|
||||
## Rules to create. It follows the role specification
|
||||
# rules:
|
||||
# - apiGroups:
|
||||
# - extensions
|
||||
# resources:
|
||||
# - podsecuritypolicies
|
||||
# verbs:
|
||||
# - use
|
||||
# resourceNames:
|
||||
# - gce.unprivileged
|
||||
rules: []
|
||||
|
||||
## Redis pod Security Context
|
||||
podSecurityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
## sysctl settings
|
||||
##
|
||||
## Uncomment the setting below to increase the net.core.somaxconn value
|
||||
##
|
||||
# sysctls:
|
||||
# - name: net.core.somaxconn
|
||||
# value: "10000"
|
||||
|
||||
## Containers Security Context
|
||||
containerSecurityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
## sysctl settings
|
||||
##
|
||||
## Uncomment the setting below to increase the net.core.somaxconn value
|
||||
##
|
||||
# sysctls:
|
||||
# - name: net.core.somaxconn
|
||||
# value: "10000"
|
||||
|
||||
## Use password authentication
|
||||
usePassword: true
|
||||
## Redis password
|
||||
## Defaults to a random 10-character alphanumeric string if not set and usePassword is true
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#setting-the-server-password-on-first-run
|
||||
##
|
||||
password: ""
|
||||
## Use existing secret (ignores previous password)
|
||||
# existingSecret:
|
||||
## Password key to be retrieved from Redis secret
|
||||
##
|
||||
# existingSecretPasswordKey:
|
||||
|
||||
## Mount secrets as files instead of environment variables
|
||||
usePasswordFile: false
|
||||
|
||||
# Redis port
|
||||
redisPort: 6379
|
||||
|
||||
##
|
||||
## Redis parameters
|
||||
##
|
||||
|
||||
## Custom command to override image cmd
|
||||
##
|
||||
# command: []
|
||||
|
||||
## Custom args for the cutom commad:
|
||||
# args: []
|
||||
|
||||
## Additional Redis configuration for the nodes
|
||||
## ref: https://redis.io/topics/config
|
||||
##
|
||||
configmap:
|
||||
## Redis additional command line flags
|
||||
##
|
||||
## Can be used to specify command line flags, for example:
|
||||
##
|
||||
## extraFlags:
|
||||
## - "--maxmemory-policy volatile-ttl"
|
||||
## - "--repl-backlog-size 1024mb"
|
||||
extraFlags: []
|
||||
|
||||
## Redis additional annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||
podAnnotations: {}
|
||||
|
||||
## Redis resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 256Mi
|
||||
# cpu: 100m
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## Configure extra options for Redis liveness and readiness probes
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
##
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
|
||||
## Redis Node selectors and tolerations for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
##
|
||||
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
|
||||
# tolerations: []
|
||||
## Redis pod/node affinity/anti-affinity
|
||||
##
|
||||
affinity: {}
|
||||
|
||||
## Redis Service properties for standalone mode.
|
||||
service:
|
||||
port: 6379
|
||||
|
||||
## Provide any additional annotations which may be required. This can be used to
|
||||
## set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## Redis images.
|
||||
path: /bitnami/redis/data
|
||||
## The subdirectory of the volume to mount to, useful in dev environments
|
||||
## and one PV for multiple services.
|
||||
subPath: ""
|
||||
## Redis data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass: "-"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 8Gi
|
||||
## Persistent Volume selectors
|
||||
## https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector
|
||||
matchLabels: {}
|
||||
matchExpressions: {}
|
||||
|
||||
## Update strategy, can be set to RollingUpdate or onDelete by default.
|
||||
## https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||
statefulset:
|
||||
updateStrategy: RollingUpdate
|
||||
## Partition update strategy
|
||||
## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
|
||||
# rollingUpdatePartition:
|
||||
|
||||
## Redis pod priorityClassName
|
||||
# priorityClassName: {}
|
||||
|
||||
## Prometheus Exporter / Metrics
|
||||
##
|
||||
metrics:
|
||||
enabled: false
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-exporter
|
||||
tag: 1.4.0-debian-10-r16
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Metrics exporter resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
# resources: {}
|
||||
|
||||
## Extra arguments for Metrics exporter, for example:
|
||||
## extraArgs:
|
||||
## check-keys: myKey,myOtherKey
|
||||
# extraArgs: {}
|
||||
|
||||
## Metrics exporter pod Annotation and Labels
|
||||
podAnnotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9121"
|
||||
# podLabels: {}
|
||||
|
||||
# Enable this if you're using https://github.com/coreos/prometheus-operator
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
## Specify a namespace if needed
|
||||
# namespace: monitoring
|
||||
# fallback to the prometheus default unless specified
|
||||
# interval: 10s
|
||||
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
|
||||
## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1)
|
||||
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
|
||||
selector:
|
||||
prometheus: kube-prometheus
|
||||
|
||||
## Custom PrometheusRule to be defined
|
||||
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
namespace: ""
|
||||
rules: []
|
||||
## These are just examples rules, please adapt them to your needs.
|
||||
## Make sure to constraint the rules to the current postgresql service.
|
||||
# - alert: RedisDown
|
||||
# expr: redis_up{service="{{ template "redis-cluster.fullname" . }}-metrics"} == 0
|
||||
# for: 2m
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} down
|
||||
# description: Redis instance {{ "{{ $instance }}" }} is down.
|
||||
# - alert: RedisMemoryHigh
|
||||
# expr: >
|
||||
# redis_memory_used_bytes{service="{{ template "redis-cluster.fullname" . }}-metrics"} * 100
|
||||
# /
|
||||
# redis_memory_max_bytes{service="{{ template "redis-cluster.fullname" . }}-metrics"}
|
||||
# > 90 =< 100
|
||||
# for: 2m
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} is using too much memory
|
||||
# description: Redis instance {{ "{{ $instance }}" }} is using {{ "{{ $value }}" }}% of its available memory.
|
||||
# - alert: RedisKeyEviction
|
||||
# expr: increase(redis_evicted_keys_total{service="{{ template "redis-cluster.fullname" . }}-metrics"}[5m]) > 0
|
||||
# for: 1s
|
||||
# labels:
|
||||
# severity: error
|
||||
# annotations:
|
||||
# summary: Redis instance {{ "{{ $instance }}" }} has evicted keys
|
||||
# description: Redis instance {{ "{{ $instance }}" }} has evicted {{ "{{ $value }}" }} keys in the last 5 minutes.
|
||||
|
||||
## Metrics exporter pod priorityClassName
|
||||
# priorityClassName: {}
|
||||
service:
|
||||
type: ClusterIP
|
||||
## Use serviceLoadBalancerIP to request a specific static IP,
|
||||
## otherwise leave blank
|
||||
# loadBalancerIP:
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
##
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
resources: {}
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 128Mi
|
||||
# cpu: 100m
|
||||
|
||||
## Sysctl InitContainer
|
||||
## used to perform sysctl operation to modify Kernel settings (needed sometimes to avoid warnings)
|
||||
sysctlImage:
|
||||
enabled: false
|
||||
command: []
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
mountHostSys: false
|
||||
resources: {}
|
||||
# resources:
|
||||
# requests:
|
||||
# memory: 128Mi
|
||||
# cpu: 100m
|
||||
|
||||
## PodSecurityPolicy configuration
|
||||
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||
##
|
||||
podSecurityPolicy:
|
||||
## Specifies whether a PodSecurityPolicy should be created
|
||||
##
|
||||
create: false
|
||||
|
||||
## Array to add extra volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
|
||||
## Array to add extra mounts (normally used with extraVolumes)
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
|
||||
## An array to add extra env vars
|
||||
## For example:
|
||||
## extraEnvVars:
|
||||
## - name: MY_ENV_VAR
|
||||
## value: env_var_value
|
||||
##
|
||||
extraEnvVars: []
|
||||
|
||||
## Name of a ConfigMap containing extra env vars
|
||||
##
|
||||
extraEnvVarsConfigMap:
|
||||
|
||||
## Name of a Secret containing extra env vars
|
||||
##
|
||||
extraEnvVarsSecret:
|
||||
|
||||
## Add your own init container or uncomment and modify the given example.
|
||||
##
|
||||
extraInitContainers: {}
|
||||
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
sidecars: {}
|
||||
## e.g.
|
||||
# - name: your-image-name
|
||||
# image: your-image
|
||||
# imagePullPolicy: Always
|
||||
# ports:
|
||||
# - name: portname
|
||||
# containerPort: 1234
|
||||
Reference in New Issue
Block a user