diff --git a/molgenis-opencpu/.helmignore b/molgenis-opencpu/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/molgenis-opencpu/.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/molgenis-opencpu/Chart.yaml b/molgenis-opencpu/Chart.yaml new file mode 100644 index 0000000..0ffe477 --- /dev/null +++ b/molgenis-opencpu/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +appVersion: "1.0" +description: Opencpu stack for MOLGENIS +name: molgenis-opencpu +version: 0.1.1 +sources: +- https://git.webhosting.rug.nl/molgenis/molgenis-ops-docker-helm.git +icon: https://git.webhosting.rug.nl/molgenis/molgenis-ops-docker-helm/raw/master/molgenis-opencpu/catalogIcon-molgenis-opencpu.svg \ No newline at end of file diff --git a/molgenis-opencpu/README.md b/molgenis-opencpu/README.md new file mode 100644 index 0000000..e871170 --- /dev/null +++ b/molgenis-opencpu/README.md @@ -0,0 +1,38 @@ +# MOLGENIS - OpenCPU Helm Chart + +NEXUS repository for kubernetes to deploy on a kubernetes cluster with NFS-share + +## Containers + +This chart will deploy the following containers: + +- OpenCPU +- MOLGENIS-httpd (to proxy the registry and docker to one domain) + +## Provisioning +You can choose for the OpenCPU 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. + +- ```opencpu.image.repository``` +- ```opencpu.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. + + diff --git a/molgenis-opencpu/catalog-molgenis-opencpu.svg b/molgenis-opencpu/catalog-molgenis-opencpu.svg new file mode 100644 index 0000000..fc9ca38 --- /dev/null +++ b/molgenis-opencpu/catalog-molgenis-opencpu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/molgenis-opencpu/questions.yml b/molgenis-opencpu/questions.yml new file mode 100644 index 0000000..fba8a05 --- /dev/null +++ b/molgenis-opencpu/questions.yml @@ -0,0 +1,21 @@ + +categories: +- MOLGENIS +questions: +- variable: opencpu.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: opencpu.image.tag + label: Version + default: "" + description: "Select a OpenCPU 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/molgenis-opencpu/templates/_helpers.tpl b/molgenis-opencpu/templates/_helpers.tpl new file mode 100644 index 0000000..a410c46 --- /dev/null +++ b/molgenis-opencpu/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "opencpu.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 "opencpu.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 "opencpu.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/molgenis-opencpu/templates/deployment.yaml b/molgenis-opencpu/templates/deployment.yaml new file mode 100644 index 0000000..ddb57c7 --- /dev/null +++ b/molgenis-opencpu/templates/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + {{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} + {{- end }} + name: {{ template "opencpu.fullname" . }} + labels: + app: {{ template "opencpu.name" . }} + chart: {{ template "opencpu.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "opencpu.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "opencpu.name" . }} + release: {{ .Release.Name }} + spec: + containers: + {{- with .Values.opencpu }} + - name: {{ .name }} + image: "{{ .image.repository }}/{{ .image.name }}:{{ .image.tag }}" + imagePullPolicy: {{ .image.pullPolicy }} + ports: + - containerPort: {{ .service.port }} + {{- end }} + + diff --git a/molgenis-opencpu/templates/ingress.yaml b/molgenis-opencpu/templates/ingress.yaml new file mode 100644 index 0000000..d218231 --- /dev/null +++ b/molgenis-opencpu/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: "{{ $.Release.Name }}-ingress" + labels: + app: {{ $.Values.opencpu.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: + - host: {{ .name }} + http: + paths: + - path: {{ default "/" .path }} + backend: + serviceName: {{ $.Values.opencpu.service.name }} + servicePort: {{ $.Values.opencpu.service.port }} +{{- if .tls }} + tls: + - hosts: + - {{ .name }} + secretName: {{ .tlsSecret }} +{{- end }} +--- +{{- end }} +{{- end }} \ No newline at end of file diff --git a/molgenis-opencpu/templates/service.yaml b/molgenis-opencpu/templates/service.yaml new file mode 100644 index 0000000..4b1cf1e --- /dev/null +++ b/molgenis-opencpu/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.opencpu.service.name }} + labels: + app: {{ .Values.opencpu.service.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.opencpu.service.type }} + loadBalancerSourceRanges: + {{- range $index, $rule := .Values.opencpu.service.firewall }} + - {{ $rule }} + {{- end }} + ports: + - name: {{ .Values.opencpu.service.name }} + port: {{ .Values.opencpu.service.port }} + selector: + app: {{ template "opencpu.name" . }} + release: {{ .Release.Name }} diff --git a/molgenis-opencpu/values.yaml b/molgenis-opencpu/values.yaml new file mode 100644 index 0000000..227de88 --- /dev/null +++ b/molgenis-opencpu/values.yaml @@ -0,0 +1,41 @@ +# Default values for nexus. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +environment: production + +opencpu: + name: opencpu + strategy: + type: Recreate + restartPolicy: Always + image: + repository: registry.hub.docker.com + name: molgenis/opencpu + tag: stable + pullPolicy: Always + service: + name: opencpu + type: LoadBalancer + port: 8004 + firewall: + - 145.100.224.1/24 + +ingress: + enabled: true + annotations: { + kubernetes.io/ingress.class: "nginx", + nginx.ingress.kubernetes.io/proxy-body-size: "0" + } + path: / + hosts: + - name: opencpu.molgenis.org + tls: [] + +nodeSelector: {} + +tolerations: [] + +affinity: {}