From 8c9d73868df2c054e14389a28d5b8a3943f82cbe Mon Sep 17 00:00:00 2001 From: Xiao Gui Date: Mon, 13 Jan 2025 14:36:29 +0100 Subject: [PATCH] deploy: simplify (?) deployment script --- .github/workflows/deploy-helm.yml | 89 --------- .github/workflows/deploy-server-helm-v4.yml | 81 -------- .github/workflows/deploy-worker-helm-v4.yml | 99 ---------- .github/workflows/docker-img.yml | 176 +++++++----------- .gitignore | 1 - .helm/adhoc/ingress.yaml | 43 +++++ .helm/deployments/prod/deploy.sh | 40 ++++ .helm/deployments/prod/server.yaml | 10 + .helm/deployments/prod/worker-compounds.yaml | 10 + .helm/deployments/prod/worker-core.yaml | 10 + .helm/deployments/prod/worker-features.yaml | 10 + .helm/deployments/prod/worker-v4.yaml | 10 + .helm/deployments/rc/deploy.sh | 40 ++++ .helm/siibra-api-v4-server/Chart.yaml | 2 +- .../templates/_helpers.tpl | 9 + .../templates/deployment.yaml | 3 +- .helm/siibra-api-v4-server/values.yaml | 1 + .helm/siibra-api-v4-worker/Chart.yaml | 2 +- .../templates/deployment.yaml | 3 +- api/server/volumes/parcellationmap.py | 2 +- 20 files changed, 256 insertions(+), 385 deletions(-) delete mode 100644 .github/workflows/deploy-helm.yml delete mode 100644 .github/workflows/deploy-server-helm-v4.yml delete mode 100644 .github/workflows/deploy-worker-helm-v4.yml create mode 100755 .helm/deployments/prod/deploy.sh create mode 100644 .helm/deployments/prod/server.yaml create mode 100644 .helm/deployments/prod/worker-compounds.yaml create mode 100644 .helm/deployments/prod/worker-core.yaml create mode 100644 .helm/deployments/prod/worker-features.yaml create mode 100644 .helm/deployments/prod/worker-v4.yaml create mode 100755 .helm/deployments/rc/deploy.sh diff --git a/.github/workflows/deploy-helm.yml b/.github/workflows/deploy-helm.yml deleted file mode 100644 index d0de742..0000000 --- a/.github/workflows/deploy-helm.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Trigger deploy with helm -on: - workflow_call: - inputs: - DEPLOYMENT_NAME: - required: true - type: string - - secrets: - KUBECONFIG: - required: true - -env: - RC_INGRESS_HOST: '[{"host": "siibra-api-rc.apps.tc.humanbrainproject.eu", "paths": [{ "path": "/", "pathType": "Prefix" }]}]' - RC_INGRESS_TLS: '[{"secretName": "siibra-api-rc-secret", "hosts": ["siibra-api-rc.apps.tc.humanbrainproject.eu"]}]' - -jobs: - set-vars: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: './.github/workflows/composite-set-k8s-cred' - with: - secrets: ${{ secrets.KUBECONFIG }} - - - name: 'Get status' - run: | - helm status ${{ inputs.DEPLOYMENT_NAME }} - HELM_STATUS=$(echo $?) - echo "HELM_STATUS: $HELM_STATUS" - echo "HELM_STATUS=$HELM_STATUS" >> $GITHUB_ENV - - - name: Set Vars - run: | - SAPI_VERSION=$(cat VERSION) - GIT_HASH=$(git rev-parse --short HEAD) - - echo "SAPI_VERSION: $SAPI_VERSION" - echo "GIT_HASH: $GIT_HASH" - - if [[ -z "$SAPI_VERSION" ]] - then - echo "SAPI_VERSION cannot be found $SAPI_VERSION" - exit 1 - fi - - if [[ -z "$GIT_HASH" ]] - then - echo "GIT_HASH cannot be found $GIT_HASH" - exit 1 - fi - - echo "SAPI_VERSION=$SAPI_VERSION" >> $GITHUB_ENV - echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV - - - name: 'deploy rc' - if: ${{ inputs.DEPLOYMENT_NAME == 'rc' }} - run: | - if [[ "$HELM_STATUS" == "0" ]] - then - helm upgrade --set sapiVersion=$SAPI_VERSION \ - --reuse-values \ - --set podLabels.hash="$GIT_HASH" \ - --set image.pullPolicy=Always \ - --history-max 3 \ - rc .helm/siibra-api/ - else - helm install --set sapiVersion=$SAPI_VERSION \ - --set sapiFlavor=rc --set-json ingress.hosts='${{ env.RC_INGRESS_HOST }}'\ - --set-json ingress.tls='${{ env.RC_INGRESS_TLS }}' \ - --set podLabels.hash="$GIT_HASH" \ - --set image.pullPolicy=Always \ - rc .helm/siibra-api/ - fi - - - name: 'deploy prod' - if: ${{ inputs.DEPLOYMENT_NAME == 'prod' }} - run: | - if [[ "$HELM_STATUS" == "0" ]] - then - helm upgrade \ - --set sapiVersion=$SAPI_VERSION \ - --reuse-values \ - prod .helm/siibra-api/ - else - helm install \ - --set sapiVersion=$SAPI_VERSION \ - prod .helm/siibra-api/ - fi diff --git a/.github/workflows/deploy-server-helm-v4.yml b/.github/workflows/deploy-server-helm-v4.yml deleted file mode 100644 index 13f234f..0000000 --- a/.github/workflows/deploy-server-helm-v4.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: "[deploy] on helm (v4)" - -on: - workflow_call: - inputs: - DEPLOYMENT_NAME: - required: true - type: string - - HELM_FILE: - default: ".helm/siibra-api-v4-server" - type: string - - FALVOR: - required: true - type: string - - IMAGE_TAG: - default: "0.3-server" - type: string - - PULL_POLICY: - default: IfNotPresent - type: string - - secrets: - KUBECONFIG: - required: true - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: './.github/workflows/composite-set-k8s-cred' - with: - secrets: ${{ secrets.KUBECONFIG }} - - name: 'Get status' - run: | - set -e - helm status ${{ inputs.DEPLOYMENT_NAME }} - HELM_STATUS=$? - echo "HELM_STATUS: $HELM_STATUS" - echo "HELM_STATUS=$HELM_STATUS" >> $GITHUB_ENV - - - name: Set Vars - run: | - SAPI_VERSION=$(cat VERSION) - - echo "SAPI_VERSION: $SAPI_VERSION" - - if [[ -z "$SAPI_VERSION" ]] - then - echo "SAPI_VERSION cannot be found $SAPI_VERSION" - exit 1 - fi - - echo "SAPI_VERSION=$SAPI_VERSION" >> $GITHUB_ENV - - - name: Run deploy - run: | - if [[ "$HELM_STATUS" == "0" ]] - then - helm upgrade \ - --set sapi.version=$SAPI_VERSION \ - --set sapi.flavor=${{ inputs.FALVOR }} \ - --set image.tag=${{ inputs.IMAGE_TAG }} \ - --set image.pullPolicy=${{ inputs.PULL_POLICY }} \ - --reuse-values \ - --history-max 1 \ - ${{ inputs.DEPLOYMENT_NAME }} \ - ${{ inputs.HELM_FILE }} - else - helm install \ - --set sapi.version=$SAPI_VERSION \ - --set sapi.flavor=${{ inputs.FALVOR }} \ - --set image.tag=${{ inputs.IMAGE_TAG }} \ - --set image.pullPolicy=${{ inputs.PULL_POLICY }} \ - ${{ inputs.DEPLOYMENT_NAME }} \ - ${{ inputs.HELM_FILE }} - fi diff --git a/.github/workflows/deploy-worker-helm-v4.yml b/.github/workflows/deploy-worker-helm-v4.yml deleted file mode 100644 index 218f8fa..0000000 --- a/.github/workflows/deploy-worker-helm-v4.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: "[deploy] on helm (v4)" - -on: - workflow_call: - inputs: - DEPLOYMENT_NAME: - required: true - type: string - - HELM_FILE: - default: ".helm/siibra-api-v4-worker" - type: string - - FALVOR: - required: true - type: string - - QUEUE: - required: true - type: string - - IMAGE_TAG: - default: "0.3-worker" - type: string - - RESOURCE: - default: "low" # high - type: string - - WORKER_PATH: - default: "api.worker.app" - type: string - - PULL_POLICY: - default: IfNotPresent - type: string - - secrets: - KUBECONFIG: - required: true - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: './.github/workflows/composite-set-k8s-cred' - with: - secrets: ${{ secrets.KUBECONFIG }} - - name: 'Get status' - run: | - set -e - helm status ${{ inputs.DEPLOYMENT_NAME }} - HELM_STATUS=$? - echo "HELM_STATUS: $HELM_STATUS" - echo "HELM_STATUS=$HELM_STATUS" >> $GITHUB_ENV - - - name: Set Vars - run: | - SAPI_VERSION=$(cat VERSION) - - echo "SAPI_VERSION: $SAPI_VERSION" - - if [[ -z "$SAPI_VERSION" ]] - then - echo "SAPI_VERSION cannot be found $SAPI_VERSION" - exit 1 - fi - - echo "SAPI_VERSION=$SAPI_VERSION" >> $GITHUB_ENV - - - name: Run deploy - run: | - if [[ "$HELM_STATUS" == "0" ]] - then - helm upgrade \ - --set sapi.version=$SAPI_VERSION \ - --set sapi.flavor=${{ inputs.FALVOR }} \ - --set sapi.queue=${{ inputs.QUEUE }} \ - --set image.tag=${{ inputs.IMAGE_TAG }} \ - --set image.pullPolicy=${{ inputs.PULL_POLICY }} \ - --set sapi.worker=${{ inputs.WORKER_PATH }} \ - --set sapi.resources.flavor=${{ inputs.RESOURCE }} \ - --reuse-values \ - --history-max 1 \ - ${{ inputs.DEPLOYMENT_NAME }} \ - ${{ inputs.HELM_FILE }} - else - helm install \ - --set sapi.version=$SAPI_VERSION \ - --set sapi.flavor=${{ inputs.FALVOR }} \ - --set sapi.queue=${{ inputs.QUEUE }} \ - --set image.tag=${{ inputs.IMAGE_TAG }} \ - --set image.pullPolicy=${{ inputs.PULL_POLICY }} \ - --set sapi.worker=${{ inputs.WORKER_PATH }} \ - --set sapi.resources.flavor=${{ inputs.RESOURCE }} \ - ${{ inputs.DEPLOYMENT_NAME }} \ - ${{ inputs.HELM_FILE }} - fi diff --git a/.github/workflows/docker-img.yml b/.github/workflows/docker-img.yml index d38cf80..a5c3398 100644 --- a/.github/workflows/docker-img.yml +++ b/.github/workflows/docker-img.yml @@ -194,128 +194,84 @@ jobs: fi done - deploy-rc-worker-via-helm: - needs: - - warmup-rc-at-helm - - setup-envvar - - strategy: - fail-fast: false - matrix: - include: - - queue: "core" - resource: 'low' - - queue: "compounds" - resource: 'high' - - queue: "features" - resource: 'high' - - if: ${{ github.event_name == 'release' && contains(github.ref, 'rc') }} - uses: ./.github/workflows/deploy-worker-helm-v4.yml - with: - DEPLOYMENT_NAME: rc-worker-${{ matrix.queue }} - HELM_FILE: .helm/siibra-api-v4-worker - FALVOR: rc - QUEUE: ${{ needs.setup-envvar.outputs.version }}.rc.${{ matrix.queue }} - IMAGE_TAG: rc-worker - RESOURCE: ${{ matrix.resource }} - PULL_POLICY: Always - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} - - deploy-rc-worker-v4-via-helm: - needs: - - warmup-rc-at-helm - - setup-envvar - - if: ${{ github.event_name == 'release' && contains(github.ref, 'rc') }} - uses: ./.github/workflows/deploy-worker-helm-v4.yml - with: - DEPLOYMENT_NAME: rc-worker-v4 - HELM_FILE: .helm/siibra-api-v4-worker - FALVOR: rc - QUEUE: "" - IMAGE_TAG: rc-worker-v4 - WORKER_PATH: "" - PULL_POLICY: Always - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} - - deploy-rc-server-via-helm: + deploy-rc-via-helm: needs: - warmup-rc-at-helm - setup-envvar if: ${{ github.event_name == 'release' && contains(github.ref, 'rc') }} - uses: ./.github/workflows/deploy-server-helm-v4.yml - with: - DEPLOYMENT_NAME: rc-server - FALVOR: rc - IMAGE_TAG: rc-server - PULL_POLICY: Always - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/workflows/composite-set-k8s-cred + with: + secrets: ${{ secrets.KUBECONFIG }} + - run: .helm/deployments/rc/deploy.sh + # prod - # copy-by-helm: - # needs: setup-envvar - # if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }} - # runs-on: ubuntu-latest - # timeout-minutes: 15 # should not take more than 15 minutes to copy cache - # steps: - # - uses: actions/checkout@v4 - # - uses: ./.github/workflows/composite-set-k8s-cred - # with: - # secrets: ${{ secrets.KUBECONFIG }} - # - name: 'set FROM_DIR TO_DIR' - # run: | - # VERSION=${{ needs.setup-envvar.outputs.version }} + copy-by-helm: + needs: setup-envvar + if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }} + runs-on: ubuntu-latest + timeout-minutes: 15 # should not take more than 15 minutes to copy cache + steps: + - uses: actions/checkout@v4 + - uses: ./.github/workflows/composite-set-k8s-cred + with: + secrets: ${{ secrets.KUBECONFIG }} + - name: 'set FROM_DIR TO_DIR' + run: | + VERSION=${{ needs.setup-envvar.outputs.version }} + + # TODO use label exclusively in the future + POD=$(kubectl get pod -l role=server -l app-flavor=rc -o json | jq -r '.items[0].metadata.name') + echo POD: $POD - # # TODO use label exclusively in the future - # POD=$(kubectl get pod -l role=server -l app-flavor=rc -o json | jq -r '.items[0].metadata.name') - # echo POD: $POD + cache_str=$(kubectl exec $POD -- env | grep SIIBRA_CACHEDIR) + FROM_DIR=${cache_str//SIIBRA_CACHEDIR=/} + TO_DIR=${FROM_DIR//-rc/} + POD_NAME=copy-cache - # cache_str=$(kubectl exec $POD -- env | grep SIIBRA_CACHEDIR) - # FROM_DIR=${cache_str//SIIBRA_CACHEDIR=/} - # TO_DIR=${FROM_DIR//-rc/} - # POD_NAME=copy-cache + echo FROM_DIR: $FROM_DIR, TO_DIR: $TO_DIR, POD_NAME: $POD_NAME - # echo FROM_DIR: $FROM_DIR, TO_DIR: $TO_DIR, POD_NAME: $POD_NAME + echo "FROM_DIR=$FROM_DIR" >> $GITHUB_ENV + echo "TO_DIR=$TO_DIR" >> $GITHUB_ENV + echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV - # echo "FROM_DIR=$FROM_DIR" >> $GITHUB_ENV - # echo "TO_DIR=$TO_DIR" >> $GITHUB_ENV - # echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV + - name: 'start container' + run: | + # delete pod before workflow, so that logs can be inspected + kubectl delete pod/$POD_NAME || echo "Pod pod/$POD_NAME not found." + FROM_DIR=$FROM_DIR TO_DIR=$TO_DIR envsubst < .helm/adhoc/copy-cache.yaml | kubectl apply -f - + - name: 'Ensure copy completes' + run: | + while true + do + sleep 10 + POD_PHASE=$(kubectl get pod $POD_NAME -o json | jq -r '.status.phase') - # - name: 'start container' - # run: | - # # delete pod before workflow, so that logs can be inspected - # kubectl delete pod/$POD_NAME || echo "Pod pod/$POD_NAME not found." - # FROM_DIR=$FROM_DIR TO_DIR=$TO_DIR envsubst < .helm/adhoc/copy-cache.yaml | kubectl apply -f - - # - name: 'Ensure copy completes' - # run: | - # while true - # do - # sleep 10 - # POD_PHASE=$(kubectl get pod $POD_NAME -o json | jq -r '.status.phase') + echo Possible phases: Pending, Running, Succeeded, Failed, Unknown + echo Found phase: $POD_PHASE - # echo Possible phases: Pending, Running, Succeeded, Failed, Unknown - # echo Found phase: $POD_PHASE + if [[ "$POD_PHASE" == "Failed" ]] || [[ "$POD_PHASE" == "Unknown" ]] + then + exit 1 + fi - # if [[ "$POD_PHASE" == "Failed" ]] || [[ "$POD_PHASE" == "Unknown" ]] - # then - # exit 1 - # fi + if [[ "$POD_PHASE" == "Succeeded" ]] + then + exit 0 + fi + done - # if [[ "$POD_PHASE" == "Succeeded" ]] - # then - # exit 0 - # fi - # done + deploy-prod-via-helm: + needs: copy-by-helm + if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/workflows/composite-set-k8s-cred + with: + secrets: ${{ secrets.KUBECONFIG }} + - run: .helm/deployments/prod/deploy.sh - # deploy-prod-via-helm: - # needs: copy-by-helm - # if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }} - # uses: ./.github/workflows/deploy-helm.yml - # with: - # DEPLOYMENT_NAME: prod - # secrets: - # KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.gitignore b/.gitignore index 168d2b2..cd6f080 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ siibra-python/* venv/* .env tmp -*.sh docs/_* **/*.log secret* diff --git a/.helm/adhoc/ingress.yaml b/.helm/adhoc/ingress.yaml index e94c1b4..9fdb794 100644 --- a/.helm/adhoc/ingress.yaml +++ b/.helm/adhoc/ingress.yaml @@ -40,3 +40,46 @@ spec: name: prod-server-siibra-api-v4-server port: number: 5000 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: siibra-api-prod-canonical + labels: + name: siibra-api-prod-canonical +spec: + tls: + - secretName: siibra-api-prod-ebrains-secret + hosts: + - siibra-api.apps.ebrains.eu + rules: + - host: siibra-api.apps.ebrains.eu + http: + paths: + - pathType: Prefix + path: "/v1_0" + backend: + service: + name: siibra-api-v1 + port: + number: 5000 + - host: siibra-api.apps.ebrains.eu + http: + paths: + - pathType: Prefix + path: "/v2_0" + backend: + service: + name: siibra-api-v2 + port: + number: 5000 + - host: siibra-api.apps.ebrains.eu + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: prod-server-siibra-api-v4-server + port: + number: 5000 diff --git a/.helm/deployments/prod/deploy.sh b/.helm/deployments/prod/deploy.sh new file mode 100755 index 0000000..61c2579 --- /dev/null +++ b/.helm/deployments/prod/deploy.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +prefix="prod-" + +for f in $( find .helm/deployments/prod -name "*.yaml" ) +do + file=${f%.yaml} + file=${file#.helm/deployments/prod/} + helm status $prefix$file > /dev/null 2>&1 + HELM_STATUS=$? + + helm_path="" + if [[ "$file" == *"server"* ]] + then + helm_path=.helm/siibra-api-v4-server/ + fi + + if [[ "$file" == *"worker"* ]] + then + helm_path=.helm/siibra-api-v4-worker/ + fi + + if [[ $helm_path == "" ]] + then + echo "$file does not match to any, skipping" + continue + fi + + if [[ "$HELM_STATUS" == "0" ]] + then + echo "upgrading $prefix$file ..." + helm upgrade -f $f \ + --history-max 3 \ + $prefix$file \ + $helm_path + else + echo "[NEW] installing $prefix$file ..." + helm install -f $f $prefix$file $helm_path + fi +done diff --git a/.helm/deployments/prod/server.yaml b/.helm/deployments/prod/server.yaml new file mode 100644 index 0000000..894a139 --- /dev/null +++ b/.helm/deployments/prod/server.yaml @@ -0,0 +1,10 @@ +sapi: + flavor: "prod" + version: "0.3.22" + +image: + spec: 0.3.22-server + +# managed via adhoc k8s configs +ingress: + enabled: false \ No newline at end of file diff --git a/.helm/deployments/prod/worker-compounds.yaml b/.helm/deployments/prod/worker-compounds.yaml new file mode 100644 index 0000000..904f8fd --- /dev/null +++ b/.helm/deployments/prod/worker-compounds.yaml @@ -0,0 +1,10 @@ +sapi: + flavor: "prod" + version: "0.3.22" + worker: "api.worker.app" + queue: "0.3.22.prod.compounds" + resources: + flavor: "high" + +image: + spec: 0.3.22-worker diff --git a/.helm/deployments/prod/worker-core.yaml b/.helm/deployments/prod/worker-core.yaml new file mode 100644 index 0000000..749dc49 --- /dev/null +++ b/.helm/deployments/prod/worker-core.yaml @@ -0,0 +1,10 @@ +sapi: + flavor: "prod" + version: "0.3.22" + worker: "api.worker.app" + queue: "0.3.22.prod.core" + resources: + flavor: "low" + +image: + spec: 0.3.22-worker diff --git a/.helm/deployments/prod/worker-features.yaml b/.helm/deployments/prod/worker-features.yaml new file mode 100644 index 0000000..55314bd --- /dev/null +++ b/.helm/deployments/prod/worker-features.yaml @@ -0,0 +1,10 @@ +sapi: + flavor: "prod" + version: "0.3.22" + worker: "api.worker.app" + queue: "0.3.22.prod.features" + resources: + flavor: "high" + +image: + spec: 0.3.22-worker diff --git a/.helm/deployments/prod/worker-v4.yaml b/.helm/deployments/prod/worker-v4.yaml new file mode 100644 index 0000000..bfa6f35 --- /dev/null +++ b/.helm/deployments/prod/worker-v4.yaml @@ -0,0 +1,10 @@ +sapi: + flavor: "prod" + version: "0.3.22" + worker: "" + queue: "" + resources: + flavor: "low" + +image: + spec: 0.3.22-worker-v4 diff --git a/.helm/deployments/rc/deploy.sh b/.helm/deployments/rc/deploy.sh new file mode 100755 index 0000000..be3ce1f --- /dev/null +++ b/.helm/deployments/rc/deploy.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +prefix="rc-" + +for f in $( find .helm/deployments/rc -name "*.yaml" ) +do + file=${f%.yaml} + file=${file#.helm/deployments/rc/} + helm status $prefix$file > /dev/null 2>&1 + HELM_STATUS=$? + + helm_path="" + if [[ "$file" == *"server"* ]] + then + helm_path=.helm/siibra-api-v4-server/ + fi + + if [[ "$file" == *"worker"* ]] + then + helm_path=.helm/siibra-api-v4-worker/ + fi + + if [[ $helm_path == "" ]] + then + echo "$file does not match to any, skipping" + continue + fi + + if [[ "$HELM_STATUS" == "0" ]] + then + echo "upgrading $prefix$file ..." + helm upgrade -f $f \ + --history-max 3 \ + $prefix$file \ + $helm_path + else + echo "[NEW] installing $prefix$file ..." + helm install -f $f $prefix$file $helm_path + fi +done diff --git a/.helm/siibra-api-v4-server/Chart.yaml b/.helm/siibra-api-v4-server/Chart.yaml index 75d5b54..f96cd6d 100644 --- a/.helm/siibra-api-v4-server/Chart.yaml +++ b/.helm/siibra-api-v4-server/Chart.yaml @@ -21,4 +21,4 @@ version: 0.1.0 # 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.3.22-rc" +appVersion: "0.3.22" diff --git a/.helm/siibra-api-v4-server/templates/_helpers.tpl b/.helm/siibra-api-v4-server/templates/_helpers.tpl index 0176f4d..b6cc1d9 100644 --- a/.helm/siibra-api-v4-server/templates/_helpers.tpl +++ b/.helm/siibra-api-v4-server/templates/_helpers.tpl @@ -41,6 +41,15 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} +{{- define "siibra-api-v4-server.image-full-spec" -}} +{{- if eq (substr 0 7 .Values.image.spec) "sha256:" -}} +{{- printf "%s@%s" .Values.image.repository .Values.image.spec }} +{{- else -}} +{{- printf "%s:%s" .Values.image.repository .Values.image.spec }} +{{- end -}} +{{- end -}} + + {{/* Create chart name and version as used by the chart label. */}} diff --git a/.helm/siibra-api-v4-server/templates/deployment.yaml b/.helm/siibra-api-v4-server/templates/deployment.yaml index 40a966b..ebd280a 100644 --- a/.helm/siibra-api-v4-server/templates/deployment.yaml +++ b/.helm/siibra-api-v4-server/templates/deployment.yaml @@ -34,7 +34,8 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{ include "siibra-api-v4-server.image-full-spec" . -}}" + # "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http diff --git a/.helm/siibra-api-v4-server/values.yaml b/.helm/siibra-api-v4-server/values.yaml index d00fc20..1c0fa5f 100644 --- a/.helm/siibra-api-v4-server/values.yaml +++ b/.helm/siibra-api-v4-server/values.yaml @@ -13,6 +13,7 @@ image: pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: 0.3-server + spec: 0.3-server imagePullSecrets: [] nameOverride: "" diff --git a/.helm/siibra-api-v4-worker/Chart.yaml b/.helm/siibra-api-v4-worker/Chart.yaml index f90d387..36fdf12 100644 --- a/.helm/siibra-api-v4-worker/Chart.yaml +++ b/.helm/siibra-api-v4-worker/Chart.yaml @@ -21,4 +21,4 @@ version: 0.1.0 # 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.3.22-rc" +appVersion: "0.3.22" diff --git a/.helm/siibra-api-v4-worker/templates/deployment.yaml b/.helm/siibra-api-v4-worker/templates/deployment.yaml index a6bd825..0a34b0a 100644 --- a/.helm/siibra-api-v4-worker/templates/deployment.yaml +++ b/.helm/siibra-api-v4-worker/templates/deployment.yaml @@ -34,7 +34,8 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{ include "siibra-api-v4-worker.image-full-spec" . }}" + # "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{ if .Values.sapi.worker }} command: ["celery"] diff --git a/api/server/volumes/parcellationmap.py b/api/server/volumes/parcellationmap.py index eac6219..290b20f 100644 --- a/api/server/volumes/parcellationmap.py +++ b/api/server/volumes/parcellationmap.py @@ -31,7 +31,7 @@ @router.get("", response_model=MapModel, deprecated=True) @version(*FASTAPI_VERSION) @router_decorator(ROLE, func=old_get_map) -def get_siibra_map(parcellation_id: str, space_id: str, map_type: MapType, name: str= "", *, func): +def get_siibra_map(parcellation_id: str, space_id: str, map_type: MapType, *, func): """Get map according to specification. Deprecated. use /maps/{map_id} instead."""