diff --git a/charts/website/.helmignore b/charts/website/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/charts/website/.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/website/Chart.yaml b/charts/website/Chart.yaml new file mode 100644 index 0000000..666f411 --- /dev/null +++ b/charts/website/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +appVersion: "1.0" +description: MOLGENIS Helm chart for OpenCPU +name: molgenis-website +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-website/catalog-molgenis-website.svg +home: https://www.molgenis.org +maintainers: +- name: sidohaakma +- name: fdlk diff --git a/charts/website/README.md b/charts/website/README.md new file mode 100644 index 0000000..31f1ca4 --- /dev/null +++ b/charts/website/README.md @@ -0,0 +1,35 @@ +# 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: + +- NGINX + +## 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. + +- ```site.image.repository``` +- ```site.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/charts/website/questions.yml b/charts/website/questions.yml new file mode 100644 index 0000000..79f3462 --- /dev/null +++ b/charts/website/questions.yml @@ -0,0 +1,28 @@ + +categories: +- MOLGENIS +questions: +- variable: ingress.enabled + label: Enable ingress + default: false + description: "Enable ingress" + type: boolean + required: true + group: "Load balancing" +- 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/charts/website/templates/_helpers.tpl b/charts/website/templates/_helpers.tpl new file mode 100644 index 0000000..94b44a5 --- /dev/null +++ b/charts/website/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "website.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 "website.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 "website.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/website/templates/deployment.yaml b/charts/website/templates/deployment.yaml new file mode 100644 index 0000000..1e1a8f7 --- /dev/null +++ b/charts/website/templates/deployment.yaml @@ -0,0 +1,31 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "website.fullname" . }} + labels: + app: {{ template "website.name" . }} + chart: {{ template "website.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "website.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "website.name" . }} + release: {{ .Release.Name }} + spec: + containers: + {{- with .Values.website }} + - name: {{ .name }} + image: "{{ .image.repository }}/{{ .image.name }}:{{ .image.tag }}" + imagePullPolicy: {{ .image.pullPolicy }} + ports: + - containerPort: {{ .service.port }} + {{- end }} + + diff --git a/charts/website/templates/ingress.yaml b/charts/website/templates/ingress.yaml new file mode 100644 index 0000000..cb75be2 --- /dev/null +++ b/charts/website/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.website.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.website.service.name }} + servicePort: {{ $.Values.website.service.port }} +{{- if .tls }} + tls: + - hosts: + - {{ .name }} + secretName: {{ .tlsSecret }} +{{- end }} +--- +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/website/templates/service.yaml b/charts/website/templates/service.yaml new file mode 100644 index 0000000..8f09e82 --- /dev/null +++ b/charts/website/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.website.service.name }} + labels: + app: {{ .Values.website.service.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.website.service.type }} + ports: + - name: {{ .Values.website.service.name }} + port: {{ .Values.website.service.port }} + selector: + app: {{ template "website.name" . }} + release: {{ .Release.Name }} diff --git a/charts/website/values.yaml b/charts/website/values.yaml new file mode 100644 index 0000000..dba7b55 --- /dev/null +++ b/charts/website/values.yaml @@ -0,0 +1,37 @@ +# Default values for nexus. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +environment: production + +website: + name: molgenis-website + strategy: + type: Recreate + restartPolicy: Always + image: + repository: registry.molgenis.org + name: molgenis/website + tag: stable + pullPolicy: Always + service: + name: molgenis-website + type: ClusterIP + port: 80 + +ingress: + enabled: true + annotations: + kubernetes.io/ingress.class: nginx + path: / + hosts: + - name: site.dev.molgenis.org + tls: [] + +nodeSelector: {} + +tolerations: [] + +affinity: {}