Skip to content

Commit

Permalink
Hail Search Service helm charts. (#19)
Browse files Browse the repository at this point in the history
* add hail-search template

* add volumne

* mostly there

* add some delays

* failure thresholds

* add config

* cleanup

* ws

* Update values.yaml

* Update values.yaml

* use env vars

* use env vars

* undo env tpl

* ws

* missing quote

* initContainers args

* change to 5000

* use service port

* update

* Update values.yaml

* remove non-public values

* complete brain fart

* Check for new samples upon chart install. (#22)

* hail search re-deploy job

* ws

* rename annotation

* rename

* ws

* use globals

* add imagePullSecrets

* add imagePullSecrets

* rename global

* dash does not work

* skip if empty string provided
  • Loading branch information
bpblanken authored Oct 5, 2023
1 parent 518f559 commit 54d7190
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/hail-search/.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/
27 changes: 27 additions & 0 deletions charts/hail-search/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: hail-search
description: A Helm chart for deploying the hail backend of Seqr, an open source software platform for rare disease genomics
sources:
- https://github.com/broadinstitute/seqr
- https://github.com/broadinstitute/seqr-helm

# 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.
# It is recommended to use it with quotes.
appVersion: "ee4afa08ee1190ac05ef06543adcb1833f5e2e8e"
51 changes: 51 additions & 0 deletions charts/hail-search/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "hail-search.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 "hail-search.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 "hail-search.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "hail-search.selectorLabels" -}}
app.kubernetes.io/name: {{ include "hail-search.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
74 changes: 74 additions & 0 deletions charts/hail-search/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hail-search.fullname" . }}
labels:
{{- include "hail-search.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "hail-search.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/datasetVersions: {{ print $.Values.datasetVersions | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "hail-search.selectorLabels" . | nindent 8 }}
spec:
volumes:
- name: datasets
emptyDir:
# Default sizeLimit is 1/2 the total RAM of the Node.
medium: "Memory"
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
containers:
- name: {{ include "hail-search.fullname" . }}-pod
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "hail-search.fullname" . }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
initialDelaySeconds: 10
periodSeconds: 30
failureThreshold: 5
httpGet:
path: /status
port: http
readinessProbe:
initialDelaySeconds: 10
periodSeconds: 30
failureThreshold: 5
httpGet:
path: /status
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: {{ .Values.environment.DATASETS_DIR }}
name: datasets
restartPolicy: Always
dnsPolicy: ClusterFirst
{{- with .Values.initContainers}}
initContainers:
{{- tpl . $ | trim | nindent 8}}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- tpl . $ | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/hail-search/templates/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hail-search.fullname" . }}
labels:
{{- include "hail-search.labels" . | nindent 4 }}
data:
{{- with .Values.environment }}
{{- toYaml . | nindent 2 }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/hail-search/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "hail-search.fullname" . }}
labels:
{{- include "hail-search.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "hail-search.selectorLabels" . | nindent 4 }}
70 changes: 70 additions & 0 deletions charts/hail-search/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Default values for hail-search.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 4

image:
repository: gcr.io/seqr-project/seqr-hail-search
pullPolicy: Always
# -- The docker image tag to pull from the repository
# tag: "gcloud-dev"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

service:
type: ClusterIP
port: 5000

resources:
{}

# default environment variables
environment:
DATASETS_DIR: '/datasets'

initContainers: |-
{{- range $path, $version := .Values.global.hail_search.datasetVersions -}}
{{ if $version }}
- name: sync-datasets-{{ $path }}
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:latest
command: ['gsutil', '-m', 'rsync', '-r', '{{ $.Values.global.hail_search.sourceDatasetsDir }}/{{ $path }}/runs/{{ $version }}', '{{ $.Values.environment.DATASETS_DIR }}/{{ $path }}']
volumeMounts:
- mountPath: {{ $.Values.environment.DATASETS_DIR }}
name: datasets
{{ end }}
{{ end }}
# Prefer to be scheduled away from other hail-search pods and seqr application pods
affinity: |-
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1.0
podAffinityTerm:
labelSelector:
matchLabels:
{{- include "hail-search.selectorLabels" . | nindent 12 }}
topologyKey: "kubernetes.io/hostname"
- weight: 1.0
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "name"
operator: In
values:
- seqr
topologyKey: "kubernetes.io/hostname"
nodeSelector:
{}

global:
hail_search:
sourceDatasetsDir: ''
datasetVersions:
GRCh37/SNV_INDEL: ''
GRCh38/SNV_INDEL: ''
44 changes: 44 additions & 0 deletions charts/seqr/templates/check-for-new-samples-from-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- range $path, $version := .Values.global.hail_search.datasetVersions -}}
{{ if $version }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "seqr.fullname" $ }}-check-new-samples-job
labels:
{{- include "seqr.labels" $ | nindent 4 }}
annotations:
"helm.sh/hook": post-install, post-upgrade
"helm.sh/hook-weight": "-1"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- with $.Values.podAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
metadata:
labels:
{{- include "seqr.labels" $ | nindent 8 }}
spec:
{{- with $.Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Never
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
containers:
- name: {{ include "seqr.fullname" $ }}-check-new-samples-job-pod
image: {{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with $.Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
command: ["python", "manage.py", "check_for_new_samples_from_pipeline", "{{ $path }}", "{{ $version }}"]
{{- with $.Values.deployment_sidecars }}
{{- tpl . $ | nindent 6 }}
{{- end }}
{{ end }}
{{ end }}
7 changes: 7 additions & 0 deletions charts/seqr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,10 @@ run_seqr_database_migration: false
redis:
# -- enables or disables redis deployment using this chart
enabled: false

global:
hail_search:
sourceDatasetsDir: ''
datasetVersions:
GRCh37/SNV_INDEL: ''
GRCh38/SNV_INDEL: ''

0 comments on commit 54d7190

Please sign in to comment.