Skip to content

Commit

Permalink
use pvc for etcd volume (#1684)
Browse files Browse the repository at this point in the history
* use pvc for etcd volume

* make persistence using pvc disabled by default

* update readme with options for persisting embedded etcd data with pvc
  • Loading branch information
krancour authored and pmorie committed Feb 21, 2018
1 parent 7d155e5 commit 127561e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
4 changes: 4 additions & 0 deletions charts/catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ chart and their default values.
| `apiserver.storage.type` | The storage backend to use; the only valid value is `etcd`, left for other storages support in future, e.g. `crd` | `etcd` |
| `apiserver.storage.etcd.useEmbedded` | If storage type is `etcd`: Whether to embed an etcd container in the apiserver pod; THIS IS INADEQUATE FOR PRODUCTION USE! | `true` |
| `apiserver.storage.etcd.servers` | If storage type is `etcd`: etcd URL(s); override this if NOT using embedded etcd | `http://localhost:2379` |
| `apiserver.storage.etcd.persistence.enabled` | Enable persistence using PVC | `false` |
| `apiserver.storage.etcd.persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
| `apiserver.storage.etcd.persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
| `apiserver.storage.etcd.persistence.size` | PVC Storage Request | `4Gi` |
| `apiserver.verbosity` | Log level; valid values are in the range 0 - 10 | `10` |
| `apiserver.auth.enabled` | Enable authentication and authorization | `true` |
| `controllerManager.verbosity` | Log level; valid values are in the range 0 - 10 | `10` |
Expand Down
7 changes: 6 additions & 1 deletion charts/catalog/templates/apiserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ spec:
- key: requestheader-ca.crt
path: requestheader-ca.crt
{{- end }}
{{- if eq .Values.apiserver.storage.type "etcd" }}
{{- if and (eq .Values.apiserver.storage.type "etcd") .Values.apiserver.storage.etcd.useEmbedded }}
- name: etcd-data-dir
{{- if .Values.apiserver.storage.etcd.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.apiserver.storage.etcd.persistence.existingClaim | default (printf "%s-%s" (include "fullname" .) "etcd") }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions charts/catalog/templates/etcd-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if and (eq .Values.apiserver.storage.type "etcd") .Values.apiserver.storage.etcd.useEmbedded .Values.apiserver.storage.etcd.persistence.enabled (not .Values.apiserver.storage.etcd.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-etcd
labels:
app: {{ template "fullname" . }}-etcd
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.apiserver.storage.etcd.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.apiserver.storage.etcd.persistence.size | quote }}
{{- if .Values.apiserver.storage.etcd.persistence.storageClass }}
{{- if (eq "-" .Values.apiserver.storage.etcd.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.apiserver.storage.etcd.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ apiserver:
useEmbedded: true
# etcd URL(s); override this if NOT using embedded etcd
servers: http://localhost:2379
# etcd persistence options IF using embedded etcd
persistence:
enabled: false
## 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: "-"
accessMode: ReadWriteOnce
size: 4Gi
# Log level; valid values are in the range 0 - 10
verbosity: 10
auth:
Expand Down

0 comments on commit 127561e

Please sign in to comment.