Merge pull request #1072 from bitnami/etcdChartConf

[bitnami/etcd] Allow custom configuration via file or env vars
This commit is contained in:
Javier J. Salmerón-García
2019-03-04 12:35:23 +01:00
committed by GitHub
7 changed files with 69 additions and 120 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: etcd
version: 1.5.6
version: 2.0.0
appVersion: 3.3.12
description: etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines
keywords:
+33 -1
View File
@@ -58,7 +58,8 @@ The following tables lists the configurable parameters of the etcd chart and the
| `statefulset.rollingUpdatePartition` | Partition for Rolling Update strategy | `nil` |
| `statefulset.podManagementPolicy` | Pod management policy for the stateful set | `OrderedReady` |
| `statefulset.replicaCount` | Number of etcd nodes | `1` |
| `useConfigmap` | Switch to use the config map for etcd | `false` |
| `configFileConfigMap` | ConfigMap that contains a etcd.conf.yaml to be mounted | `nil` |
| `envVarsConfigMap` | ConfigMap that contains environment variables to be set in the container | `nil` |
| `allowNoneAuthentication` | Allow to use etcd without configuring RBAC authentication | `true` |
| `auth.rbac.enabled` | Switch to enable the etcd authentication. | `true` |
| `auth.rbac.rootPassword` | Password for the root user | `nil` |
@@ -125,6 +126,37 @@ $ helm install --name my-release -f values.yaml bitnami/etcd
> **Tip**: You can use the default [values.yaml](values.yaml)
### Using custom configuration
In order to use custom configuration parameters, two options are available:
- Using environment variables: etcd allows setting environment variables that map to configuration settings. In order to set extra environment variables, use the `envVarsConfigMap` value to point to a ConfigMap that contains them. Example:
```console
$ cat << EOF > /tmp/configurationEnvVars.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: etcd-env-vars
namespace: default
data:
ETCD_AUTO_COMPACTION_RETENTION: "0"
ETCD_HEARTBEAT_INTERVAL: "150"
EOF
$ kubectl create -f /tmp/configurationEnvVars.yaml
$ helm install bitnami/etcd --set envVarsConfigMap=etcd-env-vars
```
- Using a custom etcd.conf.yml: The etcd chart allows mounting a custom etcd.conf.yml file using the `configFileConfigMap` value. Example:
```console
$ kubectl create configmap etcd-conf --from-file=etcd.conf.yml
$ helm install bitnami/etcd --set configFileConfigMap=etcd-conf
```
## Production and horizontal scaling
The following repo contains the recommended production settings for etcd server in an alternative [values file](values-production.yaml). Please read carefully the comments in the values-production.yaml file to set up your environment.
+14
View File
@@ -95,3 +95,17 @@ Return the proper etcdctl authentication options
{{- printf "%s" $caOption -}}
{{- end -}}
{{- end -}}
{{/*
Return the etcd env vars ConfigMap name
*/}}
{{- define "etcd.envVarsCM" -}}
{{- printf "%s" .Values.envVarsConfigMap -}}
{{- end -}}
{{/*
Return the etcd env vars ConfigMap name
*/}}
{{- define "etcd.configFileCM" -}}
{{- printf "%s" .Values.configFileConfigMap -}}
{{- end -}}
-108
View File
@@ -1,108 +0,0 @@
{{- if .Values.useConfigmap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "etcd.fullname" . }}-configuration
labels:
app: "{{ template "etcd.name" . }}"
chart: {{ template "etcd.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
data:
etcd.conf.yml: |-
# This is the configuration file for the etcd server.
# Human-readable name for this member.
name: 'default'
# Path to the data directory.
data-dir:
# Path to the dedicated wal directory.
wal-dir:
# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000
# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100
# Time (in milliseconds) for an election to timeout.
election-timeout: 1000
# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0
# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://0.0.0.0:2380
# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://0.0.0.0:2379
# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5
# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5
# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:
# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://localhost:2380
# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://localhost:2379
# Discovery URL used to bootstrap the cluster.
discovery:
# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'
# HTTP proxy to use for traffic to discovery service.
discovery-proxy:
# DNS domain used to bootstrap initial cluster.
discovery-srv:
# Initial cluster configuration for bootstrapping.
initial-cluster:
# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'
# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'
# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false
# Accept etcd V2 client requests
enable-v2: true
# Enable runtime profiling data via HTTP server
enable-pprof: true
# Valid values include 'on', 'readonly', 'off'
proxy: 'off'
# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000
# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000
# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000
# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000
# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0
client-transport-security:
# Path to the client server TLS cert file.
cert-file:
# Path to the client server TLS key file.
key-file:
# Enable client cert authentication.
client-cert-auth: false
# Path to the client server TLS trusted CA cert file.
trusted-ca-file:
# Client TLS using generated certificates
auto-tls: false
peer-transport-security:
# Path to the peer server TLS cert file.
cert-file:
# Path to the peer server TLS key file.
key-file:
# Enable peer client cert authentication.
peer-client-cert-auth: false
# Path to the peer server TLS trusted CA cert file.
trusted-ca-file:
# Peer TLS using generated certificates.
auto-tls: false
# Enable debug-level logging for etcd.
debug: false
logger: zap
# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-outputs: [stderr]
# Force to create a new one member cluster.
force-new-cluster: false
auto-compaction-mode: periodic
auto-compaction-retention: "1"
{{- end -}}
+9 -4
View File
@@ -138,13 +138,18 @@ spec:
fi
fi
{{- if .Values.useConfigmap }}
{{- if .Values.configFileConfigMap }}
exec /opt/bitnami/etcd/bin/etcd --config-file /opt/bitnami/etcd/conf/etcd.conf.yml
{{ else }}
exec /opt/bitnami/etcd/bin/etcd
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.envVarsConfigMap }}
envFrom:
- configMapRef:
name: {{ template "etcd.envVarsCM" . }}
{{- end }}
env:
{{- if .Values.image.debug }}
- name: BASH_DEBUG
@@ -284,7 +289,7 @@ spec:
- name: data
mountPath: /bitnami/etcd
{{ end }}
{{ if .Values.useConfigmap }}
{{ if .Values.configFileConfigMap }}
- name: etcd-config
mountPath: /opt/bitnami/etcd/conf/
{{ end }}
@@ -299,10 +304,10 @@ spec:
readOnly: true
{{ end }}
volumes:
{{ if .Values.useConfigmap }}
{{ if .Values.configFileConfigMap }}
- name: etcd-config
configMap:
name: {{ template "etcd.fullname" . }}-configuration
name: {{ template "etcd.configFileCM" . }}
{{ end }}
{{ if or .Values.auth.client.enableAuthentication (and .Values.auth.client.secureTransport (not .Values.auth.client.useAutoTLS ) ) }}
- name: etcd-client-certs
+6 -3
View File
@@ -46,10 +46,13 @@ statefulset:
##
replicaCount: 3
## Take into account that if you use a config map you need to provide the whole configuration
## as the env vars defined in the statefulset.yaml will not be applied
## ConfigMap that includes the etcd.conf.yml file
##
useConfigmap: false
# configFileConfigMap:
## ConfigMap that includes extra environment variables
##
# envVarsConfigMap:
## etcd docker image available customizations
## https://github.com/bitnami/bitnami-docker-etcd#configuration
+6 -3
View File
@@ -46,10 +46,13 @@ statefulset:
##
replicaCount: 1
## Take into account that if you use a config map you need to provide the whole configuration
## as the env vars defined in the statefulset.yaml will not be applied
## ConfigMap that includes the etcd.conf.yml file
##
useConfigmap: false
# configFileConfigMap:
## ConfigMap that includes extra environment variables
##
# envVarsConfigMap:
## etcd docker image available customizations
## https://github.com/bitnami/bitnami-docker-etcd#configuration