diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml index 20045456..0daf4f87 100644 --- a/.github/workflows/helm-tests.yml +++ b/.github/workflows/helm-tests.yml @@ -1,5 +1,6 @@ name: CI + # On every pull request, but only on push to main on: push: @@ -35,16 +36,25 @@ jobs: - uses: azure/setup-helm@v3 with: - helm-version: v3.8.2 - github-token: ${{ secrets.GITHUB_TOKEN }} + version: v3.8.2 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: last commit sha if PR + if: ${{ github.event_name == 'pull_request' }} + shell: bash + run: | + echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV} + + - name: last commit sha if push + if: ${{ github.event_name == 'push' }} + shell: bash + run: | + echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV} - - name: set k8s namespace name for parallel tests + - name: set k8s .release.name suffix run: | - random_number="${RANDOM}${RANDOM}${RANDOM}" - # Limit it to 10 digits - RANDOMNESS=$(echo $random_number | cut -c 1-10) - #echo "NS_NAME=unittest-$RANDOMNESS" >> $GITHUB_ENV - echo "NS_NAME=eoapitest" >> $GITHUB_ENV + RANDOMNESS=$(echo $LAST_COMMIT_SHA | cut -c 1-6) + echo "RELEASE_NAME=eoapi$RANDOMNESS" >> $GITHUB_ENV - id: 'auth' uses: 'google-github-actions/auth@v1' @@ -57,8 +67,6 @@ jobs: with: version: '>= 363.0.0' project_id: 'devseed-labs' - service_account_key: ${{ secrets.GH_ACTIONS_SA_TOKEN }} - export_default_credentials: true - name: configure kubectl context run: | @@ -75,18 +83,19 @@ jobs: cd helm-chart - helm install \ - --namespace $NS_NAME \ - --create-namespace \ - --set gitSha=$GITSHA \ - --set db.settings.secrets.PGUSER=$PGUSER \ - --set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \ - --set db.settings.secrets.PGPASSWORD=$PGPASSWORD \ - --set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ - -f ./eoapi/values.yaml \ - -f ./eoapi/test-unittest-values.yaml \ - eoapi \ - ./eoapi + helm install $RELEASE_NAME \ + --namespace eoapitest \ + --create-namespace \ + --set db.settings.secrets.POSTGRES_HOST=pgstac-$RELEASE_NAME \ + --set db.settings.secrets.POSTGRES_HOST_READER=pgstac-$RELEASE_NAME \ + --set db.settings.secrets.POSTGRES_HOST_WRITER=pgstac-$RELEASE_NAME \ + --set db.settings.secrets.PGUSER=$PGUSER \ + --set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \ + --set db.settings.secrets.PGPASSWORD=$PGPASSWORD \ + --set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ + -f ./eoapi/values.yaml \ + -f ./eoapi/test-unittest-values.yaml \ + ./eoapi - name: sleep for 10s seconds while services boot shell: bash @@ -94,18 +103,18 @@ jobs: - name: restart the services run: | - kubectl config set-context --current --namespace=$NS_NAME - while [[ -z "$(kubectl get pod | grep '^raster-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do + kubectl config set-context --current --namespace=eoapitest + while [[ -z "$(kubectl get pod | grep "^raster-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do echo "still waiting for raster service to start..." sleep 1 done echo "raster service has started, moving on..." - while [[ -z "$(kubectl get pod | grep '^vector-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do + while [[ -z "$(kubectl get pod | grep "^vector-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do echo "still waiting for vector service to start..." sleep 1 done echo "vector service has started, moving on..." - while [[ -z "$(kubectl get pod | grep '^stac-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do + while [[ -z "$(kubectl get pod | grep "^stac-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do echo "still waiting for stac service to start..." sleep 1 done @@ -120,27 +129,28 @@ jobs: - name: run the tests run: | - kubectl config set-context --current --namespace=$NS_NAME + kubectl config set-context --current --namespace=eoapitest PUBLICIP='http://'$(kubectl -n ingress-nginx get svc/ingress-nginx-controller -o jsonpath='{.spec.loadBalancerIP}') echo '#################################' - echo $PUBLICIP + echo vector=$PUBLICIP/vector$RELEASE_NAME + echo stac=$PUBLICIP/stac$RELEASE_NAME + echo raster=$PUBLICIP/raster$RELEASE_NAME echo '#################################' # first substitute test endpoints in the test files # TODO: pytest should be able to have a pattern for injection here but moving fast - sed -i "s|vector_endpoint\=.*$|vector_endpoint\='$PUBLICIP/vector'|g" .github/workflows/tests/test_vector.py + sed -i "s|vector_endpoint\=.*$|vector_endpoint\='$PUBLICIP/vector$RELEASE_NAME'|g" .github/workflows/tests/test_vector.py head -n 5 .github/workflows/tests/test_vector.py pytest .github/workflows/tests/test_vector.py - sed -i "s|stac_endpoint\=.*$|stac_endpoint\='$PUBLICIP/stac'|g" .github/workflows/tests/test_stac.py + sed -i "s|stac_endpoint\=.*$|stac_endpoint\='$PUBLICIP/stac$RELEASE_NAME'|g" .github/workflows/tests/test_stac.py head -n 5 .github/workflows/tests/test_stac.py pytest .github/workflows/tests/test_stac.py - sed -i "s|raster_endpoint\=.*$|raster_endpoint\='$PUBLICIP/raster'|g" .github/workflows/tests/test_raster.py + sed -i "s|raster_endpoint\=.*$|raster_endpoint\='$PUBLICIP/raster$RELEASE_NAME'|g" .github/workflows/tests/test_raster.py head -n 5 .github/workflows/tests/test_raster.py pytest .github/workflows/tests/test_raster.py - name: helm uinstall eoapi templates run: | - helm uninstall eoapi - kubectl delete ns $NS_NAME + helm uninstall $RELEASE_NAME diff --git a/helm-chart/eoapi/CHANGELOG.md b/helm-chart/eoapi/CHANGELOG.md index 70d8d070..fe64e585 100644 --- a/helm-chart/eoapi/CHANGELOG.md +++ b/helm-chart/eoapi/CHANGELOG.md @@ -1,5 +1,10 @@ version numbers below correspond to helm chart `appVersion`: see ./helm-chart/eoapi/Chart.yaml --- +# 0.1.4 (2023-09-09) + +* adds a `testing: false` value to `values.yaml` +* plumb through `{{ $.Release.Name }}` into all the right templates so our CI can `helm install` into a single namespace and run tests in parallel + # 0.1.3 (2023-09-05) * test on GKE and add documentation where needed for [GKE template changes](https://github.com/developmentseed/eoapi-k8s/issues/29) diff --git a/helm-chart/eoapi/Chart.yaml b/helm-chart/eoapi/Chart.yaml index f976408c..420e92b9 100644 --- a/helm-chart/eoapi/Chart.yaml +++ b/helm-chart/eoapi/Chart.yaml @@ -17,10 +17,10 @@ kubeVersion: ">=1.23.0-0" # 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.1.5" +version: "0.1.6" # 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.1.3" +appVersion: "0.1.4" diff --git a/helm-chart/eoapi/rm-ci-releases.sh b/helm-chart/eoapi/rm-ci-releases.sh new file mode 100755 index 00000000..caee6eaf --- /dev/null +++ b/helm-chart/eoapi/rm-ci-releases.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# rm deploys (which will remove replicasets and pods) +kubectl get deploy | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete deploy/{} +# rm svc +kubectl get svc | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete svc/{} +# rm ingress +kubectl get ingress | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete ingress/{} +# rm pvc +kubectl get pvc | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete pvc/{} +# rm secrets +kubectl get secret | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete secret/{} +# rm configmap +kubectl get configmap | grep -v NAME | grep $1 | cut -d' ' -f1 | xargs -I{} kubectl delete configmap/{} diff --git a/helm-chart/eoapi/templates/_helpers.tpl b/helm-chart/eoapi/templates/_helpers.tpl index 0030d7c3..774e4e46 100644 --- a/helm-chart/eoapi/templates/_helpers.tpl +++ b/helm-chart/eoapi/templates/_helpers.tpl @@ -60,3 +60,17 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* + +Create pgstac host string depending if .Values.testing +*/}} +{{- define "eoapi.pgstacHostName" -}} +{{- if .Values.testing }} +{{- printf "%s-%s" "pgstac" .Release.Name }} +{{- else }} +{{/* need to match what is default in values.yamls */}} +{{- printf "%s" "pgstac" }} +{{- end }} +{{- end }} + diff --git a/helm-chart/eoapi/templates/db/configmap.yaml b/helm-chart/eoapi/templates/db/configmap.yaml index b5f29521..9ec2b2a5 100644 --- a/helm-chart/eoapi/templates/db/configmap.yaml +++ b/helm-chart/eoapi/templates/db/configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: initdb-sql-config + name: initdb-sql-config-{{ $.Release.Name }} data: initdb.sql: | {{- range $path, $bytes := $.Files.Glob "initdb-data/*.sql" -}} @@ -12,7 +12,7 @@ data: apiVersion: v1 kind: ConfigMap metadata: - name: initdb-json-config + name: initdb-json-config-{{ $.Release.Name }} data: {{- range $path, $bytes := $.Files.Glob "initdb-data/*.json" -}} {{- base $path | nindent 2 -}}: | {{- $.Files.Get $path | nindent 4 -}} @@ -21,7 +21,7 @@ data: apiVersion: v1 kind: ConfigMap metadata: - name: initdb-sh-config + name: initdb-sh-config-{{ $.Release.Name }} data: load.sh: | #!/bin/bash diff --git a/helm-chart/eoapi/templates/db/deployment.yaml b/helm-chart/eoapi/templates/db/deployment.yaml index 1735fe9c..7c58b069 100644 --- a/helm-chart/eoapi/templates/db/deployment.yaml +++ b/helm-chart/eoapi/templates/db/deployment.yaml @@ -2,19 +2,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: pgstac + name: {{ include "eoapi.pgstacHostName" . | nindent 8 }} labels: - app: pgstac + app: {{ include "eoapi.pgstacHostName" . | nindent 10 }} spec: selector: matchLabels: - app: pgstac + app: {{ include "eoapi.pgstacHostName" . | nindent 12 }} strategy: type: Recreate template: metadata: labels: - app: pgstac + app: {{ include "eoapi.pgstacHostName" . | nindent 14 }} spec: restartPolicy: Always containers: @@ -24,13 +24,13 @@ spec: {{- toYaml .Values.db.command | nindent 12 }} envFrom: - secretRef: - name: pgstac-secrets + name: pgstac-secrets-{{ $.Release.Name }} ports: - containerPort: 5432 {{- if not (eq .Values.providerContext "minikube") }} volumeMounts: - mountPath: /var/lib/postgresql/data - name: pgstac-claim + name: pgstac-claim-{{ $.Release.Name }} {{ end }} {{- if .Values.db.enable_data_fixtures }} - name: loader @@ -41,33 +41,33 @@ spec: - "/opt/initdb/load.sh" envFrom: - secretRef: - name: pgstac-secrets + name: pgstac-secrets-{{ $.Release.Name }} ports: - containerPort: 6543 volumeMounts: {{- if not (eq .Values.providerContext "minikube") }} - mountPath: /var/lib/postgresql/data - name: pgstac-claim + name: pgstac-claim-{{ $.Release.Name }} {{ end }} - mountPath: /opt/initdb/sql-data - name: initdb-sql-volume + name: initdb-sql-volume-{{ $.Release.Name }} - mountPath: /opt/initdb/json-data - name: initdb-json-volume + name: initdb-json-volume-{{ $.Release.Name }} - mountPath: /opt/initdb/ - name: initdb-sh-volume + name: initdb-sh-volume-{{ $.Release.Name }} {{- end }} volumes: {{- if not (eq .Values.providerContext "minikube") }} - - name: pgstac-claim + - name: pgstac-claim-{{ $.Release.Name }} persistentVolumeClaim: - claimName: pgstac-claim + claimName: pgstac-claim-{{ $.Release.Name }} {{- end }} - - name: initdb-sql-volume + - name: initdb-sql-volume-{{ $.Release.Name }} configMap: - name: initdb-sql-config - - name: initdb-json-volume + name: initdb-sql-config-{{ $.Release.Name }} + - name: initdb-json-volume-{{ $.Release.Name }} configMap: - name: initdb-json-config - - name: initdb-sh-volume + name: initdb-json-config-{{ $.Release.Name }} + - name: initdb-sh-volume-{{ $.Release.Name }} configMap: - name: initdb-sh-config + name: initdb-sh-config-{{ $.Release.Name }} diff --git a/helm-chart/eoapi/templates/db/pvc.yaml b/helm-chart/eoapi/templates/db/pvc.yaml index 021b5a7c..a28af8fc 100644 --- a/helm-chart/eoapi/templates/db/pvc.yaml +++ b/helm-chart/eoapi/templates/db/pvc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: pgstac-claim + name: pgstac-claim-{{ $.Release.Name }} spec: accessModes: - ReadWriteOnce diff --git a/helm-chart/eoapi/templates/db/secrets.yaml b/helm-chart/eoapi/templates/db/secrets.yaml index 347c5f91..246baf4b 100644 --- a/helm-chart/eoapi/templates/db/secrets.yaml +++ b/helm-chart/eoapi/templates/db/secrets.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: pgstac-secrets + name: pgstac-secrets-{{ $.Release.Name }} type: "Opaque" stringData: {{- range $envKey, $envValue := .Values.db.settings.secrets }} diff --git a/helm-chart/eoapi/templates/db/service.yaml b/helm-chart/eoapi/templates/db/service.yaml index 61c870b7..2854eba4 100644 --- a/helm-chart/eoapi/templates/db/service.yaml +++ b/helm-chart/eoapi/templates/db/service.yaml @@ -3,12 +3,12 @@ apiVersion: v1 kind: Service metadata: labels: - app: pgstac - name: pgstac + app: {{ include "eoapi.pgstacHostName" . | nindent 10 }} + name: {{ include "eoapi.pgstacHostName" . | nindent 8 }} spec: ports: - name: "5432" port: 5432 targetPort: 5432 selector: - app: pgstac \ No newline at end of file + app: {{ include "eoapi.pgstacHostName" . | nindent 10 }} diff --git a/helm-chart/eoapi/templates/services/configmap.yaml b/helm-chart/eoapi/templates/services/configmap.yaml index 96fe1f26..92be1d35 100644 --- a/helm-chart/eoapi/templates/services/configmap.yaml +++ b/helm-chart/eoapi/templates/services/configmap.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ $serviceName }}-envvar-configmap + name: {{ $serviceName }}-envvar-configmap-{{ $.Release.Name }} data: {{- range $envKey, $envValue := index $v "settings" "envVars" }} {{ upper $envKey }}: "{{ $envValue }}" diff --git a/helm-chart/eoapi/templates/services/deployment.yaml b/helm-chart/eoapi/templates/services/deployment.yaml index b93f2633..5f2795ff 100644 --- a/helm-chart/eoapi/templates/services/deployment.yaml +++ b/helm-chart/eoapi/templates/services/deployment.yaml @@ -5,9 +5,9 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: {{ $serviceName }} + app: {{ $serviceName }}-{{ $.Release.Name }} gitsha: {{ $.Values.gitSha }} - name: {{ $serviceName }} + name: {{ $serviceName }}-{{ $.Release.Name }} spec: progressDeadlineSeconds: 600 revisionHistoryLimit: 5 @@ -18,11 +18,11 @@ spec: maxUnavailable: 0 selector: matchLabels: - app: {{ $serviceName }} + app: {{ $serviceName }}-{{ $.Release.Name }} template: metadata: labels: - app: {{ $serviceName }} + app: {{ $serviceName }}-{{ $.Release.Name }} spec: containers: - image: {{ index $v "image" "name" }}:{{ index $v "image" "tag" }} @@ -32,9 +32,11 @@ spec: name: {{ $serviceName }} command: {{- toYaml (index $v "command") | nindent 10 }} - {{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "nginx")) }} + {{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "nginx") (not $.Values.testing)) }} - "--root-path=/{{ $serviceName }}" - {{- end }}{{/* needed for proxies and path rewrites on NLB */}} + {{- else if (and ($.Values.ingress.className) (eq $.Values.ingress.className "nginx") ($.Values.testing)) }} + - "--root-path=/{{ $serviceName }}{{ $.Release.Name }}" + {{- end }}{{/* needed for proxies and path rewrites on NLB */}} livenessProbe: httpGet: {{- if (eq $serviceName "stac") }} @@ -61,9 +63,9 @@ spec: # we could just template them out here immediately with `value: $_` but this allows us # to store them in k8s intermediately and change them and then bounce deploys if needed - secretRef: - name: pgstac-secrets + name: pgstac-secrets-{{ $.Release.Name }} - configMapRef: - name: {{ $serviceName }}-envvar-configmap + name: {{ $serviceName }}-envvar-configmap-{{ $.Release.Name }} --- {{/* END: if index $v "enabled" */}} {{- end }} diff --git a/helm-chart/eoapi/templates/services/ingress-nginx.yaml b/helm-chart/eoapi/templates/services/ingress-nginx.yaml index bc4af9d4..3debccc7 100644 --- a/helm-chart/eoapi/templates/services/ingress-nginx.yaml +++ b/helm-chart/eoapi/templates/services/ingress-nginx.yaml @@ -8,7 +8,7 @@ apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - name: nginx-service-ingress-shared + name: nginx-service-ingress-shared-{{ $.Release.Name }} annotations: nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/rewrite-target: /$2 @@ -22,7 +22,7 @@ spec: paths: {{- range $serviceName, $v := .Values }} {{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} - {{- if index $v "enabled" }} + {{- if (and (index $v "enabled") (not $.Values.testing)) }} - pathType: Prefix path: "/{{ $serviceName }}(/|$)(.*)" backend: @@ -30,9 +30,18 @@ spec: name: {{ $serviceName }} port: number: {{ $.Values.service.port }} + {{- else if (and (index $v "enabled") ($.Values.testing)) }} + - pathType: Prefix + path: "/{{ $serviceName }}{{ $.Release.Name }}(/|$)(.*)" + backend: + service: + name: {{ $serviceName }}-{{ $.Release.Name }} + port: + number: {{ $.Values.service.port }} {{- end }}{{/* END: if index $v "enabled" */}} {{- end }}{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} {{- end }}{{/* END: range $serviceName, $v := .Values*/}} + {{- if not $.Values.testing }} - pathType: Prefix path: /(/|$) backend: @@ -40,6 +49,7 @@ spec: name: doc-server port: number: 80 + {{- end }} --- {{/* END: if .Values.ingress.className "nginx" */}} {{- end }} \ No newline at end of file diff --git a/helm-chart/eoapi/templates/services/nginx-doc-server.yaml b/helm-chart/eoapi/templates/services/nginx-doc-server.yaml index e13737ac..706fd96a 100644 --- a/helm-chart/eoapi/templates/services/nginx-doc-server.yaml +++ b/helm-chart/eoapi/templates/services/nginx-doc-server.yaml @@ -1,4 +1,4 @@ -{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} +{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx") (not .Values.testing)) }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/helm-chart/eoapi/templates/services/service.yaml b/helm-chart/eoapi/templates/services/service.yaml index d3984872..07079516 100644 --- a/helm-chart/eoapi/templates/services/service.yaml +++ b/helm-chart/eoapi/templates/services/service.yaml @@ -4,9 +4,15 @@ apiVersion: v1 kind: Service metadata: + {{- if $.Values.testing }} + labels: + app: {{ $serviceName }}-{{ $.Release.Name }} + name: {{ $serviceName }}-{{ $.Release.Name }} + {{- else }} labels: app: {{ $serviceName }} name: {{ $serviceName }} + {{- end }} spec: {{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "alb")) }} type: "NodePort" @@ -20,7 +26,7 @@ spec: port: {{ $.Values.service.port }} targetPort: {{ $.Values.service.port }} selector: - app: {{ $serviceName }} + app: {{ $serviceName }}-{{ $.Release.Name }} --- {{/* END: if index $v "enabled" */}} {{- end }} diff --git a/helm-chart/eoapi/test-unittest-values.yaml b/helm-chart/eoapi/test-unittest-values.yaml index bfa1baa1..9ecd4a72 100644 --- a/helm-chart/eoapi/test-unittest-values.yaml +++ b/helm-chart/eoapi/test-unittest-values.yaml @@ -1,4 +1,5 @@ -# used in GH Actions `unit-tests.yml` +# used in GH Actions `.github/workflows/helm-tests.yml.jobs.unit-tests` +testing: true ingress: enabled: true className: "nginx" diff --git a/helm-chart/eoapi/tests/config_tests.yaml b/helm-chart/eoapi/tests/config_tests.yaml index 253b2972..6398b2f7 100644 --- a/helm-chart/eoapi/tests/config_tests.yaml +++ b/helm-chart/eoapi/tests/config_tests.yaml @@ -12,7 +12,7 @@ tests: of: ConfigMap - matchRegex: path: metadata.name - pattern: ^vector-envvar-configmap$ + pattern: ^vector-envvar-configmap-RELEASE-NAME$ - equal: path: data.TIPG_CATALOG_TTL value: "0" @@ -26,7 +26,7 @@ tests: of: ConfigMap - matchRegex: path: metadata.name - pattern: ^raster-envvar-configmap$ + pattern: ^raster-envvar-configmap-RELEASE-NAME$ - equal: path: data.GDAL_HTTP_MULTIPLEX value: "YES" @@ -40,7 +40,7 @@ tests: of: ConfigMap - matchRegex: path: metadata.name - pattern: ^stac-envvar-configmap$ + pattern: ^stac-envvar-configmap-RELEASE-NAME$ - equal: path: data.WEB_CONCURRENCY value: "10" diff --git a/helm-chart/eoapi/tests/db_deploy_tests.yaml b/helm-chart/eoapi/tests/db_deploy_tests.yaml index 7578e0ec..7ea8b7ee 100644 --- a/helm-chart/eoapi/tests/db_deploy_tests.yaml +++ b/helm-chart/eoapi/tests/db_deploy_tests.yaml @@ -20,6 +20,26 @@ tests: value: "pgstac" - isNull: path: spec.template.spec.containers[1].name + - it: "db deploy testing=true" + set: + testing: true + db.enabled: true + db.enable_data_fixtures: true + asserts: + - isKind: + of: Deployment + - matchRegex: + path: metadata.name + pattern: ^pgstac-RELEASE-NAME$ + - equal: + path: spec.strategy.type + value: "Recreate" + - equal: + path: spec.template.spec.containers[0].name + value: "pgstac" + - equal: + path: spec.template.spec.containers[1].name + value: "loader" - it: "db deploy with fixtures" set: db.enabled: true diff --git a/helm-chart/eoapi/tests/db_tests.yaml b/helm-chart/eoapi/tests/db_tests.yaml index dc57fd66..24d20a49 100644 --- a/helm-chart/eoapi/tests/db_tests.yaml +++ b/helm-chart/eoapi/tests/db_tests.yaml @@ -11,7 +11,7 @@ tests: of: Secret - matchRegex: path: metadata.name - pattern: ^pgstac-secrets$ + pattern: ^pgstac-secrets-RELEASE-NAME$ - equal: path: stringData.PGPASSWORD value: "foobar" diff --git a/helm-chart/eoapi/tests/deploy_tests.yaml b/helm-chart/eoapi/tests/deploy_tests.yaml index 90d23237..b9687aa4 100644 --- a/helm-chart/eoapi/tests/deploy_tests.yaml +++ b/helm-chart/eoapi/tests/deploy_tests.yaml @@ -12,7 +12,7 @@ tests: of: Deployment - matchRegex: path: metadata.name - pattern: ^vector$ + pattern: ^vector-RELEASE-NAME$ - equal: path: spec.strategy.type value: "RollingUpdate" @@ -41,7 +41,7 @@ tests: of: Deployment - matchRegex: path: metadata.name - pattern: ^raster$ + pattern: ^raster-RELEASE-NAME$ - equal: path: spec.strategy.type value: "RollingUpdate" @@ -70,7 +70,7 @@ tests: of: Deployment - matchRegex: path: metadata.name - pattern: ^stac$ + pattern: ^stac-RELEASE-NAME$ - equal: path: spec.strategy.type value: "RollingUpdate" diff --git a/helm-chart/eoapi/values.yaml b/helm-chart/eoapi/values.yaml index 9df10a26..f8491b3d 100644 --- a/helm-chart/eoapi/values.yaml +++ b/helm-chart/eoapi/values.yaml @@ -63,6 +63,9 @@ db: PGPASSWORD: "" PGDATABASE: "postgis" +# only used in CI for running parallel helm installs +testing: false + # deprecated: helm templates are only sniffing for "minikube" as of now providerContext: "ignore"