Commit 8ab2ac1d by Guangbo Chen

updated chart folder names using version number and fixed chart questions

parent 19619b01
......@@ -36,11 +36,6 @@ questions:
description: "MySQL Password for the new user, defaults to a random 10-character alphanumeric string if not set"
type: password
label: MySQL Password
- variable: mysqlRootPassword
default: ""
description: "Password for the root user, defaults to a random 10-character alphanumeric string if not set"
type: password
label: MySQL Root Password
- variable: persistence.enabled
default: "false"
description: "Enable persistence using PVC"
......@@ -54,6 +49,7 @@ questions:
description: "Volume Size"
type: string
label: Volume Size
required: true
- variable: persistence.storageClass
default: ""
description: "If unndefined or set to null, using the default storageClass. default to null"
......
name: redis-ha
home: http://redis.io/
engine: gotpl
keywords:
- redis
- keyvalue
- database
version: 2.1.1
appVersion: 4.0.8-r0
description: Highly available Redis cluster with multiple sentinels and standbys.
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
maintainers:
- email: ikaboubi@gmail.com
name: smileisak
- email: ianmaddox@google.com
name: ianmaddox
details:
This package provides a highly available Redis cluster with multiple sentinels and standbys.
Note the `redis-master` pod is used for bootstrapping only and can be deleted once
the cluster is up and running.
sources:
- https://github.com/smileisak/docker-images/tree/master/redis
- https://github.com/diegocn/docker-images/tree/master/redis
## Appliance mode
This chart can be used to launch Redis in a black box appliance mode that you can think of like a managed service. To run as an appliance, change the service type for the master and slave LBs to enable local access from within the K8S cluster.
To launch in VPC-only appliance mode, set appliance.serviceType to "LoadBalancer". If using appliance mode in Google Cloud, set appliance.annotations to:
`cloud.google.com/load-balancer-type:Internal`
```bash
$ helm install \
--set="servers.annotations.cloud\.google\.com/load-balancer-type=Internal,servers.serviceType=LoadBalancer" \
stable/redis-ha
```
## Configuration
The following table lists the configurable parameters of the Redis chart and their default values.
| Parameter | Description | Default |
| -------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- |
| `redis_image` | Redis image | `quay.io/smile/redis:4.0.6r2` |
| `resources.master` | CPU/Memory for master nodes resource requests/limits | Memory: `200Mi`, CPU: `100m` |
| `resources.slave` | CPU/Memory for slave nodes resource requests/limits | Memory: `200Mi`, CPU: `100m` |
| `resources.sentinel` | CPU/Memory for sentinel node resource requests/limits | Memory: `200Mi`, CPU: `100m` |
| `replicas.servers` | Number of redis master/slave pods | 3 |
| `replicas.sentinels` | Number of sentinel pods | 3 |
| `nodeSelector` | Node labels for pod assignment | {} |
| `tolerations` | Toleration labels for pod assignment | [] |
| `servers.serviceType` | Set to "LoadBalancer" to enable access from the VPC | ClusterIP |
| `servers.annotations` | See Appliance mode | `` |
| `rbac.create` | whether RBAC resources should be created | true |
| `serviceAccount.create` | whether a new service account name that the agent will use should be created. | true |
| `serviceAccount.name` | service account to be used. If not set and serviceAccount.create is `true` a name is generated using the fullname template. | `` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install \
--set redis_image=quay.io/smile/redis:4.0.6r2 \
stable/redis-ha
```
The above command sets the Redis server within `default` namespace.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install -f values.yaml stable/redis-ha
```
> **Tip**: You can use the default [values.yaml](values.yaml)
## Internals
The customized Redis server image determines whether the pod that executes it will be a Redis Sentinel,
Master, or Slave and launches the appropriate service. This Helm chart signals Sentinel status with
environment variables. If not set, the newly launched pod will query K8S for an active master. If none
exists, it uses a deterministic means of sensing whether it should launch as master then writes "master"
or "slave" to the label called redis-role as appropriate. It's this label that determines which LB a pod
can be seen through.
The redis-role=master pod is the key for the cluster to get started. Sentinels will wait for it to appear
in the LB before they finish launching. All other pods wait for the Sentinels to ID the master. Running
Pods also set the labels podIP and runID. runID is the first few characters of the unique run_id value
generated by each Redis server.
During normal operation, there should be only one redis-role=master pod. If it fails, the Sentinels
will nominate a new master and change all the redis-role values appropriately.
To see the pod roles, run the following:
```bash
$ kubectl get pods -L redis-role
```
# 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.
## 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.
By default this chart install one master pod containing redis master container and sentinel container, 2 sentinels and 1 redis slave.
categories:
- KeyValue
- Database
questions:
- variable: defaultImage
default: "true"
description: "Use default Docker image"
label: Use Default Image
type: boolean
show_subquestion_if: false
subquestions:
- variable: image
default: "quay.io/smile/redis:4.0.8r0"
description: "Redis Docker image"
type: string
label: Redis Docker Image
- variable: replicas.servers
default: "3"
description: "Number of redis master/slave pods"
type: string
label: Redis Replicas
required: true
- variable: replicas.sentinels
default: "3"
description: "Number of sentinel pods"
type: string
label: Sentinel Replicas
required: true
- variable: auth
default: "false"
description: "Configures redis with Auth"
type: boolean
required: true
label: Redis Auth Enabled
show_subquestion_if: true
subquestions:
- variable: redisPassword
default: ""
description: "Redis password, defaults to a random 10-character alphanumeric string if not set and auth is true"
type: password
label: Redis Password
- variable: servers.serviceType
default: "ClusterIP"
description: "Service type for Redis servers"
type: enum
options:
- "ClusterIP"
- "LoadBalancer"
label: Service type for Redis servers
Redis cluster can be accessed via port 6379 on the following DNS name from within your cluster:
{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
To connect to your Redis server:
{{- if .Values.auth }}
1. Get the randomly generated redis password:
echo $(kubectl get secret {{ template "fullname" . }} -o "jsonpath={.data['auth']}" | base64 -D)
2. Connect to the Redis master pod that you can use as a client:
kubectl exec -it $(kubectl get pod -o jsonpath='{range .items[*]}{.metadata.name} {.status.containerStatuses[0].state}{"\n"}{end}' -l redis-role=master | grep running | awk '{print $1}') bash
3. Connect using the Redis CLI (inside container):
redis-cli -a <REDIS-PASS-FROM-SECRET>
{{- else }}
1. Run a Redis pod that you can use as a client:
kubectl exec -it {{ template "fullname" . }}-master-0 bash
2. Connect using the Redis CLI:
redis-cli -h {{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
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).
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- 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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- /*
Credit: @technosophos
https://github.com/technosophos/common-chart/
labels.standard prints the standard Helm labels.
The standard labels are frequently used in metadata.
*/ -}}
{{- define "labels.standard" -}}
app: {{ template "name" . }}
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: {{ template "chartref" . }}
{{- end -}}
{{- /*
Credit: @technosophos
https://github.com/technosophos/common-chart/
chartref prints a chart name and version.
It does minimal escaping for use in Kubernetes labels.
Example output:
zookeeper-1.2.3
wordpress-3.2.1_20170219
*/ -}}
{{- define "chartref" -}}
{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "redis-ha.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{- if .Values.auth -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}
type: Opaque
data:
{{- if .Values.redisPassword }}
auth: {{ .Values.redisPassword | b64enc | quote }}
{{- else }}
auth: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end -}}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-master-svc
annotations:
{{ toYaml .Values.servers.annotations | indent 4 }}
spec:
ports:
- port: 6379
protocol: TCP
targetPort: 6379
selector:
app: "redis-ha"
redis-node: "true"
redis-role: "master"
release: "{{ .Release.Name }}"
type: "{{ .Values.servers.serviceType }}"
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: {{ template "fullname" . }}
labels:
app: "redis-ha"
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- patch
{{- end -}}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ .Chart.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "redis-ha.serviceAccountName" . }}
{{- end -}}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-sentinel
spec:
replicas: {{ .Values.replicas.sentinels }}
template:
metadata:
labels:
app: "redis-ha"
name: {{ template "fullname" . }}-sentinel
{{ include "labels.standard" . | indent 8 }}
spec:
serviceAccountName: {{ template "redis-ha.serviceAccountName" . }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
containers:
- name: sentinel
image: {{ .Values.redis_image }}
resources:
{{ toYaml .Values.resources.sentinel | indent 10 }}
env:
- name: SENTINEL
value: "true"
- name: REDIS_CHART_PREFIX
value: {{ template "fullname" . }}-
{{- if .Values.auth }}
- name: REDIS_PASS
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: auth
{{- end }}
ports:
- containerPort: 26379
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ template "name" . }}-sentinel-svc
role: service
{{ include "labels.standard" . | indent 4 }}
name: {{ template "fullname" . }}-sentinel
spec:
ports:
- port: 26379
targetPort: 26379
selector:
redis-role: "sentinel"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
apiVersion: apps/v1beta1
kind: Deployment
metadata:
# Pay attention to the redis-role label at runtime. The self-determination logic in the image sets this value accordingly.
name: {{ template "fullname" . }}-server
labels:
release: "{{ .Release.Name }}"
app: "redis-ha"
name: "redis-server"
redis-node: "true"
{{ include "labels.standard" . | indent 4 }}
spec:
replicas: {{ .Values.replicas.servers }}
template:
metadata:
labels:
app: "redis-ha"
name: "redis-server"
redis-node: "true"
{{ include "labels.standard" . | indent 8 }}
spec:
serviceAccountName: {{ template "redis-ha.serviceAccountName" . }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
containers:
- name: redis
image: {{ .Values.redis_image }}
resources:
{{ toYaml .Values.resources.server | indent 10 }}
env:
- name: REDIS_SENTINEL_SERVICE_HOST
value: "redis-sentinel"
- name: REDIS_CHART_PREFIX
value: {{ template "fullname" . }}-
{{- if .Values.auth }}
- name: REDIS_PASS
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: auth
{{- end }}
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /redis-master-data
name: data
volumes:
- name: data
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "redis-ha.serviceAccountName" . }}
labels:
app: "redis-ha"
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- end -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-slave-svc
annotations:
{{ toYaml .Values.servers.annotations | indent 4 }}
spec:
ports:
- port: 6379
protocol: TCP
targetPort: 6379
selector:
app: "redis-ha"
redis-node: "true"
redis-role: "slave"
release: "{{ .Release.Name }}"
type: "{{ .Values.servers.serviceType }}"
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
server:
requests:
memory: 200Mi
cpu: 100m
limits:
memory: 700Mi
sentinel:
requests:
memory: 200Mi
cpu: 100m
limits:
memory: 200Mi
## Node labels 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: {}
tolerations: []
## Redis image version
redis_image: quay.io/smile/redis:4.0.8r0
## replicas number for each component
replicas:
servers: 3
sentinels: 3
servers:
serviceType: ClusterIP # [ClusterIP|LoadBalancer]
annotations: {}
rbac:
# Specifies whether RBAC resources should be created
create: true
serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name:
## Configures redis with AUTH (requirepass & masterauth conf params)
auth: false
## Redis password
## Defaults to a random 10-character alphanumeric string if not set and auth is true
## ref: https://github.com/kubernetes/charts/blob/master/stable/redis-ha/templates/redis-auth-secret.yaml
##
## redisPassword:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
apiVersion: apps/v1beta1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "{{- printf "%s-%s" .name $.Release.Name | trunc 63 | trimSuffix "-" -}}"
......
......@@ -9,7 +9,9 @@ metadata:
heritage: "{{ .Release.Service }}"
spec:
type: {{ .Values.serviceType }}
{{- if ne .Values.serviceType "ClusterIP" }}
externalTrafficPolicy: {{ .Values.serviceExternalTrafficPolicy | quote }}
{{- end }}
ports:
- name: http
port: 80
......
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: longhorn
name: {{ .Release.Name }}
{{- if .Values.persistence.defaultClass }}
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
......
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: rancher-nfs
name: {{ .Release.Name }}
{{- if .Values.persistence.defaultClass }}
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
......@@ -11,4 +11,4 @@ metadata:
{{- end }}
labels:
kubernetes.io/cluster-service: "true"
provisioner: rancher.io/nfs
provisioner: rancher.io/{{ .Release.Name }}
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