From d17c137dd59cbe3cc0d2e5da2bdad772fbe92978 Mon Sep 17 00:00:00 2001 From: sido Date: Wed, 12 Sep 2018 08:04:59 +0200 Subject: [PATCH] added elasticsearch persistence --- molgenis/README.md | 22 +++++++++++++--- molgenis/questions.yml | 26 ++++++++++++------- molgenis/templates/deployment.yaml | 16 +++++++++--- .../persistence/elasticsearchPVC.yaml | 20 ++++++++++++++ .../templates/persistence/molgenisPVC.yaml | 9 +++---- molgenis/values.yaml | 13 +++++++--- 6 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 molgenis/templates/persistence/elasticsearchPVC.yaml diff --git a/molgenis/README.md b/molgenis/README.md index 2f56de4..03e8b2e 100644 --- a/molgenis/README.md +++ b/molgenis/README.md @@ -80,13 +80,27 @@ Specify memory usage for Java JVM: Select the resources you need dependant on the customer you need to serve. ## Persistence -You can define your own volume by enabling persistence on your MOLGENIS instance. You can also choose to retain the volume of the NFS and specify the size of the volume. -The following properties will setup the persistence for you. +You can enable persistence on your MOLGENIS stack by specifying the following property. -- ```molgenis.persistence.enabled``` -- ```molgenis.persistence.retain``` +- ```persistence.enabled``` + +You can also choose to retain the volume of the NFS. +- ```persistence.retain``` + +The size and claim name can be specified per service. There are now two services that can be persist. + +- MOLGENIS +- ElasticSearch + +MOLGENIS persistent properties. +- ```molgenis.persistence.claim``` - ```molgenis.persistence.size``` +ElasticSearch persistent properties. +- ```elasticsearch.persistence.claim``` +- ```elasticsearch.persistence.size``` + + ### Resolve you persistent volume You do not know which volume is attached to your MOLGENIS instance. You can resolve this by executing: diff --git a/molgenis/questions.yml b/molgenis/questions.yml index f9309cf..1dca426 100644 --- a/molgenis/questions.yml +++ b/molgenis/questions.yml @@ -97,7 +97,7 @@ questions: - "1g" - "2g" group: "Resources" -- variable: molgenis.persistence.enabled +- variable: persistence.enabled default: false description: "Do you want to use persistence" type: boolean @@ -106,18 +106,26 @@ questions: label: Persistence show_subquestion_if: true subquestions: + - variable: persistence.retain + default: false + description: "Do you want to retain the persistent volume" + type: boolean + label: Retain volume - variable: molgenis.persistence.size + default: "30Gi" + description: "Size of MOLGENIS filestore" + type: enum + options: + - "30Gi" + - "50Gi" + - "100Gi" + label: Size filestore + - variable: elasticsearch.persistence.size default: "50Gi" - description: "Size of MOLGENIS filestore (not the database size)" + description: "Size of ElasticSearch data" type: enum options: - "50Gi" - "100Gi" - "200Gi" - - "300Gi" - label: Size filestore - - variable: molgenis.persistence.retain - default: false - description: "Do you want to retain the persistence volume" - type: boolean - label: Retain volume \ No newline at end of file + label: Size for ElasticSearch data \ No newline at end of file diff --git a/molgenis/templates/deployment.yaml b/molgenis/templates/deployment.yaml index 5ecf512..c14d714 100644 --- a/molgenis/templates/deployment.yaml +++ b/molgenis/templates/deployment.yaml @@ -49,7 +49,7 @@ spec: value: "-Xmx{{ .javaOpts.maxHeapSpace }} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" ports: - containerPort: 8080 - {{- if .persistence.enabled }} + {{- if $.Values.persistence.enabled }} volumeMounts: - name: molgenis-nfs mountPath: /home/molgenis @@ -92,15 +92,25 @@ spec: ports: - containerPort: 9200 - containerPort: 9300 + {{- if $.Values.persistence.enabled }} + volumeMounts: + - name: elastic-nfs + mountPath: /usr/share/elasticsearch/data + {{- end }} + resources: {{ toYaml .resources | indent 12 }} {{- end }} -{{- if .Values.molgenis.persistence.enabled }} +{{- if .Values.persistence.enabled }} volumes: - name: molgenis-nfs persistentVolumeClaim: - claimName: {{ .Values.molgenis.persistence.name }} + claimName: {{ .Values.molgenis.persistence.claim }} + volumes: + - name: elasticsearch-nfs + persistentVolumeClaim: + claimName: {{ .Values.elasticsearch.persistence.claim }} {{- end }} {{- with .Values.nodeSelector }} diff --git a/molgenis/templates/persistence/elasticsearchPVC.yaml b/molgenis/templates/persistence/elasticsearchPVC.yaml new file mode 100644 index 0000000..54103b8 --- /dev/null +++ b/molgenis/templates/persistence/elasticsearchPVC.yaml @@ -0,0 +1,20 @@ +{{- if .Values.persistence.enabled -}} +apiVersion: extensions/v1beta1 +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ .Values.elasticsearch.persistence.claim }} + annotations: + {{- if .Values.persistence.retain }} + volume.beta.kubernetes.io/storage-class: "nfs-provisioner-retain" + {{- else }} + volume.beta.kubernetes.io/storage-class: "nfs-provisioner" + {{- end }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.elasticsearch.persistence.size }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/molgenis/templates/persistence/molgenisPVC.yaml b/molgenis/templates/persistence/molgenisPVC.yaml index 1335adb..9968273 100644 --- a/molgenis/templates/persistence/molgenisPVC.yaml +++ b/molgenis/templates/persistence/molgenisPVC.yaml @@ -1,12 +1,11 @@ -{{- with .Values.molgenis.persistence }} -{{- if .enabled -}} +{{- if .Values.persistence.enabled -}} apiVersion: extensions/v1beta1 kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ .name }} + name: {{ .Values.molgenis.persistence.claim }} annotations: - {{- if .retain }} + {{- if .Values.persistence.retain }} volume.beta.kubernetes.io/storage-class: "nfs-provisioner-retain" {{- else }} volume.beta.kubernetes.io/storage-class: "nfs-provisioner" @@ -16,6 +15,6 @@ spec: - ReadWriteMany resources: requests: - storage: {{ .size }} + storage: {{ .Values.molgenis.persistence.size }} {{- end }} {{- end }} \ No newline at end of file diff --git a/molgenis/values.yaml b/molgenis/values.yaml index aa0b197..44b9f27 100644 --- a/molgenis/values.yaml +++ b/molgenis/values.yaml @@ -32,10 +32,8 @@ molgenis: cpu: 200m memory: 1250Mi persistence: - enabled: false - retain: false - name: molgenis-nfs-claim - size: 50Gi + claim: molgenis-nfs-claim + size: 30Gi services: opencpu: host: localhost @@ -62,6 +60,13 @@ elasticsearch: requests: cpu: 100m memory: 1Gi + persistence: + claim: elasticsearch-nfs-claim + size: 50Gi + +persistence: + enabled: false + retain: false nodeSelector: { deployPod: "true"