diff --git a/.gitignore b/.gitignore index 8a7afc1..67fcc22 100644 --- a/.gitignore +++ b/.gitignore @@ -176,3 +176,4 @@ node_modules/ # helm charts **/charts/ **/Chart.lock +*.tgz diff --git a/README.md b/README.md index 6065574..2e74868 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -EO Catalog logo +EO Catalog logo --- EO Catalog, a eoAPI customization. diff --git a/deploy/helm/eocatalog/Chart.yaml b/deploy/helm/eocatalog/Chart.yaml index 91d0b6a..fc027b4 100644 --- a/deploy/helm/eocatalog/Chart.yaml +++ b/deploy/helm/eocatalog/Chart.yaml @@ -1,9 +1,10 @@ apiVersion: v2 +type: application dependencies: - condition: postgresql.enabled name: postgresql repository: oci://registry-1.docker.io/bitnamicharts - version: 15.x.x + version: 16.7.4 - condition: redis.enabled name: redis repository: oci://registry-1.docker.io/bitnamicharts @@ -14,10 +15,10 @@ dependencies: - bitnami-common version: 2.x description: A CS Group Earth Observation solution. -home: https://github.com/csgroup-oss/eo-catalogue -icon: https://github.com/csgroup-oss/eo-catalogue/-/blob/main/docs/static/eo-catalogue-logo-1080.webp -name: eo-catalogue +home: https://github.com/csgroup-oss/eo-catalog +icon: https://github.com/csgroup-oss/eo-catalog/-/blob/main/docs/static/eo-catalog-logo-1080.webp +name: eo-catalog sources: - - https://github.com/csgroup-oss/eo-catalogue -type: application -version: 0.10.0 + - https://github.com/csgroup-oss/eo-catalog +version: 0.3.4 +appVersion: 0.2.2 diff --git a/deploy/helm/eocatalog/README.md b/deploy/helm/eocatalog/README.md index 9436ed6..ba50ec1 100644 --- a/deploy/helm/eocatalog/README.md +++ b/deploy/helm/eocatalog/README.md @@ -193,7 +193,7 @@ All components are removed except the PrivateVolumeClaim if you use a persistent | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------- | | `postgresql.enabled` | Switch to enable or disable the PostgreSQL helm chart | `true` | | `postgresql.auth.postgresPassword` | Password for the "postgres" admin user. Ignored if `auth.existingSecret` with key `postgres-password` is provided | `""` | -| `postgresql.auth.username` | Name for a custom user to create | `eo-catalogue` | +| `postgresql.auth.username` | Name for a custom user to create | `eo-catalog` | | `postgresql.auth.password` | Password for the custom user to create | `""` | | `postgresql.auth.database` | Name for a custom database to create | `postgis` | | `postgresql.auth.existingSecret` | Name of existing secret to use for PostgreSQL credentials | `""` | @@ -220,7 +220,7 @@ All components are removed except the PrivateVolumeClaim if you use a persistent | `externalDatabase.host` | Database host | `""` | | `externalDatabase.hostWriter` | Database host for write operations. Default to externalDatabase.host. Needed when externalDatabase.host is readonly | `""` | | `externalDatabase.port` | Database port number | `5432` | -| `externalDatabase.user` | Non-root username for EO Catalog STAC API | `eo-catalogue` | +| `externalDatabase.user` | Non-root username for EO Catalog STAC API | `eo-catalog` | | `externalDatabase.password` | Password for the non-root username for EO Catalog STAC API | `""` | | `externalDatabase.postgresPassword` | Password for the root username for EO Catalog STAC API | `""` | | `externalDatabase.database` | EO Catalog STAC API database name | `postgis` | diff --git a/deploy/helm/eocatalog/templates/_helpers.tpl b/deploy/helm/eocatalog/templates/_helpers.tpl index 1d9ef6e..1745e74 100644 --- a/deploy/helm/eocatalog/templates/_helpers.tpl +++ b/deploy/helm/eocatalog/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Create the name of the service account to use for the STAC API */}} -{{- define "eocatalogue.stac.serviceAccountName" -}} +{{- define "eocatalog.stac.serviceAccountName" -}} {{- if .Values.stac.serviceAccount.create -}} {{ default (printf "%s-stac-api" (include "common.names.fullname" .)) .Values.stac.serviceAccount.name | trunc 63 | trimSuffix "-" }} {{- else -}} @@ -12,15 +12,15 @@ Create the name of the service account to use for the STAC API {{/* Return the proper Docker Image Registry Secret Names */}} -{{- define "eocatalogue.imagePullSecrets" -}} +{{- define "eocatalog.imagePullSecrets" -}} {{- include "common.images.pullSecrets" (dict "images" (list .Values.stac.image) "global" .Values.global) -}} {{- end -}} {{/* -Return the proper service name for EO Catalogue STAC API +Return the proper service name for EO catalog STAC API We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "eocatalogue.stac" -}} +{{- define "eocatalog.stac" -}} {{- printf "%s-stac-api" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -28,43 +28,43 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this Create a default fully qualified app name for PostgreSQL We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "eocatalogue.postgresql.fullname" -}} +{{- define "eocatalog.postgresql.fullname" -}} {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Return the Database hostname */}} -{{- define "eocatalogue.databaseHost" -}} +{{- define "eocatalog.databaseHost" -}} {{- if eq .Values.postgresql.architecture "replication" -}} -{{- ternary (include "eocatalogue.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled -}}-primary +{{- ternary (include "eocatalog.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled -}}-primary {{- else -}} -{{- ternary (include "eocatalogue.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled -}} +{{- ternary (include "eocatalog.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled -}} {{- end -}} {{- end -}} {{/* Return the Database hostname */}} -{{- define "eocatalogue.databaseHostWriter" -}} +{{- define "eocatalog.databaseHostWriter" -}} {{- if and (not .Values.postgresql.enabled) .Values.externalDatabase.hostWriter -}} {{ .Values.externalDatabase.hostWriter }} {{- else -}} - {{ (include "eocatalogue.databaseHost" .)}} + {{ (include "eocatalog.databaseHost" .)}} {{- end -}} {{- end -}} {{/* Return the Database port */}} -{{- define "eocatalogue.databasePort" -}} +{{- define "eocatalog.databasePort" -}} {{- ternary "5432" .Values.externalDatabase.port .Values.postgresql.enabled | quote -}} {{- end -}} {{/* Return the Database database name */}} -{{- define "eocatalogue.databaseName" -}} +{{- define "eocatalog.databaseName" -}} {{- if .Values.postgresql.enabled -}} {{- if .Values.global.postgresql -}} {{- if .Values.global.postgresql.auth -}} @@ -83,7 +83,7 @@ Return the Database database name {{/* Return the Database user */}} -{{- define "eocatalogue.databaseUser" -}} +{{- define "eocatalog.databaseUser" -}} {{- if .Values.postgresql.enabled -}} {{- if .Values.global.postgresql -}} {{- if .Values.global.postgresql.auth -}} @@ -102,20 +102,20 @@ Return the Database user {{/* Return the Database encrypted password */}} -{{- define "eocatalogue.databaseSecretName" -}} +{{- define "eocatalog.databaseSecretName" -}} {{- if .Values.postgresql.enabled -}} {{- if .Values.global.postgresql -}} {{- if .Values.global.postgresql.auth -}} {{- if .Values.global.postgresql.auth.existingSecret -}} {{- tpl .Values.global.postgresql.auth.existingSecret $ -}} {{- else -}} - {{- default (include "eocatalogue.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} + {{- default (include "eocatalog.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} {{- end -}} {{- else -}} - {{- default (include "eocatalogue.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} + {{- default (include "eocatalog.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} {{- end -}} {{- else -}} - {{- default (include "eocatalogue.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} + {{- default (include "eocatalog.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} {{- end -}} {{- else -}} {{- default (printf "%s-externaldb" .Release.Name) (tpl .Values.externalDatabase.existingSecret $) -}} @@ -125,7 +125,7 @@ Return the Database encrypted password {{/* Add environment variables to configure database values */}} -{{- define "eocatalogue.databaseSecretKey" -}} +{{- define "eocatalog.databaseSecretKey" -}} {{- if .Values.postgresql.enabled -}} {{- print "password" -}} {{- else -}} @@ -141,7 +141,7 @@ Add environment variables to configure database values {{- end -}} {{- end -}} -{{- define "eocatalogue.databaseSecretPostgresKey" -}} +{{- define "eocatalog.databaseSecretPostgresKey" -}} {{- if .Values.postgresql.enabled -}} {{- print "postgres-password" -}} {{- else -}} @@ -161,31 +161,31 @@ Add environment variables to configure database values Create a default fully qualified redis name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "eocatalogue.redis.fullname" -}} +{{- define "eocatalog.redis.fullname" -}} {{- include "common.names.dependency.fullname" (dict "chartName" "redis" "chartValues" .Values.redis "context" $) -}} {{- end -}} {{/* Return the Redis® secret name */}} -{{- define "eocatalogue.redis.secretName" -}} +{{- define "eocatalog.redis.secretName" -}} {{- if .Values.redis.enabled }} {{- if .Values.redis.auth.existingSecret }} {{- printf "%s" .Values.redis.auth.existingSecret -}} {{- else -}} - {{- printf "%s" (include "eocatalogue.redis.fullname" .) }} + {{- printf "%s" (include "eocatalog.redis.fullname" .) }} {{- end -}} {{- else if .Values.externalRedis.existingSecret }} {{- printf "%s" .Values.externalRedis.existingSecret -}} {{- else -}} - {{- printf "%s-redis" (include "eocatalogue.redis.fullname" .) -}} + {{- printf "%s-redis" (include "eocatalog.redis.fullname" .) -}} {{- end -}} {{- end -}} {{/* Return the Redis® secret key */}} -{{- define "eocatalogue.redis.secretPasswordKey" -}} +{{- define "eocatalog.redis.secretPasswordKey" -}} {{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }} {{- .Values.redis.auth.existingSecretPasswordKey | printf "%s" }} {{- else if and (not .Values.redis.enabled) .Values.externalRedis.existingSecret }} @@ -198,7 +198,7 @@ Return the Redis® secret key {{/* Return whether Redis® uses password authentication or not */}} -{{- define "eocatalogue.redis.auth.enabled" -}} +{{- define "eocatalog.redis.auth.enabled" -}} {{- if or (and .Values.redis.enabled .Values.redis.auth.enabled) (and (not .Values.redis.enabled) (or .Values.externalRedis.password .Values.externalRedis.existingSecret)) }} {{- true -}} {{- end -}} @@ -207,7 +207,7 @@ Return whether Redis® uses password authentication or not {{/* Return whether Redis® uses password authentication or not */}} -{{- define "eocatalogue.redis.tlsEnabled" -}} +{{- define "eocatalog.redis.tlsEnabled" -}} {{- if or (and .Values.redis.enabled .Values.redis.tls.enabled) (and (not .Values.redis.enabled) (or .Values.externalRedis.tlsEnabled)) }} {{- "true" | quote -}} {{- else -}} @@ -218,9 +218,9 @@ Return whether Redis® uses password authentication or not {{/* Return the Redis® hostname */}} -{{- define "eocatalogue.redisHost" -}} +{{- define "eocatalog.redisHost" -}} {{- if .Values.redis.enabled }} - {{- printf "%s-master" (include "eocatalogue.redis.fullname" .) -}} + {{- printf "%s-master" (include "eocatalog.redis.fullname" .) -}} {{- else -}} {{- required "If the redis dependency is disabled you need to add an external redis host" .Values.externalRedis.host -}} {{- end -}} @@ -229,7 +229,7 @@ Return the Redis® hostname {{/* Return the Redis® port */}} -{{- define "eocatalogue.redisPort" -}} +{{- define "eocatalog.redisPort" -}} {{- if .Values.redis.enabled }} {{- .Values.redis.service.port -}} {{- else -}} @@ -240,18 +240,18 @@ Return the Redis® port {{/* Get the client secret for the STAC API OpenID Connect authentication. */}} -{{- define "eocatalogue.stac.clientSecretName" -}} +{{- define "eocatalog.stac.clientSecretName" -}} {{- if .Values.stac.oidc.existingSecret.name }} {{- printf "%s" (tpl .Values.stac.oidc.existingSecret.name $) -}} {{- else -}} - {{- printf "%s-oidc" (include "eocatalogue.stac" .) -}} + {{- printf "%s-oidc" (include "eocatalog.stac" .) -}} {{- end -}} {{- end -}} {{/* Get the client secret key for the STAC API OpenID Connect authentication. */}} -{{- define "eocatalogue.stac.clientSecretKey" -}} +{{- define "eocatalog.stac.clientSecretKey" -}} {{- if .Values.stac.oidc.existingSecret.key }} {{- printf "%s" (tpl .Values.stac.oidc.existingSecret.key $) -}} {{- else -}} @@ -261,9 +261,9 @@ Get the client secret key for the STAC API OpenID Connect authentication. {{/* Validate values of EO API - database */}} -{{- define "eocatalogue.validateValues.database" -}} +{{- define "eocatalog.validateValues.database" -}} {{- if and (not .Values.postgresql.enabled) (not .Values.externalDatabase.host) (and (not .Values.externalDatabase.password) (not .Values.externalDatabase.existingSecret)) -}} -eocatalogue: database +eocatalog: database You disabled the PostgreSQL sub-chart but did not specify an external PostgreSQL host. Either deploy the PostgreSQL sub-chart (--set postgresql.enabled=true), or set a value for the external database host (--set externalDatabase.host=FOO) @@ -275,7 +275,7 @@ eocatalogue: database {{/* Validate Redis config */}} -{{- define "eocatalogue.validateValues.redis" -}} +{{- define "eocatalog.validateValues.redis" -}} {{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }} {{- if not .Values.redis.auth.existingSecretPasswordKey -}} EO Catalog: You need to provide existingSecretPasswordKey when an existingSecret is specified in redis dependency @@ -290,7 +290,7 @@ EO Catalog: You need to provide existingSecretPasswordKey when an existingSecret {{/* Validate external Redis config */}} -{{- define "eocatalogue.validateValues.externalRedis" -}} +{{- define "eocatalog.validateValues.externalRedis" -}} {{- if not .Values.redis.enabled -}} EO Catalog: If the redis dependency is disabled you need to add an external redis port {{- end -}} @@ -299,11 +299,11 @@ EO Catalog: If the redis dependency is disabled you need to add an external redi {{/* Compile all warnings into a single message. */}} -{{- define "eocatalogue.validateValues" -}} +{{- define "eocatalog.validateValues" -}} {{- $messages := list -}} -{{- $messages := append $messages (include "eocatalogue.validateValues.database" .) -}} -{{- $messages := append $messages (include "eocatalogue.validateValues.externalRedis" .) -}} -{{- $messages := append $messages (include "eocatalogue.validateValues.redis" .) -}} +{{- $messages := append $messages (include "eocatalog.validateValues.database" .) -}} +{{- $messages := append $messages (include "eocatalog.validateValues.externalRedis" .) -}} +{{- $messages := append $messages (include "eocatalog.validateValues.redis" .) -}} {{- $messages := without $messages "" -}} {{- $message := join "\n" $messages -}} {{- end -}} diff --git a/deploy/helm/eocatalog/templates/stac/deployment.yaml b/deploy/helm/eocatalog/templates/stac/deployment.yaml index 8708ea1..8df444f 100644 --- a/deploy/helm/eocatalog/templates/stac/deployment.yaml +++ b/deploy/helm/eocatalog/templates/stac/deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "eocatalogue.stac" . }} + name: {{ include "eocatalog.stac" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: stac-api @@ -31,8 +31,8 @@ spec: annotations: {{- include "common.tplvalues.render" (dict "value" .Values.stac.podAnnotations "context" $) | nindent 8 }} {{- end }} spec: - serviceAccountName: {{ include "eocatalogue.stac.serviceAccountName" . }} - {{- include "eocatalogue.imagePullSecrets" . | nindent 6 }} + serviceAccountName: {{ include "eocatalog.stac.serviceAccountName" . }} + {{- include "eocatalog.imagePullSecrets" . | nindent 6 }} {{- if .Values.stac.hostAliases }} hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.stac.hostAliases "context" $) | nindent 8 }} {{- end }} @@ -91,7 +91,7 @@ spec: . /opt/bitnami/scripts/libos.sh . /opt/bitnami/scripts/liblog.sh check_redis_connection() { - local result="$(redis-cli -h {{ include "eocatalogue.redisHost" . }} -p {{ include "eocatalogue.redisPort" . }} {{ .Values.stac.redisWait.extraArgs }} PING)" + local result="$(redis-cli -h {{ include "eocatalog.redisHost" . }} -p {{ include "eocatalog.redisPort" . }} {{ .Values.stac.redisWait.extraArgs }} PING)" if [[ "$result" != "PONG" ]]; then false fi @@ -103,13 +103,13 @@ spec: else info "Connected to the Redis instance" fi - {{- if include "eocatalogue.redis.auth.enabled" . }} + {{- if include "eocatalog.redis.auth.enabled" . }} env: - name: REDISCLI_AUTH valueFrom: secretKeyRef: - name: {{ include "eocatalogue.redis.secretName" . }} - key: {{ include "eocatalogue.redis.secretPasswordKey" . }} + name: {{ include "eocatalog.redis.secretName" . }} + key: {{ include "eocatalog.redis.secretPasswordKey" . }} {{- end }} {{- end }} {{- if .Values.stac.initDb }} @@ -121,36 +121,41 @@ spec: - -c - | set -xe - pypgstac pgready && pypgstac migrate + PGPASSWORD=${PGPASSWORD} pypgstac pgready && PGPASSWORD=${PGPASSWORD} pypgstac migrate + PGPASSWORD=${PGPASSWORD} psql -U postgres -c "GRANT pgstac_admin to \"${POSTGRES_DBUSER}\";" + PGPASSWORD=${PGPASSWORD} psql -U postgres -c "ALTER DATABASE \"${POSTGRES_DBNAME}\" SET search_path TO pgstac, public;" + PGPASSWORD=${PGPASSWORD} psql -U postgres -c "ALTER DATABASE \"${POSTGRES_DBNAME}\" SET default_text_search_config TO english;" env: - name: PGUSER value: postgres - name: PGPASSWORD valueFrom: secretKeyRef: - name: {{ include "eocatalogue.databaseSecretName" . }} - key: {{ include "eocatalogue.databaseSecretPostgresKey" . }} + name: {{ include "eocatalog.databaseSecretName" . }} + key: {{ include "eocatalog.databaseSecretPostgresKey" . }} - name: PGDATABASE - value: {{ include "eocatalogue.databaseName" . }} + value: {{ include "eocatalog.databaseName" . }} - name: PGPORT - value: {{ include "eocatalogue.databasePort" . }} + value: {{ include "eocatalog.databasePort" . }} - name: PGHOST - value: {{ include "eocatalogue.databaseHost" . }} + value: {{ include "eocatalog.databaseHost" . }} - name: POSTGRES_USER value: postgres - name: POSTGRES_PASS valueFrom: secretKeyRef: - name: {{ include "eocatalogue.databaseSecretName" . }} - key: {{ include "eocatalogue.databaseSecretPostgresKey" . }} + name: {{ include "eocatalog.databaseSecretName" . }} + key: {{ include "eocatalog.databaseSecretPostgresKey" . }} - name: POSTGRES_HOST_READER - value: {{ include "eocatalogue.databaseHost" . }} + value: {{ include "eocatalog.databaseHost" . }} - name: POSTGRES_HOST_WRITER - value: {{ include "eocatalogue.databaseHost" . }} + value: {{ include "eocatalog.databaseHostWriter" . }} - name: POSTGRES_PORT - value: {{ include "eocatalogue.databasePort" . }} + value: {{ include "eocatalog.databasePort" . }} - name: POSTGRES_DBNAME - value: {{ include "eocatalogue.databaseName" . }} + value: {{ include "eocatalog.databaseName" . }} + - name: POSTGRES_DBUSER + value: {{ include "eocatalog.databaseUser" . }} {{- end }} containers: - name: stac-api @@ -231,20 +236,20 @@ spec: - name: REQUEST_TIMEOUT value: {{ .Values.stac.requestTimeout | quote }} - name: POSTGRES_USER - value: {{ include "eocatalogue.databaseUser" . }} + value: {{ include "eocatalog.databaseUser" . }} - name: POSTGRES_PASS valueFrom: secretKeyRef: - name: {{ include "eocatalogue.databaseSecretName" . }} - key: {{ include "eocatalogue.databaseSecretKey" . }} + name: {{ include "eocatalog.databaseSecretName" . }} + key: {{ include "eocatalog.databaseSecretKey" . }} - name: POSTGRES_HOST_READER - value: {{ include "eocatalogue.databaseHost" . }} + value: {{ include "eocatalog.databaseHost" . }} - name: POSTGRES_HOST_WRITER - value: {{ include "eocatalogue.databaseHostWriter" . }} + value: {{ include "eocatalog.databaseHostWriter" . }} - name: POSTGRES_PORT - value: {{ include "eocatalogue.databasePort" . }} + value: {{ include "eocatalog.databasePort" . }} - name: POSTGRES_DBNAME - value: {{ include "eocatalogue.databaseName" . }} + value: {{ include "eocatalog.databaseName" . }} - name: DB_MIN_CONN_SIZE value: {{ .Values.stac.dbConnectionSize.min | quote }} - name: DB_MAX_CONN_SIZE @@ -254,16 +259,16 @@ spec: - name: REDIS_CLUSTER value: {{ .Values.stac.redisCluster | quote }} - name: REDIS_HOSTNAME - value: {{ include "eocatalogue.redisHost" . }} + value: {{ include "eocatalog.redisHost" . }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: {{ include "eocatalogue.redis.secretName" . }} - key: {{ include "eocatalogue.redis.secretPasswordKey" . }} + name: {{ include "eocatalog.redis.secretName" . }} + key: {{ include "eocatalog.redis.secretPasswordKey" . }} - name: REDIS_PORT - value: {{ include "eocatalogue.redisPort" . | quote }} + value: {{ include "eocatalog.redisPort" . | quote }} - name: REDIS_SSL - value: {{ include "eocatalogue.redis.tlsEnabled" . }} + value: {{ include "eocatalog.redis.tlsEnabled" . }} - name: REDIS_TTL value: {{ .Values.stac.redisTTL | quote }} - name: OTEL_ENABLED diff --git a/deploy/helm/eocatalog/templates/stac/extra-list.yaml b/deploy/helm/eocatalog/templates/stac/extra-list.yaml new file mode 100644 index 0000000..9ac65f9 --- /dev/null +++ b/deploy/helm/eocatalog/templates/stac/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/deploy/helm/eocatalog/templates/stac/hpa.yaml b/deploy/helm/eocatalog/templates/stac/hpa.yaml index 0c7f48d..899d09b 100644 --- a/deploy/helm/eocatalog/templates/stac/hpa.yaml +++ b/deploy/helm/eocatalog/templates/stac/hpa.yaml @@ -5,7 +5,7 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "eocatalogue.stac" . }} + name: {{ include "eocatalog.stac" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} @@ -18,7 +18,7 @@ spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "eocatalogue.stac" . }} + name: {{ include "eocatalog.stac" . }} minReplicas: {{ .Values.stac.replicaCount }} maxReplicas: {{ .Values.stac.horizontalPodAutoscaler.maxReplicas }} metrics: diff --git a/deploy/helm/eocatalog/templates/stac/ingress.yaml b/deploy/helm/eocatalog/templates/stac/ingress.yaml index 11dd2ea..27cefc2 100644 --- a/deploy/helm/eocatalog/templates/stac/ingress.yaml +++ b/deploy/helm/eocatalog/templates/stac/ingress.yaml @@ -2,24 +2,17 @@ apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} kind: Ingress metadata: - name: {{ include "eocatalogue.stac" . }} + name: {{ include "eocatalog.stac" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: stac-api - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }} - {{- end }} - {{- if or .Values.stac.ingress.annotations .Values.commonAnnotations }} annotations: - {{- if .Values.stac.ingress.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.stac.ingress.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} + {{- if or .Values.stac.ingress.annotations .Values.commonAnnotations }} + {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.stac.ingress.annotations .Values.commonAnnotations ) "context" . ) }} + {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} - {{- end }} spec: - {{- if and .Values.stac.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }} + {{- if .Values.stac.ingress.ingressClassName }} ingressClassName: {{ .Values.stac.ingress.ingressClassName | quote }} {{- end }} rules: @@ -31,20 +24,16 @@ spec: {{- toYaml .Values.stac.ingress.extraPaths | nindent 10 }} {{- end }} - path: {{ .Values.stac.ingress.path }} - {{- if eq "true" (include "common.ingress.supportsPathType" .) }} pathType: {{ .Values.stac.ingress.pathType }} - {{- end }} - backend: {{- include "common.ingress.backend" (dict "serviceName" (include "eocatalogue.stac" .) "servicePort" "http" "context" $) | nindent 14 }} - {{- end }} + backend: {{- include "common.ingress.backend" (dict "serviceName" (include "eocatalog.stac" .) "servicePort" "http" "context" $) | nindent 14 }} + {{- end }} {{- range .Values.stac.ingress.extraHosts }} - host: {{ .name | quote }} http: paths: - path: {{ default "/" .path }} - {{- if eq "true" (include "common.ingress.supportsPathType" $) }} pathType: {{ default "ImplementationSpecific" .pathType }} - {{- end }} - backend: {{- include "common.ingress.backend" (dict "serviceName" (include "eocatalogue.stac" $) "servicePort" "http" "context" $) | nindent 14 }} + backend: {{- include "common.ingress.backend" (dict "serviceName" (include "eocatalog.stac" $) "servicePort" "http" "context" $) | nindent 14 }} {{- end }} {{- if .Values.stac.ingress.extraRules }} {{- include "common.tplvalues.render" (dict "value" .Values.stac.ingress.extraRules "context" $) | nindent 4 }} @@ -60,4 +49,4 @@ spec: {{- include "common.tplvalues.render" (dict "value" .Values.stac.ingress.extraTls "context" $) | nindent 4 }} {{- end }} {{- end }} -{{- end -}} +{{- end }} \ No newline at end of file diff --git a/deploy/helm/eocatalog/templates/stac/service.yaml b/deploy/helm/eocatalog/templates/stac/service.yaml index 9f123a4..4187ae9 100644 --- a/deploy/helm/eocatalog/templates/stac/service.yaml +++ b/deploy/helm/eocatalog/templates/stac/service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "eocatalogue.stac" . }} + name: {{ include "eocatalog.stac" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: stac-api diff --git a/deploy/helm/eocatalog/templates/stac/serviceaccount.yaml b/deploy/helm/eocatalog/templates/stac/serviceaccount.yaml index aa8a8bf..c5d0380 100644 --- a/deploy/helm/eocatalog/templates/stac/serviceaccount.yaml +++ b/deploy/helm/eocatalog/templates/stac/serviceaccount.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount automountServiceAccountToken: {{ .Values.stac.serviceAccount.automountServiceAccountToken }} metadata: - name: {{ include "eocatalogue.stac.serviceAccountName" . }} + name: {{ include "eocatalog.stac.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: stac-api diff --git a/deploy/helm/eocatalog/values.yaml b/deploy/helm/eocatalog/values.yaml index 364f98c..eae651c 100644 --- a/deploy/helm/eocatalog/values.yaml +++ b/deploy/helm/eocatalog/values.yaml @@ -618,12 +618,13 @@ postgresql: enabled: true auth: postgresPassword: "" - username: eo-catalogue + username: eo-catalog password: "" database: postgis existingSecret: "" architecture: standalone primary: + automountServiceAccountToken: true initdb: scripts: init.sql: | @@ -692,7 +693,7 @@ externalDatabase: host: "" hostWriter: "" port: 5432 - user: eo-catalogue + user: eo-catalog database: postgis password: "" postgresPassword: "" diff --git a/dockerfiles/Dockerfile.stac b/dockerfiles/Dockerfile.stac index 423c31b..265bb75 100644 --- a/dockerfiles/Dockerfile.stac +++ b/dockerfiles/Dockerfile.stac @@ -4,10 +4,10 @@ FROM python:${PYTHON_VERSION}-slim ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt -RUN apt update && apt install git -y +RUN apt update && apt install git postgresql-client -y COPY runtimes/eoapi/stac /tmp/stac -RUN python -m pip install /tmp/stac[server,telemetry,redis] +RUN python -m pip install /tmp/stac[server,telemetry,redis] pypgstac[psycopg] RUN rm -rf /tmp/stac ENV MODULE_NAME eoapi.stac.app diff --git a/docs/static/eo-catalogue-logo-1080.webp b/docs/static/eo-catalog-logo-1080.webp similarity index 100% rename from docs/static/eo-catalogue-logo-1080.webp rename to docs/static/eo-catalog-logo-1080.webp diff --git a/runtimes/eoapi/stac/eoapi/stac/config.py b/runtimes/eoapi/stac/eoapi/stac/config.py index 39fde4b..23c1434 100644 --- a/runtimes/eoapi/stac/eoapi/stac/config.py +++ b/runtimes/eoapi/stac/eoapi/stac/config.py @@ -26,6 +26,8 @@ class Settings(BaseSettings): redis_port: int = 6379 redis_ssl: bool = True + stac_fastapi_landing_id: str = "eo-catalog-stac" + eoapi_auth_metadata_field: str = "scope" eoapi_auth_update_scope: str = "admin" diff --git a/runtimes/eoapi/stac/eoapi/stac/redis.py b/runtimes/eoapi/stac/eoapi/stac/redis.py index b2df3ed..878aadf 100644 --- a/runtimes/eoapi/stac/eoapi/stac/redis.py +++ b/runtimes/eoapi/stac/eoapi/stac/redis.py @@ -82,6 +82,9 @@ async def cached_result( settings: Settings = request.app.state.settings r: Redis + # Add a prefix to the cache key to avoid collisions between different instances + cache_key = f"{settings.stac_fastapi_landing_id}:{cache_key}" + # GET key from cache try: r = request.app.state.redis