Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tube-chart): Added helm chart for tube #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions helm/tube/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions helm/tube/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.2.6
digest: sha256:8d81dea9e85adbdff90d46721aa22b33c4cf66282432d20bbfb7335b77a73eef
generated: "2022-05-23T15:48:59.956941-05:00"
29 changes: 29 additions & 0 deletions helm/tube/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: tube
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 2022.05

dependencies:
- name: "postgresql"
repository: https://charts.bitnami.com/bitnami
version: 11.2.6
condition: postgres.enabled
Binary file added helm/tube/charts/postgresql-11.2.6.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions helm/tube/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .Chart.Name }} has been deployed successfully.
62 changes: 62 additions & 0 deletions helm/tube/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tube.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 "tube.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 "tube.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "tube.labels" -}}
helm.sh/chart: {{ include "tube.chart" . }}
{{ include "tube.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "tube.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tube.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "tube.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "tube.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
52 changes: 52 additions & 0 deletions helm/tube/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tube-deployment
labels:
{{- include "tube.labels" . | nindent 4 }}
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
{{- include "tube.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "tube.labels" . | nindent 8 }}
spec:
volumes:
{{- toYaml .Values.volumes | nindent 8 }}
containers:
- name: tube
image: "quay.io/cdis/tube:2021.12"
imagePullPolicy: Always
ports:
- containerPort: 80
resources:
{{- toYaml .Values.resources | nindent 12 }}
command: ["/bin/bash"]
args:
- "-c"
- |
python run_config.py
while true; do sleep 5; done
env:
{{- toYaml .Values.env | nindent 12 }}
volumeMounts:
{{- toYaml .Values.volumeMounts | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
6 changes: 6 additions & 0 deletions helm/tube/templates/etl-mapping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: etl-mapping
data:
etlMapping.yaml: {{ .Values.etl_mapping | default "None" }}
40 changes: 40 additions & 0 deletions helm/tube/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "tube.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "tube.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions helm/tube/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "tube.fullname" . }}-test-connection"
labels:
{{- include "tube.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "tube.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
90 changes: 90 additions & 0 deletions helm/tube/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tube-deployment
labels:
helm.sh/chart: tube-0.1.0
app.kubernetes.io/name: tube
app.kubernetes.io/instance: tube
app.kubernetes.io/version: "2021.12"
app.kubernetes.io/managed-by: Helm
spec:
selector:
matchLabels:
app.kubernetes.io/name: tube
app.kubernetes.io/instance: tube
template:
metadata:
labels:
app.kubernetes.io/name: tube
app.kubernetes.io/instance: tube
spec:
automountServiceAccountToken: false
volumes:
- name: creds-volume
secret:
secretName: "peregrine-creds"
- name: etl-mapping
configMap:
name: etl-mapping
- name: fence-yaml
configMap:
name: fence
containers:
- name: tube
imagePullPolicy: Always
GEN3_TUBE_IMAGE
ports:
- containerPort: 80
env:
- name: DICTIONARY_URL
valueFrom:
configMapKeyRef:
name: manifest-global
key: dictionary_url
- name: HADOOP_URL
value: hdfs://spark-service:9000
- name: ES_URL
value: esproxy-service
- name: HADOOP_HOST
value: spark-service
- name: HADOOP_CLIENT_OPTS
value: -Xmx1g
- name: SPARK_EXECUTOR_MEMORY
value: 4g
- name: SPARK_DRIVER_MEMORY
value: 6g
volumeMounts:
- name: "creds-volume"
readOnly: true
mountPath: "/gen3/tube/creds.json"
subPath: creds.json
- name: "etl-mapping"
readOnly: true
mountPath: "/gen3/tube/etlMapping.yaml"
subPath: "etlMapping.yaml"
- name: "fence-yaml"
mountPath: "/gen3/tube/user.yaml"
subPath: user.yaml
resources:
limits:
cpu: 1
memory: 12Gi
command: ["/bin/bash" ]
args:
- "-c"
- |
python run_config.py
while true; do sleep 5; done
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- tube
topologyKey: "kubernetes.io/hostname"
Loading