diff --git a/kubernetes/loculus/templates/ingest-config.yaml b/kubernetes/loculus/templates/ingest-config.yaml index 53f21cb85..85786a24c 100644 --- a/kubernetes/loculus/templates/ingest-config.yaml +++ b/kubernetes/loculus/templates/ingest-config.yaml @@ -1,3 +1,4 @@ +{{- $dockerTag := include "loculus.dockerTag" .Values }} {{- $testconfig := .Values.testconfig | default false }} {{- $backendHost := .Values.environment | eq "server" | ternary (printf "https://backend%s%s" .Values.subdomainSeparator $.Values.host) ($testconfig | ternary "http://localhost:8079" "http://loculus-backend-service:8079") }} {{- $keycloakHost := .Values.environment | eq "server" | ternary (printf "https://authentication%s%s" $.Values.subdomainSeparator $.Values.host) ($testconfig | ternary "http://localhost:8083" "http://loculus-keycloak-service:8083") }} @@ -12,6 +13,7 @@ metadata: data: config.yaml: | {{- $values.ingest.configFile | toYaml | nindent 4 }} + verify_loculus_version_is: {{$dockerTag}} organism: {{ $key }} backend_url: {{ $backendHost }} keycloak_token_url: {{ $keycloakHost -}}/realms/loculus/protocol/openid-connect/token diff --git a/kubernetes/loculus/templates/ingest-deployment.yaml b/kubernetes/loculus/templates/ingest-deployment.yaml index ebb2060f4..47d4d41d8 100644 --- a/kubernetes/loculus/templates/ingest-deployment.yaml +++ b/kubernetes/loculus/templates/ingest-deployment.yaml @@ -25,6 +25,26 @@ spec: component: loculus-ingest-deployment-{{ $key }} spec: {{- include "possiblePriorityClassName" $ | nindent 6 }} + initContainers: + - name: version-check + image: busybox + {{- include "loculus.resources" (list "ingest-init" $.Values) | nindent 10 }} + command: ['sh', '-c', ' + CONFIG_VERSION=$(grep "verify_loculus_version_is:" /package/config/config.yaml | sed "s/verify_loculus_version_is: //;"); + DOCKER_TAG="{{ $dockerTag }}"; + echo "Config version: $CONFIG_VERSION"; + echo "Docker tag: $DOCKER_TAG"; + if [ "$CONFIG_VERSION" != "$DOCKER_TAG" ]; then + echo "Version mismatch: ConfigMap version $CONFIG_VERSION does not match docker tag $DOCKER_TAG"; + exit 1; + else + echo "Version match confirmed"; + fi + '] + volumeMounts: + - name: loculus-ingest-config-volume-{{ $key }} + mountPath: /package/config/config.yaml + subPath: config.yaml containers: - name: ingest-{{ $key }} image: {{ $value.ingest.image}}:{{ $dockerTag }} @@ -110,4 +130,4 @@ spec: {{- end }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }}