Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
refactor(stable/redis): support redis docker library image
Browse files Browse the repository at this point in the history
BREAKING CHANGES:
- `master.args` and `slave.args` are removed. Use `master.command` or
  `slave.command` instead in order to override the image entrypoint,
   or `master.extraFlags` to pass additional flags to `redis-server`.
- `disableCommands` is now interpreted as an array of strings instead
   of a string of comma separated values.
- `master.persistence.path` now defaults to `/data`.

Signed-off-by: Jacob LeGrone <git@jacob.work>
  • Loading branch information
jlegrone committed Sep 25, 2018
1 parent deb8322 commit 198a7f7
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 78 deletions.
2 changes: 1 addition & 1 deletion stable/redis/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: redis
version: 4.0.1
version: 5.0.0
appVersion: 4.0.11
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:
Expand Down
36 changes: 21 additions & 15 deletions stable/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ helm install stable/redis --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.
This chart bootstraps a [Redis](https://github.com/docker-library/redis) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

Expand Down Expand Up @@ -50,6 +50,16 @@ The command removes all the Kubernetes components associated with the chart and
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
incompatible breaking change needing manual actions.

### 5.0.0
This release switches the default image from [`docker.io/bitnami/redis`](https://hub.docker.com/r/bitnami/redis/) to [`docker.io/redis`](https://hub.docker.com/r/library/redis/). The bitnami image remains compatible with this chart; see [`values-bitnami.yaml`](values-bitnami.yaml).

The default image in this release may be switched out for any image containing the `redis-server` binary. If `redis-server` is not the default image ENTRYPOINT, `master.command` must be specified.

#### Breaking changes
- `master.args` and `slave.args` are removed. Use `master.command` or `slave.command` instead in order to override the image entrypoint, or `master.extraFlags` to pass additional flags to `redis-server`.
- `disableCommands` is now interpreted as an array of strings instead of a string of comma separated values.
- `master.persistence.path` now defaults to `/data`.

### 4.0.0

This version removes the `chart` label from the `spec.selector.matchLabels`
Expand All @@ -74,15 +84,15 @@ kubectl patch deployments my-release-redis-metrics --type=json -p='[{"op": "remo

The following table lists the configurable parameters of the Redis chart and their default values.

| Parameter | Description | Default |
|--------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------------------------------|
| Parameter | Description | Default |
|--------------------------------------------|----------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `image.registry` | Redis Image registry | `docker.io` |
| `image.repository` | Redis Image name | `bitnami/redis` |
| `image.repository` | Redis Image name | `redis` |
| `image.tag` | Redis Image tag | `{VERSION}` |
| `image.pullPolicy` | Image pull policy | `Always` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
| `cluster.enabled` | Use master-slave topology | `true` |
| `cluster.slaveCount` | Number of slaves | 1 |
| `cluster.slaveCount` | Number of slaves | `1` |
| `existingSecret` | Name of existing secret object (for password authentication) | `nil` |
| `usePassword` | Use password | `true` |
| `password` | Redis password (ignored if existingSecret set) | Randomly generated |
Expand All @@ -108,7 +118,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` |
| `persistence.existingClaim` | Provide an existing PersistentVolumeClaim | `nil` |
| `master.persistence.enabled` | Use a PVC to persist data (master node) | `true` |
| `master.persistence.path` | Path to mount the volume at, to use other images | `/bitnami` |
| `master.persistence.path` | Path to mount the volume at, to use other images | `/data` |
| `master.persistence.subPath` | Subdirectory of the volume to mount at | `""` |
| `master.persistence.storageClass` | Storage class of backing PVC | `generic` |
| `master.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
Expand All @@ -117,8 +127,8 @@ The following table lists the configurable parameters of the Redis chart and the
| `master.statefulset.rollingUpdatePartition`| Partition update strategy | `nil` |
| `master.podLabels` | Additional labels for Redis master pod | {} |
| `master.podAnnotations` | Additional annotations for Redis master pod | {} |
| `master.port` | Redis master port | 6379 |
| `master.args` | Redis master command-line args | [] |
| `master.port` | Redis master port | `6379` |
| `master.command` | Redis master entrypoint array. The docker image's ENTRYPOINT is used if this is not provided. | [] |
| `master.disableCommands` | Comma-separated list of Redis commands to disable (master) | `FLUSHDB,FLUSHALL` |
| `master.extraFlags` | Redis master additional command line flags | [] |
| `master.nodeSelector` | Redis master Node labels for pod assignment | {"beta.kubernetes.io/arch": "amd64"} |
Expand Down Expand Up @@ -151,7 +161,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `slave.service.annotations` | annotations for redis slave service | {} |
| `slave.service.loadBalancerIP` | LoadBalancerIP if Redis slave service type is `LoadBalancer` | `nil` |
| `slave.port` | Redis slave port | `master.port` |
| `slave.args` | Redis slave command-line args | `master.args` |
| `slave.command` | Redis slave entrypoint array. The docker image's ENTRYPOINT is used if this is not provided. | `master.command` |
| `slave.disableCommands` | Comma-separated list of Redis commands to disable (slave) | `master.disableCommands` |
| `slave.extraFlags` | Redis slave additional command line flags | `master.extraFlags` |
| `slave.livenessProbe.enabled` | Turn on and off liveness probe (redis slave pod) | `master.livenessProbe.enabled` |
Expand All @@ -173,9 +183,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `slave.securityContext.fsGroup` | Group ID for the container (redis slave pod) | `master.securityContext.fsGroup` |
| `slave.securityContext.runAsUser` | User ID for the container (redis slave pod) | `master.securityContext.runAsUser` |
| `slave.resources` | Redis slave CPU/Memory resource requests/limits | `master.resources` |
| `slave.affinity` | Enable node/pod affinity for slaves | {} |

The above parameters map to the env variables defined in [bitnami/redis](http://github.com/bitnami/bitnami-docker-redis). For more information please refer to the [bitnami/redis](http://github.com/bitnami/bitnami-docker-redis) image documentation.
| `slave.affinity` | Enable node/pod affinity for slaves | {} |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down Expand Up @@ -214,12 +222,10 @@ after a successful install.

## Persistence

The [Bitnami Redis](https://github.com/bitnami/bitnami-docker-redis) image stores the Redis data and configurations at the `/bitnami` path of the container.
The [Redis](https://github.com/docker-library/redis) image stores the Redis data and configurations at the `/data` path of the container.

By default, the chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at this location. The volume is created using dynamic volume provisioning. If a Persistent Volume Claim already exists, specify it during installation.

By default, the chart persists both data and configuration. If you wish to persist only the data directory set `persistence.path` to `/bitnami/redis/data` and `persistence.subPath` to `redis/data`.

### Existing PersistentVolumeClaim

1. Create the PersistentVolume
Expand Down
34 changes: 29 additions & 5 deletions stable/redis/templates/redis-master-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,35 @@ spec:
- name: {{ template "redis.fullname" . }}
image: "{{ template "redis.image" . }}"
imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }}
{{- if .Values.master.args }}
{{- if .Values.master.command }}
command:
{{ toYaml .Values.master.command | indent 10 }}
{{- end }}
args:
{{ toYaml .Values.master.args | indent 10 }}
- "--port"
- "$(REDIS_PORT)"
- "--dir"
- {{ .Values.master.persistence.path | quote }}
{{- if .Values.usePassword }}
- "--requirepass"
- "$(REDIS_PASSWORD)"
{{- else }}
- "--protected-mode"
- "no"
{{- end }}
{{- if .Values.configmap }}
- "--include"
- "/opt/helm/redis/etc/redis.conf"
{{- end }}
{{- if .Values.master.extraFlags }}
- "$(REDIS_EXTRA_FLAGS)"
{{- end }}
{{- if .Values.master.disableCommands }}
{{- range .Values.master.disableCommands }}
- "--rename-command"
- {{ . | quote }}
- ""
{{- end }}
{{- end }}
env:
- name: REDIS_REPLICATION_MODE
Expand All @@ -86,8 +112,6 @@ spec:
{{- end }}
- name: REDIS_PORT
value: {{ .Values.master.port | quote }}
- name: REDIS_DISABLE_COMMANDS
value: {{ .Values.master.disableCommands }}
{{- if .Values.master.extraFlags }}
- name: REDIS_EXTRA_FLAGS
value: {{ .Values.master.extraFlags | join " " }}
Expand Down Expand Up @@ -131,7 +155,7 @@ spec:
subPath: {{ .Values.master.persistence.subPath }}
{{- if .Values.configmap }}
- name: config
mountPath: /opt/bitnami/redis/etc/redis.conf
mountPath: /opt/helm/redis/etc/redis.conf
subPath: redis.conf
{{- end }}
volumes:
Expand Down
45 changes: 40 additions & 5 deletions stable/redis/templates/redis-slave-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,42 @@ spec:
- name: {{ template "redis.fullname" . }}
image: {{ template "redis.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | default "" | quote }}
{{- if (.Values.slave.args | default .Values.master.args) }}
{{- $command := default .Values.master.command .Values.slave.command }}
{{- if $command }}
command:
{{ toYaml $command | indent 10 }}
{{- end }}
args:
{{ toYaml (.Values.slave.args | default .Values.master.args) | indent 10 }}
- "--port"
- "$(REDIS_PORT)"
- "--dir"
- "/data"
- "--slaveof"
- "$(REDIS_MASTER_HOST)"
- "$(REDIS_MASTER_PORT_NUMBER)"
{{- if .Values.usePassword }}
- "--requirepass"
- "$(REDIS_PASSWORD)"
- "--masterauth"
- "$(REDIS_MASTER_PASSWORD)"
{{- else }}
- "--protected-mode"
- "no"
{{- end }}
{{- if .Values.configmap }}
- "--include"
- "/opt/helm/redis/etc/redis.conf"
{{- end }}
{{- if (.Values.slave.extraFlags | default .Values.master.extraFlags) }}
- "$(REDIS_EXTRA_FLAGS)"
{{- end }}
{{- $disabledCommandsSlice := default .Values.master.disableCommands .Values.slave.disableCommands }}
{{- if $disabledCommandsSlice }}
{{- range $disabledCommandsSlice }}
- "--rename-command"
- {{ . | quote }}
- ""
{{- end }}
{{- end }}
env:
- name: REDIS_REPLICATION_MODE
Expand Down Expand Up @@ -99,8 +132,6 @@ spec:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
{{- end }}
- name: REDIS_DISABLE_COMMANDS
value: {{ .Values.slave.disableCommands | default .Values.master.disableCommands }}
{{- if (.Values.slave.extraFlags | default .Values.master.extraFlags) }}
- name: REDIS_EXTRA_FLAGS
value: {{ .Values.slave.extraFlags | default .Values.master.extraFlags | join " " }}
Expand All @@ -117,9 +148,11 @@ spec:
volumeMounts:
- name: health
mountPath: /health
- name: redis-data
mountPath: /data
{{- if .Values.configmap }}
- name: config
mountPath: /opt/bitnami/redis/etc/redis.conf
mountPath: /opt/helm/redis/etc/redis.conf
subPath: redis.conf
{{- end }}
volumes:
Expand All @@ -132,4 +165,6 @@ spec:
configMap:
name: {{ template "redis.fullname" . }}
{{- end }}
- name: redis-data
emptyDir: {}
{{- end }}
17 changes: 17 additions & 0 deletions stable/redis/values-bitnami.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
image:
registry: docker.io
repository: bitnami/redis
## Bitnami Redis image tag
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
##
tag: 4.0.11-debian-9

master:
command:
- redis-server
persistence:
## By default, the chart persists both data and configuration.
## If you wish to persist only the data directory set `persistence.path` to `/bitnami/redis/data`
## and `persistence.subPath` to `redis/data`.
#
path: /bitnami/redis/data
Loading

0 comments on commit 198a7f7

Please # to comment.