Commit d8fddca2 by Guangbo Chen

Bump redis to v9.0.2

parent ff9d188e
apiVersion: v1
name: redis
version: 3.0.2
appVersion: 4.0.9
version: 9.0.2
appVersion: 5.0.5
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
icon: file://../redis-stack-220x234.png
sources:
- https://github.com/bitnami/bitnami-docker-redis
maintainers:
- name: bitnami-bot
email: containers@bitnami.com
- name: desaintmartin
email: cedric@desaintmartin.fr
engine: gotpl
approvers:
- carrodher
- javsalgar
- desaintmartin
- juan131
- prydonius
- tompizmor
- sameersbn
- carrodher
- tompizmor
reviewers:
- carrodher
- javsalgar
- desaintmartin
- juan131
- prydonius
- tompizmor
- sameersbn
- carrodher
- tompizmor
......@@ -2,6 +2,8 @@
[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.
## Introduction
## Notable changes
### 9.0.2
**Warning:** Upgrade from previous version v3.0.2 currently is not supported.
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.
labels:
io.cattle.role: project # options are cluster/project
io.rancher.app_min_version: 9.0.2
categories:
- KeyValue
- Database
questions:
- variable: defaultImage
default: "true"
description: "Use default Docker images"
label: Use Default Images
type: boolean
show_subquestion_if: false
group: "Container Images"
subquestions:
- variable: image.repository
default: "bitnami/redis"
description: "Redis image name"
type: string
label: Redis Image Name
- variable: image.tag
default: "4.0.9"
description: "Redis image tag"
type: string
label: Redis Image Tag
- variable: metrics.image.repository
default: "oliver006/redis_exporter"
description: "Metrics image name"
type: string
label: Metrics Image Name
show_if: "metrics.enabled=true"
- variable: metrics.image.tag
default: "v0.11"
description: "Metrics image tag"
type: string
label: Metrics Image Tag
show_if: "metrics.enabled=true"
- variable: cluster.enabled
default: "true"
description: "Use leader-follower topology"
label: Clustered Topology
default: true
description: "Enable master-slave topology"
label: Enable Master-Slave Topology
type: boolean
show_subquestion_if: true
group: "Redis Slave Settings"
group: "Redis Master Settings"
subquestions:
- variable: cluster.slaveCount
default: "3"
description: "Number of followers"
type: string
label: Number of Followers
default: 2
required: true
description: "Set the Number of Redis followers"
type: int
label: Number of Redis Followers
- variable: usePassword
default: "true"
description: "Use password authentication"
......@@ -56,11 +30,12 @@ questions:
subquestions:
- variable: password
default: ""
required: true
description: "password will be auto-generated if not specified"
type: password
label: Redis Password
- variable: master.persistence.enabled
default: "false"
default: false
description: "Use persistent storage"
type: boolean
required: true
......@@ -78,41 +53,94 @@ questions:
description: "If undefined or null, uses the default StorageClass. Defaults to null."
type: storageclass
label: Default Storage Class
- variable: slave.service.type
- variable: persistence.existingClaim
default: ""
description: "If not empty, uses the specified existing PVC instead of creating new one"
type: pvc
label: Existing Persistent Volume Claim for Redis Master
- variable: metrics.enabled
default: false
description: "Start a side-car prometheus exporter"
label: Enable Redis Metrics Exporter
type: boolean
group: "Redis Master Settings"
- variable: master.service.type
default: "ClusterIP"
description: "Redis slave service type"
description: "Redis master service type"
type: enum
group: "Services and Load Balancing"
group: "Redis Master Settings"
options:
- "ClusterIP"
- "NodePort"
required: true
label: Redis Slave Service Type
label: Redis Master Service Type
show_subquestion_if: "NodePort"
subquestions:
- variable: slave.service.nodePort
- variable: master.service.nodePort
default: ""
description: "NodePort port number(to set explicitly, choose port between 30000-32767)"
type: int
min: 30000
max: 32767
label: Redis Slave Service NodePort number
- variable: master.service.type
label: Redis Master Service NodePort number
# slave config
- variable: slave.persistence.enabled
default: false
description: "Use persistent storage of slave mode"
type: boolean
required: true
label: Slave Persistent Volume Enabled
show_subquestion_if: true
group: "Redis Slave Settings"
subquestions:
- variable: slave.persistence.size
default: "8Gi"
description: "Persistent volume size"
type: string
label: Slave Persistent Volume Size
- variable: slave.persistence.storageClass
default: ""
description: "If undefined or null, uses the default StorageClass. Defaults to null."
type: storageclass
label: Slave Default Storage Class
- variable: slave.service.type
default: "ClusterIP"
description: "Redis master service type"
description: "Redis slave service type"
type: enum
group: "Services and Load Balancing"
group: "Redis Slave Settings"
options:
- "ClusterIP"
- "NodePort"
- "ClusterIP"
- "NodePort"
required: true
label: Redis Master Service Type
label: Redis Slave Service Type
show_subquestion_if: "NodePort"
subquestions:
- variable: master.service.nodePort
- variable: slave.service.nodePort
default: ""
description: "NodePort port number(to set explicitly, choose port between 30000-32767)"
type: int
min: 30000
max: 32767
label: Redis Master Service NodePort number
label: Redis Slave Service NodePort number
# sentinel config
- variable: sentinel.enabled
default: false
description: "Enable redis sentinel mode"
type: boolean
required: true
label: Enable Sentinel Containers
show_subquestion_if: true
group: "Redis Sentinel Settings"
subquestions:
- variable: sentinel.masterSet
default: "mymaster"
description: "Name of the sentinel master set"
type: string
label: MasterSet Name
required: true
- variable: sentinel.quorum
default: 2
description: "Quorum for electing a new master"
type: int
label: Master Electing Quorum
required: true
......@@ -21,15 +21,24 @@
{{- end }}
{{- if .Values.cluster.enabled }}
Redis can be accessed via port {{ .Values.master.port }} on the following DNS names from within your cluster:
{{- if .Values.sentinel.enabled }}
Redis can be accessed via port {{ .Values.sentinel.service.redisPort }} on the following DNS name from within your cluster:
{{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.cluster.local for read/write operations
{{ template "redis.fullname" . }}-slave.{{ .Release.Namespace }}.svc.cluster.local for read-only operations
{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read only operations
For read/write operations, first access the Redis Sentinel cluster, which is available in port {{ .Values.sentinel.service.sentinelPort }} using the same domain name above.
{{- else }}
Redis can be accessed via port {{ .Values.master.port }} on the following DNS name from within your cluster:
Redis can be accessed via port {{ .Values.redisPort }} on the following DNS names from within your cluster:
{{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read/write operations
{{ template "redis.fullname" . }}-slave.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read-only operations
{{- end }}
{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{- else }}
Redis can be accessed via port {{ .Values.redisPort }} on the following DNS name from within your cluster:
{{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
{{- end }}
......@@ -43,7 +52,7 @@ To connect to your Redis server:
1. Run a Redis pod that you can use as a client:
kubectl run --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }}-client --rm --tty -i \
kubectl run --namespace {{ .Release.Namespace }} {{ template "redis.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.name" . }}-client=true" \{{- end }}
--image {{ template "redis.image" . }} -- bash
......@@ -51,10 +60,15 @@ To connect to your Redis server:
2. Connect using the Redis CLI:
{{- if .Values.cluster.enabled }}
{{- if .Values.sentinel.enabled }}
redis-cli -h {{ template "redis.fullname" . }} -p {{ .Values.sentinel.service.redisPort }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} # Read only operations
redis-cli -h {{ template "redis.fullname" . }} -p {{ .Values.sentinel.service.sentinelPort }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} # Sentinel access
{{- else }}
redis-cli -h {{ template "redis.fullname" . }}-master{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
redis-cli -h {{ template "redis.fullname" . }}-slave{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
{{- end }}
{{- else }}
redis-cli -h {{ template "redis.fullname" . }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
redis-cli -h {{ template "redis.fullname" . }}-master{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
{{- end }}
{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
......@@ -76,14 +90,15 @@ To connect to your database from outside the cluster execute the following comma
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.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
redis-cli -h $SERVICE_IP -p {{ .Values.master.service.nodePort }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
{{- else if contains "ClusterIP" .Values.master.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "redis.name" . }}" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME {{ .Values.master.port }}:{{ .Values.master.port }}
redis-cli -h 127.0.0.1 -p {{ .Values.master.port }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "redis.fullname" . }} {{ .Values.redisPort }}:{{ .Values.redisPort }} &
redis-cli -h 127.0.0.1 -p {{ .Values.redisPort }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}
{{- end }}
{{- end }}
{{ include "redis.checkRollingTags" . }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "redis.fullname" . }}
data:
redis.conf: |-
{{- if .Values.configmap }}
# User-supplied configuration:
{{ .Values.configmap | indent 4 }}
{{- end }}
master.conf: |-
dir {{ .Values.master.persistence.path }}
{{- if .Values.master.configmap }}
# User-supplied master configuration:
{{ .Values.master.configmap | indent 4 }}
{{- end }}
{{- if .Values.master.disableCommands }}
{{- range .Values.master.disableCommands }}
rename-command {{ . }} ""
{{- end }}
{{- end }}
replica.conf: |-
dir {{ .Values.slave.persistence.path }}
slave-read-only yes
{{- if .Values.slave.configmap }}
# User-supplied slave configuration:
{{ .Values.slave.configmap | indent 4 }}
{{- end }}
{{- if .Values.slave.disableCommands }}
{{- range .Values.slave.disableCommands }}
rename-command {{ . }} ""
{{- end }}
{{- end }}
{{- if .Values.sentinel.enabled }}
sentinel.conf: |-
dir "/tmp"
bind 0.0.0.0
port {{ .Values.sentinel.port }}
sentinel monitor {{ .Values.sentinel.masterSet }} {{ template "redis.fullname" . }}-master-0.{{ template "redis.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} {{ .Values.redisPort }} {{ .Values.sentinel.quorum }}
sentinel down-after-milliseconds {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.downAfterMilliseconds }}
sentinel failover-timeout {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.failoverTimeout }}
sentinel parallel-syncs {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.parallelSyncs }}
{{- if .Values.sentinel.configmap }}
# User-supplied sentinel configuration:
{{ .Values.sentinel.configmap | indent 4 }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}-headless
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: ClusterIP
clusterIP: None
ports:
- name: redis
port: {{ .Values.redisPort }}
targetPort: redis
{{- if .Values.sentinel.enabled }}
- name: redis-sentinel
port: {{ .Values.sentinel.port }}
targetPort: redis-sentinel
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: "{{ .Release.Name }}"
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "redis.fullname" . }}-health
data:
ping_readiness_local.sh: |-
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}`
export REDIS_PASSWORD=$password_aux
{{- end }}
response=$(
timeout -s 9 $1 \
redis-cli \
{{- if .Values.usePassword }}
-a $REDIS_PASSWORD --no-auth-warning \
{{- end }}
-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 REDIS_PASSWORD=$password_aux
{{- end }}
response=$(
timeout -s 9 $1 \
redis-cli \
{{- if .Values.usePassword }}
-a $REDIS_PASSWORD --no-auth-warning \
{{- end }}
-h localhost \
-p $REDIS_PORT \
ping
)
if [ "$response" != "PONG" ] && [ "$response" != "LOADING Redis is loading the dataset in memory" ]; then
echo "$response"
exit 1
fi
{{- if .Values.sentinel.enabled }}
ping_sentinel.sh: |-
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}`
export REDIS_PASSWORD=$password_aux
{{- end }}
response=$(
timeout -s 9 $1 \
redis-cli \
{{- if .Values.usePassword }}
-a $REDIS_PASSWORD --no-auth-warning \
{{- end }}
-h localhost \
-p $REDIS_SENTINEL_PORT \
ping
)
if [ "$response" != "PONG" ]; then
echo "$response"
exit 1
fi
parse_sentinels.awk: |-
/ip/ {FOUND_IP=1}
/port/ {FOUND_PORT=1}
/runid/ {FOUND_RUNID=1}
!/ip|port|runid/ {
if (FOUND_IP==1) {
IP=$1; FOUND_IP=0;
}
else if (FOUND_PORT==1) {
PORT=$1;
FOUND_PORT=0;
} else if (FOUND_RUNID==1) {
printf "\nsentinel known-sentinel {{ .Values.sentinel.masterSet }} %s %s %s", IP, PORT, $0; FOUND_RUNID=0;
}
}
{{- end }}
ping_readiness_master.sh: |-
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_MASTER_PASSWORD_FILE}`
export REDIS_MASTER_PASSWORD=$password_aux
{{- end }}
response=$(
timeout -s 9 $1 \
redis-cli \
{{- if .Values.usePassword }}
-a $REDIS_MASTER_PASSWORD --no-auth-warning \
{{- end }}
-h $REDIS_MASTER_HOST \
-p $REDIS_MASTER_PORT_NUMBER \
ping
)
if [ "$response" != "PONG" ]; then
echo "$response"
exit 1
fi
ping_liveness_master.sh: |-
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_MASTER_PASSWORD_FILE}`
export REDIS_MASTER_PASSWORD=$password_aux
{{- end }}
response=$(
timeout -s 9 $1 \
redis-cli \
{{- if .Values.usePassword }}
-a $REDIS_MASTER_PASSWORD --no-auth-warning \
{{- end }}
-h $REDIS_MASTER_HOST \
-p $REDIS_MASTER_PORT_NUMBER \
ping
)
if [ "$response" != "PONG" ] && [ "$response" != "LOADING Redis is loading the dataset in memory" ]; then
echo "$response"
exit 1
fi
ping_readiness_local_and_master.sh: |-
script_dir="$(dirname "$0")"
exit_status=0
"$script_dir/ping_readiness_local.sh" $1 || exit_status=$?
"$script_dir/ping_readiness_master.sh" $1 || exit_status=$?
exit $exit_status
ping_liveness_local_and_master.sh: |-
script_dir="$(dirname "$0")"
exit_status=0
"$script_dir/ping_liveness_local.sh" $1 || exit_status=$?
"$script_dir/ping_liveness_master.sh" $1 || exit_status=$?
exit $exit_status
{{- if .Values.metrics.enabled }}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "redis.fullname" . }}-metrics
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
template:
metadata:
labels:
release: "{{ .Release.Name }}"
role: metrics
app: {{ template "redis.name" . }}
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
annotations:
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.metrics.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- if .Values.metrics.nodeSelector }}
nodeSelector:
{{ toYaml .Values.metrics.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.metrics.tolerations }}
tolerations:
{{ toYaml .Values.metrics.tolerations | indent 8 }}
{{- end }}
containers:
- name: metrics
image: {{ template "metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
env:
- name: REDIS_ADDR
{{- if .Values.cluster.enabled }}
value: {{ printf "%s-master:%d,%s-slave:%d" ( include "redis.fullname" . ) ( int .Values.master.port ) ( include "redis.fullname" . ) ( .Values.slave.port | default .Values.master.port | int ) | quote }}
{{- else }}
value: {{ printf "%s-master:%d" (include "redis.fullname" . ) (int .Values.master.port) | quote }}
{{- end }}
- name: REDIS_ALIAS
value: {{ template "redis.fullname" . }}
{{- if .Values.usePassword }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.fullname" . }}
key: redis-password
{{- end }}
ports:
- name: metrics
containerPort: 9121
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
{{- if and (.Values.metrics.enabled) (.Values.metrics.serviceMonitor.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "redis.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- end }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- 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:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end -}}
{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}-metrics
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.metrics.service.annotations }}
annotations:
{{ toYaml .Values.metrics.service.annotations | indent 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: metrics
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- end }}
\ No newline at end of file
......@@ -12,15 +12,33 @@ spec:
podSelector:
matchLabels:
app: {{ template "redis.name" . }}
release: "{{ .Release.Name }}"
ingress:
# Allow inbound connections
- ports:
- port: 6379
- port: {{ .Values.redisPort }}
{{- if .Values.sentinel.enabled }}
- port: {{ .Values.sentinel.port }}
{{- end }}
{{- if not .Values.networkPolicy.allowExternal }}
from:
- podSelector:
matchLabels:
{{ template "redis.fullname" . }}-client: "true"
- podSelector:
matchLabels:
{{ template "redis.fullname" . }}-client: "true"
{{- if .Values.metrics.enabled }}
- podSelector:
matchLabels:
release: "{{ .Release.Name }}"
role: metrics
app: {{ template "redis.name" . }}
{{- end }}
{{- if ge .Values.cluster.slaveCount 1.0 }}
- podSelector:
matchLabels:
release: "{{ .Release.Name }}"
role: slave
app: {{ template "redis.name" . }}
{{- end }}
{{- end }}
{{- if .Values.metrics.enabled }}
# Allow prometheus scrapes for metrics
......
{{- if not .Values.sentinel.enabled }}
apiVersion: v1
kind: Service
metadata:
......@@ -7,13 +8,10 @@ metadata:
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- if .Values.master.service.annotations }}
annotations:
{{ toYaml .Values.master.service.annotations | indent 4 }}
{{- end }}
{{- if .Values.metrics.enabled }}
{{ toYaml .Values.metrics.targetServiceAnnotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.master.service.type }}
{{ if eq .Values.master.service.type "LoadBalancer" -}} {{ if .Values.master.service.loadBalancerIP -}}
......@@ -22,16 +20,13 @@ spec:
{{- end -}}
ports:
- name: redis
port: 6379
port: {{ .Values.master.service.port }}
targetPort: redis
{{- if .Values.metrics.enabled }}
- name: metrics
port: 9121
targetPort: metrics
{{- end }}
{{- if .Values.master.service.nodePort }}
nodePort: {{ .Values.master.service.nodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: "{{ .Release.Name }}"
{{- if .Values.cluster.enabled }}
role: master
{{- end }}
{{- end }}
{{- if and .Values.rbac.create .Values.rbac.role.rules -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ template "redis.fullname" . }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
rules:
{{ toYaml .Values.rbac.role.rules }}
{{- end -}}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ template "redis.fullname" . }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "redis.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "redis.serviceAccountName" . }}
{{- end -}}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "redis.serviceAccountName" . }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end -}}
{{- if .Values.cluster.enabled }}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "redis.fullname" . }}-slave
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
{{- if .Values.cluster.slaveCount }}
replicas: {{ .Values.cluster.slaveCount }}
{{- end }}
template:
metadata:
labels:
release: "{{ .Release.Name }}"
role: slave
app: {{ template "redis.name" . }}
{{- if (.Values.slave.podLabels | default .Values.master.podLabels) }}
{{ toYaml (.Values.slave.podLabels | default .Values.master.podLabels) | indent 8 }}
{{- end }}
{{- if (.Values.slave.podAnnotations | default .Values.master.podAnnotations) }}
annotations:
{{ toYaml (.Values.slave.podAnnotations | default .Values.master.podAnnotations) | indent 8 }}
{{- end }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- /* Include master securityContext if slave securityContext not defined */ -}}
{{ include "redis.slave.securityContext" . | indent 6 }}
{{- if (.Values.slave.nodeSelector | default .Values.master.nodeSelector) }}
nodeSelector:
{{ toYaml (.Values.slave.nodeSelector | default .Values.master.nodeSelector) | indent 8 }}
{{- end }}
{{- if (.Values.slave.tolerations | default .Values.master.tolerations) }}
tolerations:
{{ toYaml (.Values.slave.tolerations | default .Values.master.tolerations) | indent 8 }}
{{- end }}
containers:
- name: {{ template "redis.fullname" . }}
image: {{ template "redis.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | default "" | quote }}
{{- if (.Values.slave.args | default .Values.master.args) }}
args:
{{ toYaml (.Values.slave.args | default .Values.master.args) | indent 10 }}
{{- end }}
env:
- name: REDIS_REPLICATION_MODE
value: slave
- name: REDIS_MASTER_HOST
value: {{ template "redis.fullname" . }}-master
- name: REDIS_PORT
value: {{ .Values.slave.port | default .Values.master.port | quote }}
- name: REDIS_MASTER_PORT_NUMBER
value: {{ .Values.master.port | quote }}
{{- if .Values.usePassword }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "redis.fullname" . }}
{{- end }}
key: redis-password
- name: REDIS_MASTER_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "redis.fullname" . }}
{{- end }}
key: redis-password
{{- else }}
- 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 " " }}
{{- end }}
ports:
- name: redis
containerPort: {{ .Values.slave.port | default .Values.master.port }}
{{- /* Include master livenessProbe if slave livenessProbe not defined */ -}}
{{ include "redis.slave.livenessProbe" . | indent 8 }}
{{- /* Include master readinessProbe if slave readinessProbe not defined */ -}}
{{ include "redis.slave.readinessProbe" . | indent 8 }}
resources:
{{ toYaml (.Values.slave.resources | default .Values.master.resources) | indent 10 }}
{{- end }}
{{- if .Values.cluster.enabled }}
{{- if and .Values.cluster.enabled (not .Values.sentinel.enabled) }}
apiVersion: v1
kind: Service
metadata:
......@@ -8,12 +8,9 @@ metadata:
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.slave.service.annotations }}
annotations:
{{- if .Values.master.service.annotations }}
{{ toYaml .Values.master.service.annotations | indent 4 }}
{{- end }}
{{- if .Values.metrics.enabled }}
{{ toYaml .Values.metrics.targetServiceAnnotations | indent 4 }}
{{ toYaml .Values.slave.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.slave.service.type }}
......@@ -23,15 +20,13 @@ spec:
{{- end -}}
ports:
- name: redis
port: 6379
port: {{ .Values.slave.service.port }}
targetPort: redis
{{- if .Values.metrics.enabled }}
- name: metrics
port: 9121
targetPort: metrics
{{- end }}
{{- if .Values.slave.service.nodePort }}
nodePort: {{ .Values.slave.service.nodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: "{{ .Release.Name }}"
role: slave
{{- end}}
{{- end }}
{{- if .Values.sentinel.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.master.service.annotations }}
annotations:
{{ toYaml .Values.master.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.master.service.type }}
{{ if eq .Values.master.service.type "LoadBalancer" -}} {{ if .Values.master.service.loadBalancerIP -}}
loadBalancerIP: {{ .Values.master.service.loadBalancerIP }}
{{ end -}}
{{- end -}}
ports:
- name: redis
port: {{ .Values.sentinel.service.redisPort }}
targetPort: redis
{{- if .Values.sentinel.service.redisNodePort }}
nodePort: {{ .Values.sentinel.service.redisNodePort }}
{{- end }}
- name: redis-sentinel
port: {{ .Values.sentinel.service.sentinelPort }}
targetPort: redis-sentinel
{{- if .Values.sentinel.service.sentinelNodePort }}
nodePort: {{ .Values.sentinel.service.sentinelNodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: "{{ .Release.Name }}"
{{- end }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment