Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Add helm chart for compound soaking
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Mar 6, 2024
1 parent 31c48f2 commit c3b1839
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
command:
- --dev
- -config
- config/router.yaml
- /dist/config/router.yaml
- -supergraph
- schema/supergraph.graphql

Expand Down
7 changes: 5 additions & 2 deletions charts/xchemlab/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ dependencies:
- name: compound-library
repository: ""
version: 0.0.1
- name: compound-soaking
repository: ""
version: 0.0.1
- name: crystal-library
repository: ""
version: 0.0.1
Expand Down Expand Up @@ -38,5 +41,5 @@ dependencies:
- name: oauth2-proxy
repository: oci://registry-1.docker.io/bitnamicharts
version: 3.7.4
digest: sha256:e2987ea5e22dfa308a63f6f5e029d90bbc3cbd1c926161a2b72aa23ff7605825
generated: "2024-03-05T14:33:24.387624369Z"
digest: sha256:2738fe6bf788e283ebdd64f5bbf8c0094b9e7271b40fe693b661117d4bed9eb9
generated: "2024-03-06T11:37:40.525320982Z"
3 changes: 3 additions & 0 deletions charts/xchemlab/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ dependencies:
- name: compound-library
version: 0.0.1
condition: compound-library.enabled
- name: compound-soaking
version: 0.0.1
condition: compound-soaking.enabled
- name: crystal-library
version: 0.0.1
condition: crystal-library.enabled
Expand Down
15 changes: 15 additions & 0 deletions charts/xchemlab/charts/compound-soaking/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: compound-soaking
description: A service for tracking soaked compounds currently available in the XChem lab
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.0.1

# 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: "0.0.6"
73 changes: 73 additions & 0 deletions charts/xchemlab/charts/compound-soaking/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "compoundSoaking.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 "compoundSoaking.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 "compoundSoaking.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "compoundSoaking.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "xchemlab.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the database URL string
*/}}
{{- define "compoundSoaking.databaseURL" -}}
{{- $host_parts := urlParse .Values.database.host }}
{{- $raw_user_info := printf "%s:$DATABASE_PASSWORD" .Values.database.user }}
{{- $url_parts := set $host_parts "userinfo" $raw_user_info }}
{{- $raw_database_url := urlJoin $url_parts }}
{{- replace "$DATABASE_PASSWORD" "$(DATABASE_PASSWORD)" $raw_database_url }}
{{- end }}
63 changes: 63 additions & 0 deletions charts/xchemlab/charts/compound-soaking/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "compoundSoaking.fullname" . }}
labels:
{{- include "compoundSoaking.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "compoundSoaking.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "compoundSoaking.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "compoundSoaking.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- serve
env:
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.database.password.secretName }}
key: {{ .Values.database.password.secretKey }}
- name: DATABASE_URL
value: {{ include "compoundSoaking.databaseURL" . }}
- name: OPA_URL
value: {{ tpl .Values.opa.url . }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
{{- toYaml .Values.resources | 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 }}
15 changes: 15 additions & 0 deletions charts/xchemlab/charts/compound-soaking/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "compoundSoaking.fullname" . }}
labels:
{{- include "compoundSoaking.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "compoundSoaking.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "compoundSoaking.serviceAccountName" . }}
labels:
{{- include "compoundSoaking.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
43 changes: 43 additions & 0 deletions charts/xchemlab/charts/compound-soaking/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
nameOverride: ""
fullnameOverride: ""

image:
repository: ghcr.io/diamondlightsource/xchemlab-compound-soaking
pullPolicy: Always
tag: ""

imagePullSecrets: []

database:
host: ""
user: ""
password:
secretName: ""
secretKey: ""

opa:
url: ""

replicaCount: 1

service:
type: ClusterIP
port: 80

serviceAccount:
create: false
name: ""

podAnnotations: {}

podSecurityContext: {}

securityContext: {}

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}
11 changes: 11 additions & 0 deletions charts/xchemlab/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ compound-library:
opa:
url: http://{{ .Release.Name }}-opa-kube-mgmt:8181

compound-soaking:
enabled: true
database:
host: postgres://postgresql-ha-pgpool
user: postgres
password:
secretName: postgres-passwords
secretKey: password
opa:
url: http://{{ .Release.Name }}-opa-kube-mgmt:8181

crystal-library:
enabled: true
database:
Expand Down

0 comments on commit c3b1839

Please sign in to comment.