From e8bff461add89de5cadaae0eb964e4af11439ee1 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Sun, 6 Oct 2024 15:57:27 +0100 Subject: [PATCH] Add helm chart for taxonium backend (#615) * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add ingress and svc * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update ingress.yaml * Update ingress.yaml --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- helm_charts/taxonium-backend/Chart.yaml | 4 ++ .../templates/deployment.yaml | 55 +++++++++++++++++++ .../taxonium-backend/templates/ingress.yaml | 33 +++++++++++ .../taxonium-backend/templates/service.yaml | 14 +++++ helm_charts/taxonium-backend/values.yaml | 44 +++++++++++++++ taxonium_component/src/components/Key.jsx | 2 +- 6 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 helm_charts/taxonium-backend/Chart.yaml create mode 100644 helm_charts/taxonium-backend/templates/deployment.yaml create mode 100644 helm_charts/taxonium-backend/templates/ingress.yaml create mode 100644 helm_charts/taxonium-backend/templates/service.yaml create mode 100644 helm_charts/taxonium-backend/values.yaml diff --git a/helm_charts/taxonium-backend/Chart.yaml b/helm_charts/taxonium-backend/Chart.yaml new file mode 100644 index 00000000..af13ad5c --- /dev/null +++ b/helm_charts/taxonium-backend/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +name: taxonium-backend +description: A Helm chart for the Taxonium backend +version: 0.1.0 diff --git a/helm_charts/taxonium-backend/templates/deployment.yaml b/helm_charts/taxonium-backend/templates/deployment.yaml new file mode 100644 index 00000000..7a3f7407 --- /dev/null +++ b/helm_charts/taxonium-backend/templates/deployment.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-taxonium-backend + labels: + app: {{ .Release.Name }}-taxonium-backend +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ .Release.Name }}-taxonium-backend + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: {{ .Values.maxSurge | default "25%" }} + maxUnavailable: {{ .Values.maxUnavailable | default "25%" }} + template: + metadata: + labels: + app: {{ .Release.Name }}-taxonium-backend + annotations: + kubectl.kubernetes.io/restartedAt: {{ now | date "2006-01-02T15:04:05Z" | quote }} + spec: + containers: + - name: taxonium-backend + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: DATA_URL + value: {{ .Values.dataUrl }} + - name: CONFIG_JSON + value: {{ .Values.configJson }} + - name: MAXMEM + value: {{ .Values.maxmem | quote }} + ports: + - containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + resources: + {{- toYaml .Values.resources | nindent 12 }} diff --git a/helm_charts/taxonium-backend/templates/ingress.yaml b/helm_charts/taxonium-backend/templates/ingress.yaml new file mode 100644 index 00000000..43223750 --- /dev/null +++ b/helm_charts/taxonium-backend/templates/ingress.yaml @@ -0,0 +1,33 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-taxonium-backend + labels: + app: {{ .Release.Name }}-taxonium-backend + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + rules: + - host: {{ .Values.hostname | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-taxonium-backend + port: + number: {{ .Values.service.port }} + {{- with .Values.ingress.tls }} + tls: + - hosts: + - {{ $.Values.hostname | quote }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} diff --git a/helm_charts/taxonium-backend/templates/service.yaml b/helm_charts/taxonium-backend/templates/service.yaml new file mode 100644 index 00000000..5bfca081 --- /dev/null +++ b/helm_charts/taxonium-backend/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-taxonium-backend + labels: + app: {{ .Release.Name }}-taxonium-backend +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: 80 + protocol: TCP + selector: + app: {{ .Release.Name }}-taxonium-backend diff --git a/helm_charts/taxonium-backend/values.yaml b/helm_charts/taxonium-backend/values.yaml new file mode 100644 index 00000000..7b2ce81b --- /dev/null +++ b/helm_charts/taxonium-backend/values.yaml @@ -0,0 +1,44 @@ +replicaCount: 1 + +image: + repository: theosanderson/taxonium_backend + tag: master + pullPolicy: Always + +maxSurge: "25%" +maxUnavailable: "25%" + +dataUrl: "https://cov2tree.nyc3.cdn.digitaloceanspaces.com/latest_public.jsonl.gz" +configJson: "config_public.json" +maxmem: "7000" + +livenessProbe: + initialDelaySeconds: 120 + periodSeconds: 30 + timeoutSeconds: 10 + failureThreshold: 3 + +readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + +resources: + requests: + cpu: "1" + memory: 6500Mi + +ingress: + enabled: true + className: "" + annotations: + {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] diff --git a/taxonium_component/src/components/Key.jsx b/taxonium_component/src/components/Key.jsx index 189dfef0..edcdf050 100644 --- a/taxonium_component/src/components/Key.jsx +++ b/taxonium_component/src/components/Key.jsx @@ -149,7 +149,7 @@ const Key = ({ {!collapsed && - ((colorRamps && colorByField in colorRamps) ? ( + (colorRamps && colorByField in colorRamps ? ( ) : (