Skip to content

Commit

Permalink
avoid unnecessarily redeclaring helm variables (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored Dec 13, 2023
1 parent 99750fc commit f48c780
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 22 deletions.
14 changes: 6 additions & 8 deletions kubernetes/preview/templates/lapis-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
{{- $lapisHost := printf "lapis.%s" .Values.host }}
{{- $environment := .Values.environment }}
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{- $namespace := .Values.namespace }}
{{- range $key, $_ := $configFile.instances }}

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: lapis-ingressroute-{{ $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
{{- if eq $environment "server" }}
{{- if eq $.Values.environment "server" }}
link.argocd.argoproj.io/external-link: https://{{ $lapisHost }}
{{- end }}
spec:
entryPoints:
{{- if eq $environment "server" }}
{{- if eq $.Values.environment "server" }}
- websecure
{{- else }}
- web
{{- end }}
routes:
- match: Path(`/{{ $key }}`, `/{{ $key }}/{path:.*}`) {{- if eq $environment "server" }} && Host(`{{ $lapisHost }}`){{- end }}
- match: Path(`/{{ $key }}`, `/{{ $key }}/{path:.*}`) {{- if eq $.Values.environment "server" }} && Host(`{{ $lapisHost }}`){{- end }}
kind: Rule
services:
- name: {{ template "pathoplexus.lapisServiceName" $key }}
port: 8080
middlewares:
- name: strip-{{ $key }}-prefix
{{- if eq $environment "server" }}
{{- if eq $.Values.environment "server" }}
tls:
certResolver: myresolver
{{- end }}
Expand All @@ -40,7 +38,7 @@ apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: strip-{{ $key }}-prefix
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
spec:
stripPrefix:
prefixes:
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/preview/templates/lapis-service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{ $namespace := .Values.namespace }}

{{- range $key, $_ := $configFile.instances }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "pathoplexus.lapisServiceName" $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
spec:
type: ClusterIP
selector:
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/preview/templates/lapis-silo-database-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{- $commonMetadata := (include "pathoplexus.commonMetadata" . | fromYaml).fields }}
{{- $namespace := .Values.namespace }}
{{- $importScriptLines := .Files.Lines "silo_import_job.sh" }}

{{- range $key, $instance := $configFile.instances }}
Expand All @@ -9,7 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: lapis-silo-database-config-{{ $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
data:
{{- with $instance.schema }}
database_config.yaml: |
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/preview/templates/lapis-silo-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{ $namespace := .Values.namespace }}

{{- range $key, $_ := $configFile.instances }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pathoplexus-lapis-silo-{{ $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
annotations:
argocd.argoproj.io/sync-options: Replace=true
spec:
Expand Down
6 changes: 2 additions & 4 deletions kubernetes/preview/templates/lapis-silo-import-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{- $namespace := .Values.namespace }}
{{- $disableBackend := .Values.disableBackend }}

{{- $keycloakTokenUrl := "http://pathoplexus-keycloak-service:8083/realms/pathoplexusRealm/protocol/openid-connect/token" }}

Expand All @@ -11,7 +9,7 @@ apiVersion: batch/v1
kind: CronJob
metadata:
name: lapis-silo-import-cronjob-{{ $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
spec:
schedule: "* * * * *"
concurrencyPolicy: Forbid
Expand All @@ -32,7 +30,7 @@ spec:
- /silo_import_job.sh
env:
- name: BACKEND_BASE_URL
{{- if $disableBackend }}
{{- if $.Values.disableBackend }}
value: "http://host.k3d.internal:8079/{{ $key }}"
{{- else }}
value: "http://pathoplexus-backend-service:8079/{{ $key }}"
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/preview/templates/lapis-silo-shared-data.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{{- $configFile := .Files.Get "config.yaml" | fromYaml }}
{{ $namespace := .Values.namespace }}

{{- range $key, $_ := $configFile.instances }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: lapis-silo-shared-data-{{ $key }}
namespace: {{ $namespace }}
namespace: {{ $.Values.namespace }}
spec:
accessModes:
- ReadWriteOnce
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- $dockerTag := include "pathoplexus.dockerTag" .Values }}
{{ $configFile := .Files.Get "config.yaml" | fromYaml }}
{{ $namespace := .Values.namespace }}
{{ $backendHost := .Values.disableBackend | ternary
"http://host.k3d.internal:8079"
"http://pathoplexus-backend-service:8079"
Expand Down Expand Up @@ -36,7 +35,7 @@ spec:
args:
- "--watch"
- "--backend-host={{ $backendHost }}/{{ $key }}"
{{- if eq .Values.environment "server" }}
{{- if eq $.Values.environment "server" }}
- "--keycloak-host=https://{{ $keycloakHost}}"
{{- else }}
- "--keycloak-host=http://localhost:8083"
Expand Down

0 comments on commit f48c780

Please sign in to comment.