From 653d1db12467a9eb1d01858a8037d87adbdccf9d Mon Sep 17 00:00:00 2001 From: sido Date: Tue, 6 Nov 2018 06:42:18 +0100 Subject: [PATCH] added rstudio --- charts/molgenis-rstudio/.helmignore | 21 ++++ charts/molgenis-rstudio/Chart.yaml | 12 ++ charts/molgenis-rstudio/README.md | 37 +++++++ charts/molgenis-rstudio/questions.yml | 31 ++++++ .../molgenis-rstudio/templates/_helpers.tpl | 32 ++++++ .../templates/deployment.yaml | 35 ++++++ .../molgenis-rstudio/templates/ingress.yaml | 44 ++++++++ .../molgenis-rstudio/templates/service.yaml | 20 ++++ charts/molgenis-rstudio/values.yaml | 40 +++++++ charts/opal/Chart.yaml | 2 +- charts/opal/questions.yml | 104 +----------------- charts/opal/templates/deployment.yaml | 16 +-- charts/opal/templates/ingress.yaml | 14 +-- .../opal/templates/persistence/mysql-pvc.yaml | 8 +- .../opal/templates/persistence/opal-pvc.yaml | 8 +- charts/opal/values.yaml | 68 +++--------- 16 files changed, 300 insertions(+), 192 deletions(-) create mode 100644 charts/molgenis-rstudio/.helmignore create mode 100644 charts/molgenis-rstudio/Chart.yaml create mode 100644 charts/molgenis-rstudio/README.md create mode 100644 charts/molgenis-rstudio/questions.yml create mode 100644 charts/molgenis-rstudio/templates/_helpers.tpl create mode 100644 charts/molgenis-rstudio/templates/deployment.yaml create mode 100644 charts/molgenis-rstudio/templates/ingress.yaml create mode 100644 charts/molgenis-rstudio/templates/service.yaml create mode 100644 charts/molgenis-rstudio/values.yaml diff --git a/charts/molgenis-rstudio/.helmignore b/charts/molgenis-rstudio/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/charts/molgenis-rstudio/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/charts/molgenis-rstudio/Chart.yaml b/charts/molgenis-rstudio/Chart.yaml new file mode 100644 index 0000000..b46e651 --- /dev/null +++ b/charts/molgenis-rstudio/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +appVersion: "1.0" +description: RStudio stack for MOLGENIS +name: molgenis-rstudio +version: 0.0.1 +sources: +- https://github.com/molgenis/molgenis-ops-docker-helm.git +icon: https://raw.githubusercontent.com/molgenis/molgenis-ops-docker-helm/master/charts/molgenis-opencpu/catalog-molgenis-rstudio.svg +home: https://www.rocker.org +maintainers: +- name: sidohaakma +- name: fdlk diff --git a/charts/molgenis-rstudio/README.md b/charts/molgenis-rstudio/README.md new file mode 100644 index 0000000..f03a78d --- /dev/null +++ b/charts/molgenis-rstudio/README.md @@ -0,0 +1,37 @@ +# MOLGENIS - RStudio Helm Chart + +An RStudio instance to support DataSHIELD users in setting up a central analysis server instance. + +## Containers + +This chart will deploy the following container: + +- molgenis-rstudio (with DataSHIELD packages) + +## Provisioning +You can choose for the RStudio image from which repository you want to pull. Experimental builds are pushed to registry.molgenis.org and the stable builds to hub.docker.com. +You need to fill out 2 properties to determine which repository you are going to use. + +- ```rstudio.image.repository``` +- ```rstudio.image.tag``` + +You can do this in the questions in Rancher or in the ```values.yaml```. + +## Development +You can test in install the chart by executing: + +```helm lint .``` + +To test if your helm chart-syntax is right and: + +```helm install . --dry-run --debug``` + +To test if your hem chart works and: + +```helm install .``` + +To deploy it on the cluster. + +```curl -L -u xxxx:xxxx http://registry.molgenis.org/repository/helm/ --upload-file molgenis-x.x.x.tgz``` + +To push it to the registry \ No newline at end of file diff --git a/charts/molgenis-rstudio/questions.yml b/charts/molgenis-rstudio/questions.yml new file mode 100644 index 0000000..6190e89 --- /dev/null +++ b/charts/molgenis-rstudio/questions.yml @@ -0,0 +1,31 @@ + +categories: +- MOLGENIS +questions: +- variable: rstudio.environment + label: Environment + default: development + type: enum + options: + - development + - test + - acceptence + - production + group: "Provisioning" +- variable: rstudio.image.repository + label: Registry + default: "registry.hub.docker.com" + description: "Select a registry to pull from" + type: enum + options: + - "registry.hub.docker.com" + - "registry.molgenis.org" + required: true + group: "Provisioning" +- variable: rstudio.image.tag + label: Version + default: "" + description: "Select a RStudio version (check the registry.molgenis.org or hub.docker.com for released tags)" + type: string + required: true + group: "Provisioning" \ No newline at end of file diff --git a/charts/molgenis-rstudio/templates/_helpers.tpl b/charts/molgenis-rstudio/templates/_helpers.tpl new file mode 100644 index 0000000..99f6c10 --- /dev/null +++ b/charts/molgenis-rstudio/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "rstudio.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). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "rstudio.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "rstudio.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/molgenis-rstudio/templates/deployment.yaml b/charts/molgenis-rstudio/templates/deployment.yaml new file mode 100644 index 0000000..04e59d4 --- /dev/null +++ b/charts/molgenis-rstudio/templates/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + {{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} + {{- end }} + name: {{ template "rstudio.fullname" . }} + labels: + app: {{ template "rstudio.name" . }} + chart: {{ template "rstudio.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "rstudio.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "rstudio.name" . }} + release: {{ .Release.Name }} + spec: + containers: + {{- with .Values.rstudio }} + - name: {{ .name }} + image: "{{ .image.repository }}/{{ .image.name }}:{{ .image.tag }}" + imagePullPolicy: {{ .image.pullPolicy }} + ports: + - containerPort: {{ .service.port }} + {{- end }} + + diff --git a/charts/molgenis-rstudio/templates/ingress.yaml b/charts/molgenis-rstudio/templates/ingress.yaml new file mode 100644 index 0000000..891ba50 --- /dev/null +++ b/charts/molgenis-rstudio/templates/ingress.yaml @@ -0,0 +1,44 @@ +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: "{{ $.Release.Name }}-ingress" + labels: + app: {{ $.Values.rstudio.name }} + chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" + release: "{{ $.Release.Name }}" + heritage: "{{ $.Release.Service }}" + annotations: + {{- if .tls }} + ingress.kubernetes.io/secure-backends: "true" + {{- end }} + {{- range $key, $value := .annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- if .Values.environment -eq "development" }} + - host: "analysis.dev.molgenis.org" + {{- else if .Values.environment -eq "test" }} + - host: "analysis.test.molgenis.org" + {{- else if .Values.environment -eq "acceptance" }} + - host: "analysis.accept.molgenis.org" + {{- else }} + - host: "analysis.molgenis.org" + {{- end }} + http: + paths: + - path: {{ default "/" .path }} + backend: + serviceName: {{ $.Values.rstudio.service.name }} + servicePort: {{ $.Values.rstudio.service.port }} +{{- if .tls }} + tls: + - hosts: + - {{ .name }} + secretName: {{ .tlsSecret }} +{{- end }} +--- +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/molgenis-rstudio/templates/service.yaml b/charts/molgenis-rstudio/templates/service.yaml new file mode 100644 index 0000000..96c3e66 --- /dev/null +++ b/charts/molgenis-rstudio/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.rstudio.service.name }} + labels: + app: {{ .Values.rstudio.service.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.rstudio.service.type }} + loadBalancerSourceRanges: + {{- range $index, $rule := .Values.rstudio.service.firewall }} + - {{ $rule }} + {{- end }} + ports: + - name: {{ .Values.rstudio.service.name }} + port: {{ .Values.rstudio.service.port }} + selector: + app: {{ template "rstudio.name" . }} + release: {{ .Release.Name }} diff --git a/charts/molgenis-rstudio/values.yaml b/charts/molgenis-rstudio/values.yaml new file mode 100644 index 0000000..f1bab92 --- /dev/null +++ b/charts/molgenis-rstudio/values.yaml @@ -0,0 +1,40 @@ +# Default values for nexus. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +environment: production + +rstudio: + environment: development + name: rstudio + strategy: + type: Recreate + restartPolicy: Always + image: + repository: registry.hub.docker.com + name: molgenis/rstudio + tag: stable + pullPolicy: Always + service: + name: rstudio + type: LoadBalancer + port: 8787 + +ingress: + enabled: true + annotations: { + kubernetes.io/ingress.class: "nginx", + nginx.ingress.kubernetes.io/proxy-body-size: "0" + } + path: / + hosts: + - name: analysis.molgenis.org + tls: [] + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/opal/Chart.yaml b/charts/opal/Chart.yaml index b432016..ae8eaa7 100644 --- a/charts/opal/Chart.yaml +++ b/charts/opal/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "1.0" description: Opal - helm stack (in BETA) name: opal -version: 0.5.4 +version: 0.0.1 sources: - https://git.webhosting.rug.nl/opal/opal-ops-docker-helm.git icon: https://git.webhosting.rug.nl/opal/opal-ops-docker-helm/ diff --git a/charts/opal/questions.yml b/charts/opal/questions.yml index 153fe02..bd1513e 100644 --- a/charts/opal/questions.yml +++ b/charts/opal/questions.yml @@ -32,106 +32,4 @@ questions: type: string required: true group: "Provisioning" -- variable: molgenis.adminPassword - label: Administrator password - default: "" - description: "Enter an administrator password" - type: password - required: true - group: "Provisioning" -- variable: service.firewall.enabled - label: Firewall enabled - default: false - description: "Firewall enabled (can be cluster or UMCG scoped)" - type: boolean - required: true - group: "Services" - show_subquestion_if: true - subquestions: - - variable: service.firewall.kind - default: "umcg" - description: "Firewall kind. This can be 'umcg' or 'cluster' environment" - type: enum - required: true - options: - - umcg - - cluster - label: Firewall kind -- variable: molgenis.advanced - label: Advanced mode - default: false - description: "Do you want to override the default values in advanced mode" - type: boolean - required: true - group: "Advanced" - show_subquestion_if: true - subquestions: - - variable: molgenis.image.repository - label: Registry - default: "registry.hub.docker.com" - description: "Select a registry to pull from" - type: enum - options: - - "registry.hub.docker.com" - - "registry.molgenis.org" - required: true - group: "Provisioning" - - variable: molgenis.services.opencpu.host - label: OpenCPU cluster - default: "molgenis-opencpu.opencpu" - description: "Specify the OpenCPU cluster" - type: string - required: true - group: "Services" - - variable: molgenis.services.postgres.embedded - label: Postgres embedded - default: true - description: "Do you want an embedded postgres" - type: boolean - required: true - group: "Services" - - variable: molgenis.services.postgres.host - label: Postgres cluster location - default: "localhost" - description: "Set the location of the postgres cluster. This can be localhost when the postgres is enabled else you need to specify a cluster location if you do not want a embedded postgres instance)" - type: string - required: true - group: "Services" - - variable: molgenis.services.postgres.scheme - label: Database scheme - default: "molgenis" - description: "Set the database scheme" - type: string - required: true - group: "Services" - - variable: molgenis.services.postgres.user - label: Database username - default: "molgenis" - description: "Set user of the database scheme" - type: string - required: true - group: "Services" - - variable: molgenis.services.postgres.password - label: Database password - default: "molgenis" - description: "Set the password of the database scheme" - type: string - required: true - group: "Services" - - variable: persistence.retain - default: false - description: "Do you want to retain the persistent volume" - type: boolean - label: Retain volume - group: "Persistence" - - variable: persistence.molgenis.size - default: "default" - description: "Size of MOLGENIS filestore (PostgreSQL and ElasticSearch excluded)" - type: enum - options: - - "default" - - "5Gi" - - "10Gi" - - "30Gi" - label: Size MOLGENIS filestore - group: "Persistence" + diff --git a/charts/opal/templates/deployment.yaml b/charts/opal/templates/deployment.yaml index fe7db1f..9db3e98 100644 --- a/charts/opal/templates/deployment.yaml +++ b/charts/opal/templates/deployment.yaml @@ -42,13 +42,7 @@ spec: - name: admin.password value: "{{ .adminPassword }}" - name: CATALINA_OPTS - {{- if eq .type.kind "small" }} - value: "-Xmx{{ .type.small.javaOpts.maxHeapSpace }} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" - {{- else if eq .type.kind "medium"}} - value: "-Xmx{{ .type.medium.javaOpts.maxHeapSpace }} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" - {{- else }} - value: "-Xmx{{ .type.large.javaOpts.maxHeapSpace }} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" - {{- end }} + value: "-Xmx{{ .javaOpts.maxHeapSpace }} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" ports: - containerPort: 8080 {{- if $.Values.persistence.enabled }} @@ -73,13 +67,7 @@ spec: failureThreshold: 3 successThreshold: 1 resources: - {{- if eq .type.kind "small" }} -{{ toYaml .type.small.resources | indent 12 }} - {{- else if eq .type.kind "medium" }} -{{ toYaml .type.medium.resources | indent 12 }} - {{- else }} -{{ toYaml .type.large.resources | indent 12 }} - {{- end }} +{{ toYaml .resources | indent 12 }} {{- end }} {{- if .Values.persistence.enabled }} diff --git a/charts/opal/templates/ingress.yaml b/charts/opal/templates/ingress.yaml index 82b3519..de94600 100644 --- a/charts/opal/templates/ingress.yaml +++ b/charts/opal/templates/ingress.yaml @@ -26,19 +26,15 @@ spec: {{- end }} {{- end }} rules: - {{- if eq $.Values.opal.environment "development" }} - - host: {{ .Release.Name }}.dev.opal.org - {{- else if eq $.Values.opal.environment "test" }} - - host: {{ .Release.Name }}.test.opal.org - {{- else if eq $.Values.opal.environment "acceptance" }} - - host: {{ .Release.Name }}.accept.opal.org - {{- else }} - - host: {{ .Release.Name }}.opal.org - {{- end }} + {{- if .Values.ingress.hosts }} + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} http: paths: - path: {{ $ingressPath }} backend: serviceName: {{ $fullName }} servicePort: {{ $.Values.service.port }} + {{- end }} + {{- end }} {{- end }} diff --git a/charts/opal/templates/persistence/mysql-pvc.yaml b/charts/opal/templates/persistence/mysql-pvc.yaml index d02a99d..61ba8e9 100644 --- a/charts/opal/templates/persistence/mysql-pvc.yaml +++ b/charts/opal/templates/persistence/mysql-pvc.yaml @@ -15,11 +15,5 @@ spec: - ReadWriteMany resources: requests: - {{- if eq .Values.opal.type.kind "small" }} - storage: {{ .Values.mysql.type.small.persistence.size }} - {{- else if eq .Values.opal.type.kind "medium" }} - storage: {{ .Values.mysql.type.medium.persistence.size }} - {{- else }} - storage: {{ .Values.mysql.type.large.persistence.size }} - {{- end }} + storage: {{ .Values.mysql.persistence.size }} {{- end }} \ No newline at end of file diff --git a/charts/opal/templates/persistence/opal-pvc.yaml b/charts/opal/templates/persistence/opal-pvc.yaml index 72a0c6b..a19a44e 100644 --- a/charts/opal/templates/persistence/opal-pvc.yaml +++ b/charts/opal/templates/persistence/opal-pvc.yaml @@ -15,11 +15,5 @@ spec: - ReadWriteMany resources: requests: - {{- if eq .Values.opal.type.kind "small" }} - storage: {{ .Values.opal.type.small.persistence.size }} - {{- else if eq .Values.opal.type.kind "medium" }} - storage: {{ .Values.opal.type.medium.persistence.size }} - {{- else }} - storage: {{ .Values.opal.type.large.persistence.size }} - {{- end }} + storage: {{ .Values.opal.persistence.size }} {{- end }} \ No newline at end of file diff --git a/charts/opal/values.yaml b/charts/opal/values.yaml index 1f1228a..43bdb90 100644 --- a/charts/opal/values.yaml +++ b/charts/opal/values.yaml @@ -4,68 +4,30 @@ replicaCount: 1 service: type: LoadBalancer - firewall: - enabled: false - kind: "umcg" - umcg: - rules: - - 127.0.0.1/32 - cluster: - rules: - - 127.0.0.1/32 port: 8080 ingress: enabled: true annotations: nginx.ingress.kubernetes.io/proxy-body-size: "0" - # This will be used again when external domains need be attached to the instance - # hosts: - # - name: test + hosts: + - name: opal.dev.molgenis.org path: / tls: [] opal: advanced: false - type: - kind: medium - small: - javaOpts: - maxHeapSpace: "2g" - resources: - limits: - cpu: 2 - memory: 2Gi - requests: - cpu: 200m - memory: 2Gi - persistence: - size: 5Gi - medium: - javaOpts: - maxHeapSpace: "3g" - resources: - limits: - cpu: 3 - memory: 3Gi - requests: - cpu: 200m - memory: 3Gi - persistence: - size: 10Gi - large: - javaOpts: - maxHeapSpace: "4g" - resources: - limits: - cpu: 4 - memory: 4Gi - requests: - cpu: 200m - memory: 4Gi - persistence: - size: 30Gi - environment: test + javaOpts: + maxHeapSpace: "4g" + resources: + limits: + cpu: 4 + memory: 4Gi + requests: + cpu: 200m + memory: 4Gi + persistence: + size: 10Gi image: repository: registry.hub.docker.com name: obiba/opal @@ -86,6 +48,10 @@ rserver: tag: latest pullPolicy: IfNotPresent +mysql: + persistence: + size: 10Gi + persistence: enabled: true retain: false