From f42aac11da6cee0a69371bd5c41894b57f1d02a3 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Fri, 10 Jul 2026 12:37:35 +0300 Subject: [PATCH 01/15] helm!: create unified chart --- .github/workflows/build-and-push.yaml | 1 + helm/pycsw/.helmignore | 26 ++ helm/pycsw/Chart.yaml | 13 + helm/pycsw/README.md | 107 ++++++++ helm/pycsw/config/log_format.conf | 81 ++++++ helm/pycsw/config/pycsw-location.conf | 6 + helm/pycsw/config/pycsw-server.conf | 10 + helm/pycsw/config/pycswWsgi.ini | 38 +++ helm/pycsw/templates/_helpers.tpl | 183 +++++++++++++ helm/pycsw/templates/_resources.tpl | 42 +++ helm/pycsw/templates/_tplValues.tpl | 54 ++++ helm/pycsw/templates/configmap.yaml | 33 +++ helm/pycsw/templates/deployment.yaml | 219 +++++++++++++++ .../templates/nginx/nginx-configmap.yaml | 18 ++ helm/pycsw/templates/service.yaml | 32 +++ .../uwsgi-exporter-container.yaml | 33 +++ helm/pycsw/values.yaml | 254 ++++++++++++++++++ release-please-config.json | 10 + 18 files changed, 1160 insertions(+) create mode 100644 helm/pycsw/.helmignore create mode 100644 helm/pycsw/Chart.yaml create mode 100644 helm/pycsw/README.md create mode 100644 helm/pycsw/config/log_format.conf create mode 100644 helm/pycsw/config/pycsw-location.conf create mode 100644 helm/pycsw/config/pycsw-server.conf create mode 100644 helm/pycsw/config/pycswWsgi.ini create mode 100644 helm/pycsw/templates/_helpers.tpl create mode 100644 helm/pycsw/templates/_resources.tpl create mode 100644 helm/pycsw/templates/_tplValues.tpl create mode 100644 helm/pycsw/templates/configmap.yaml create mode 100644 helm/pycsw/templates/deployment.yaml create mode 100644 helm/pycsw/templates/nginx/nginx-configmap.yaml create mode 100644 helm/pycsw/templates/service.yaml create mode 100644 helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml create mode 100644 helm/pycsw/values.yaml diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index 2f9f1f59..c87e30a7 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -46,6 +46,7 @@ jobs: - 3d - dem - raster + - pycsw steps: - name: Display matrix and index run: | diff --git a/helm/pycsw/.helmignore b/helm/pycsw/.helmignore new file mode 100644 index 00000000..0cb7b3bf --- /dev/null +++ b/helm/pycsw/.helmignore @@ -0,0 +1,26 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +*.txt +*local.json +*local.yaml diff --git a/helm/pycsw/Chart.yaml b/helm/pycsw/Chart.yaml new file mode 100644 index 00000000..88bcb4bd --- /dev/null +++ b/helm/pycsw/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: pycsw +description: Common Helm chart for pycsw service, consumed as a dependency by team deployment charts +type: application +version: 6.6.1 +appVersion: 6.6.1 +dependencies: + - name: nginx + version: 2.2.1 + repository: oci://acrarolibotnonprod.azurecr.io/helm/common + - name: mclabels + version: 1.0.1 + repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/pycsw/README.md b/helm/pycsw/README.md new file mode 100644 index 00000000..34360fc0 --- /dev/null +++ b/helm/pycsw/README.md @@ -0,0 +1,107 @@ +# pycsw common chart + +Common Helm chart for the MapColonies pycsw service. It is not deployed directly; +each team consumes it as a dependency from its own deployment repository and injects +its team-specific configuration. + +## Consuming the chart + +In your team deployment repo, create a thin wrapper chart (see `examples/team-wrapper` +in this repository for a complete working example): + +```yaml +# Chart.yaml +dependencies: + - name: pycsw + version: 6.6.1 + repository: oci://acrarolibotnonprod.azurecr.io/helm +``` + +## Team configuration contract + +The chart does **not** ship `pycsw.cfg` or `mappings.py` — these are team-specific. +Your wrapper chart must provide a ConfigMap containing both keys and pass its name +via `existingConfigmap` (the value may be a template): + +```yaml +# wrapper values.yaml +pycsw: + existingConfigmap: '{{ .Release.Name }}-pycsw-team-config' +``` + +```yaml +# wrapper templates/configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-pycsw-team-config +data: + pycsw.cfg: {{ tpl (.Files.Get "config/pycsw.cfg") . | quote }} + mappings.py: {{ .Files.Get "config/mappings.py" | quote }} +``` + +Rendering fails with a clear error when `existingConfigmap` is not set. + +### Environment variables available to pycsw.cfg + +pycsw expands `${VAR}` placeholders in `pycsw.cfg` at runtime, so the team config +file needs no Helm helpers from this chart. The chart provides: + +| Variable | Content | +|---|---| +| `PYCSW_SERVER_URL` | public server URL derived from the nginx route values | +| `PYCSW_MAPPINGS_FILEPATH` | mount path of the team `mappings.py` | +| `PYCSW_DATABASE_CONNECTION` | full postgres connection string (user/password from the DB secret, host/port/name/SSL params from `db`/`global.db` values) | +| `DB_SCHEMA` | value of `env.db.schema` | + +A minimal `[repository]` section in a team `pycsw.cfg`: + +```ini +[repository] +database=${PYCSW_DATABASE_CONNECTION} +mappings=${PYCSW_MAPPINGS_FILEPATH} +table=${DB_SCHEMA}.records +``` + +### Values teams are expected to set + +| Value | Meaning | +|---|---| +| `existingConfigmap` | name of the team ConfigMap (required) | +| `env.db.schema` | catalog schema, e.g. `RasterCatalogManager` | +| `mclabels.owner`, `mclabels.gisDomain` | team labels | +| `nginx.authorization.domain` | OPA authorization domain | +| `nginx.route.routesMapping` | exposed route paths | +| `replicaCount`, `resources` | scale | + +### Multiple instances in one release + +When consuming this chart more than once in the same release (aliased +dependencies, e.g. a filtered and an unfiltered catalog), each extra instance +must set: + +| Value | Meaning | +|---|---| +| `nameOverride` | distinct pycsw resource names and selector labels | +| `existingConfigmap` | its own team ConfigMap | +| `nginx.nameOverride` | distinct nginx selector labels (nginx >=2.2.1 derives pod selectors from it — identical values make services select each other's pods) | +| `nginx.fullnameOverride` | distinct nginx resource names | +| `nginx.extraVolumes` | point at the instance's own nginx configmap: `{{ .Release.Name }}--nginx-configmap` | + +## Nginx + +Nginx uses the modular extension layout: this chart ships generic +`pycsw-server.conf` / `pycsw-location.conf` snippets mounted into the nginx +subchart's `extensions` directory. Team-specific nginx behavior is driven by +values (`nginx.authorization`, `nginx.route.routesMapping`); additional snippets +can be added through the nginx subchart's own values. + +## Config changes and pod restarts + +The deployment checksums only the chart-owned ConfigMap (env vars, uwsgi.ini). +Changes to the team ConfigMap (`pycsw.cfg`, `mappings.py`) do **not** restart pods +automatically — run a rollout restart after changing team config: + +```bash +kubectl rollout restart deployment -pycsw-deployment +``` diff --git a/helm/pycsw/config/log_format.conf b/helm/pycsw/config/log_format.conf new file mode 100644 index 00000000..69e07c04 --- /dev/null +++ b/helm/pycsw/config/log_format.conf @@ -0,0 +1,81 @@ +map $msec $nanosec { + ~(.*)\.(.*) $1$2000000; +} + +log_format main escape=json + '{' + '"Timestamp": $nanosec,' + '"Attributes": {' + '"mapcolonies.time_local":"$time_local",' + {{ if and (.Values.global.opalaEnabled) (.Values.nginx.authorization.enabled) }} + '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' + {{ end }} + '"http.status_code": $status,' + '"http.url": "$http_referer",' + '"http.x_forwarded_for": "$http_x_forwarded_for",' + '"http.proxy_add_x_forwarded_for": "$proxy_add_x_forwarded_for",' + '"http.user_agent": "$http_user_agent",' + '"http.request_time": $request_time,' + '"request_length": "$request_length",' + '"http.host": "$host",' + '"upstream_addr": "$upstream_addr",' + '"upstream_status": "$upstream_status",' + '"upstream_connect_time": "$upstream_connect_time",' + '"upstream_header_time": "$upstream_header_time",' + '"upstream_response_time": "$upstream_response_time",' + '"upstream_response_length": "$upstream_response_length",' + '"upstream_bytes_sent": "$upstream_bytes_sent",' + '"upstream_bytes_received": "$upstream_bytes_received",' + '"upstream_http_name": "$upstream_http_name",' + '"bytes_sent": "$bytes_sent",' + '"body_bytes_sent": "$body_bytes_sent",' + '"content_type":"$content_type",' + '"content_length":"$content_length",' + '"remote_addr": "$remote_addr",' + '"remote_port": "$remote_port",' + '"remote_user": "$remote_user",' + '"connection":"$connection",' + '"cache_status":"$upstream_cache_status",' + '"connection_requests": "$connection_requests",' + '"connections_active": "$connections_active",' + '"connections_reading": "$connections_reading",' + '"connections_writing": "$connections_writing",' + '"connections_waiting": "$connections_waiting",' + '"ancient_browser": "$ancient_browser",' + '"modern_browser": "$modern_browser",' + '"binary_remote_addr": "$binary_remote_addr",' + '"hostname": "$hostname",' + '"http_name": "$http_name",' + '"pid": "$pid",' + '"proxy_protocol_addr": "$proxy_protocol_addr",' + '"proxy_protocol_port": "$proxy_protocol_port",' + '"proxy_protocol_server_addr": "$proxy_protocol_server_addr",' + '"proxy_protocol_server_port": "$proxy_protocol_server_port",' + '"proxy_host": "$proxy_host",' + '"proxy_port": "$proxy_port",' + '"realip_remote_addr": "$realip_remote_addr",' + '"realip_remote_port": "$realip_remote_port",' + '"server_name": "$server_name",' + '"server_addr ": "$server_addr ",' + '"server_port": "$server_port",' + '"server_protocol": "$server_protocol",' + '"tcpinfo_rtt": "$tcpinfo_rtt",' + '"tcpinfo_rttvar": "$tcpinfo_rttvar",' + '"tcpinfo_snd_cwnd": "$tcpinfo_snd_cwnd",' + '"tcpinfo_rcv_space": "$tcpinfo_rcv_space",' + '"uid_got": "$uid_got",' + '"uid_reset": "$uid_reset",' + '"uid_set": "$uid_set"' + '},' + '"TraceId": "$otel_trace_id",' ## this is a byte sequence (hex-encoded in JSON) + '"SpanId": "$otel_span_id",' + {{ if .Values.nginx.authorization.enabled }} + '"TokenUser": "$jwt_payload_sub",' + {{ else }} + '"TokenUser": "NoAuth",' + {{ end }} + '"SeverityText": "INFO",' + '"SeverityNumber": 9,' + '"RequestBody": "$request_body",' + '"Body": "$request"' + '}'; \ No newline at end of file diff --git a/helm/pycsw/config/pycsw-location.conf b/helm/pycsw/config/pycsw-location.conf new file mode 100644 index 00000000..dffe1d70 --- /dev/null +++ b/helm/pycsw/config/pycsw-location.conf @@ -0,0 +1,6 @@ + +# pycsw custom uwsgi settings injected into root location +uwsgi_pass {{ include "pycsw.service.fullname" . }}:{{ .Values.servicePort }}; +include uwsgi_params; +uwsgi_hide_header Set-Cookie; +uwsgi_param HTTP_Cookie ""; diff --git a/helm/pycsw/config/pycsw-server.conf b/helm/pycsw/config/pycsw-server.conf new file mode 100644 index 00000000..e372da98 --- /dev/null +++ b/helm/pycsw/config/pycsw-server.conf @@ -0,0 +1,10 @@ +# pycsw server-level settings +keepalive_timeout 500; +proxy_connect_timeout 600; +proxy_send_timeout 600; +send_timeout 600; +client_max_body_size {{ .Values.nginx.clientMaxBodySize }}; +client_header_timeout 600; +client_body_timeout 600; +client_header_buffer_size 12288; # 12K +large_client_header_buffers 4 12288; # 12K diff --git a/helm/pycsw/config/pycswWsgi.ini b/helm/pycsw/config/pycswWsgi.ini new file mode 100644 index 00000000..4c9d53e5 --- /dev/null +++ b/helm/pycsw/config/pycswWsgi.ini @@ -0,0 +1,38 @@ +[uwsgi] +; based on https://github.com/kartoza/docker-mapproxy/blob/master/build_data/uwsgi.ini +chdir = /home/pycsw/pycsw +wsgi-file = cors.py +pidfile = /tmp/pycsw.pid +socket = :{{ .Values.pycswPort }} +processes = {{ .Values.env.uwsgi.processes }} ; Maximum number of workers allowed +cheaper = 2 ; Minimum number of workers allowed +enable-threads = true +threads = {{ .Values.env.uwsgi.threads }} +master = true +disable-logging = true +vacuum = true +die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn) +need-app = true ; This parameter prevents uWSGI from starting if it is unable to find or load your application module +max-requests = 1000 ; Restart workers after this many requests +reload-on-rss = 2048 ; Restart workers after this much resident memory +buffer-size = 14336 ; 14K, Set the internal buffer size for uwsgi packet +worker-reload-mercy = 60 ; How long to wait before forcefully killing workers +wsgi-disable-file-wrapper = true +harakiri = 60 +py-callos-afterfork = true ; allow workers to trap signals +cheaper-algo = busyness +cheaper-initial = 2 ; Workers created at startup +cheaper-overload = 1 ; Length of a cycle in seconds +cheaper-step = 2 ; How many workers to spawn at a time +cheaper-busyness-multiplier = 30 ; How many cycles to wait before killing workers +cheaper-busyness-min = 20 ; Below this threshold, kill workers (if stable for multiplier cycles) +cheaper-busyness-max = 70 ; Above this threshold, spawn new workers +cheaper-busyness-backlog-alert = 2 ; Spawn emergency workers if more than this many requests are waiting in the queue +cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue +chmod-socket = 664 +uid = 1000 +gid = 0 +http-socket = :8080 +stats = :{{ .Values.env.uwsgi.statsServer.stats }} +stats-http = {{ .Values.env.uwsgi.statsServer.enabled }} +stats-min = {{ .Values.env.uwsgi.statsServer.statsMinify }} diff --git a/helm/pycsw/templates/_helpers.tpl b/helm/pycsw/templates/_helpers.tpl new file mode 100644 index 00000000..fd126954 --- /dev/null +++ b/helm/pycsw/templates/_helpers.tpl @@ -0,0 +1,183 @@ +{{/* +Expand the name of the chart. nameOverride allows deploying multiple instances +of this chart in the same release (e.g. as aliased dependencies) without +resource name collisions. +*/}} +{{- define "pycsw.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "pycsw.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "pycsw.labels" -}} +helm.sh/chart: {{ include "pycsw.chart" . }} +{{ include "pycsw.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{ include "mclabels.labels" . }} +{{- end }} + +{{/* +Returns the tag of the chart. +*/}} +{{- define "pycsw.tag" -}} +{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "pycsw.selectorLabels" -}} +app.kubernetes.io/name: {{ include "pycsw.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{ include "mclabels.selectorLabels" . }} +{{- end }} + +{{/* +Returns the environment from global if exists or from the chart's values, defaults to development +*/}} +{{- define "pycsw.environment" -}} +{{- if .Values.global.environment }} + {{- .Values.global.environment -}} +{{- else -}} + {{- .Values.environment | default "development" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the pycsw server url based on the provided values, default localhost. +Host and path are taken from nginx.route.host/path when set, otherwise from +the first nginx.route.routesMapping entry. +*/}} +{{- define "pycsw.serverURL" -}} + {{- $route := .Values.nginx.route -}} + {{- $first := (first ($route.routesMapping | default list)) | default dict -}} + {{- $host := $route.host | default $first.host -}} + {{- $path := $route.path | default $first.path -}} + {{- if not $host }} + {{- printf "http://localhost:8000" -}} + {{- else -}} + {{- $protocol := ternary "https" "http" $route.tls.enabled -}} + {{- printf "%s://%s" $protocol $host -}} + {{- if $path -}} + {{- printf "%s" $path -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube +*/}} +{{- define "pycsw.cloudProviderFlavor" -}} +{{- if .Values.global.cloudProvider.flavor }} + {{- .Values.global.cloudProvider.flavor -}} +{{- else if .Values.cloudProvider -}} + {{- .Values.cloudProvider.flavor | default "minikube" -}} +{{- else -}} + {{ "minikube" }} +{{- end -}} +{{- end -}} + +{{/* +Returns the cloud provider docker registry url from global if exists or from the chart's values +*/}} +{{- define "pycsw.cloudProviderDockerRegistryUrl" -}} +{{- if .Values.global.cloudProvider.dockerRegistryUrl }} + {{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}} +{{- else if .Values.cloudProvider.dockerRegistryUrl -}} + {{- printf "%s/" .Values.cloudProvider.dockerRegistryUrl -}} +{{- else -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the cloud provider image pull secret name from global if exists or from the chart's values +*/}} +{{- define "pycsw.cloudProviderImagePullSecretName" -}} +{{- if .Values.global.cloudProvider.imagePullSecretName }} + {{- .Values.global.cloudProvider.imagePullSecretName -}} +{{- else if .Values.cloudProvider.imagePullSecretName -}} + {{- .Values.cloudProvider.imagePullSecretName -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the tracing url from global if exists or from the chart's values +*/}} +{{- define "pycsw.tracingUrl" -}} +{{- if .Values.global.tracing.url }} + {{- .Values.global.tracing.url -}} +{{- else if .Values.cloudProvider -}} + {{- .Values.env.tracing.url -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the tracing url from global if exists or from the chart's values +*/}} +{{- define "pycsw.metricsUrl" -}} +{{- if .Values.global.metrics.url }} + {{- .Values.global.metrics.url -}} +{{- else -}} + {{- .Values.env.metrics.url -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the name of the ConfigMap provided by the consuming chart, holding +the pycsw.cfg and mappings.py keys. The value may itself be a template. +Fails rendering when not provided. +*/}} +{{- define "pycsw.teamConfigmapName" -}} +{{- $name := include "common.tplvalues.render" (dict "value" .Values.existingConfigmap "context" .) -}} +{{- required "existingConfigmap is required: set it to the name of a ConfigMap containing the keys pycsw.cfg and mappings.py (provided by the consuming chart)" $name -}} +{{- end -}} + +{{/* +Returns the postgres connection string as an environment variable value. +Uses Kubernetes dependent-variable syntax $(VAR) so it is resolved at container +start from DB_USER/DB_PASSWORD (secret) and DB_HOST/DB_PORT/DB_NAME (configmap). +Consumed by the team-provided pycsw.cfg via database=${PYCSW_DATABASE_CONNECTION}. +*/}} +{{- define "pycsw.connectionStringEnv" -}} +{{- $db := (include "common.db.merged" .) | fromYaml }} +{{- "postgresql://$(DB_USER)" -}} +{{- if .Values.env.db.requirePassword -}} +{{- ":$(DB_PASSWORD)" -}} +{{- end -}} +{{- "@$(DB_HOST):$(DB_PORT)/$(DB_NAME)" -}} +{{- if $db.sslEnabled -}} +{{- "?sslmode=require" -}} +{{- if $db.secrets.caFileKey -}} +{{- "&sslrootcert=/.postgresql/ca.pem" -}} +{{- end -}} +{{- if $db.secrets.certFileKey -}} +{{- "&sslcert=/.postgresql/cert.pem" -}} +{{- end -}} +{{- if $db.secrets.keyFileKey -}} +{{- "&sslkey=/.postgresql/key.pem" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "pycsw.cors.allowedHeaders" -}} +{{- $authentication := (include "common.authentication.merged" .) | fromYaml }} +{{- $headerList := list -}} +{{- if ne .Values.env.cors.allowedHeaders "" -}} +{{- range $k, $v := (split "," .Values.env.cors.allowedHeaders) -}} +{{- $headerList = append $headerList $v -}} +{{- end -}} +{{- $headerList = uniq $headerList -}} +{{- quote (join "," $headerList) -}} +{{- end -}} +{{- end -}} diff --git a/helm/pycsw/templates/_resources.tpl b/helm/pycsw/templates/_resources.tpl new file mode 100644 index 00000000..b0931a31 --- /dev/null +++ b/helm/pycsw/templates/_resources.tpl @@ -0,0 +1,42 @@ +{{/* +Create service name as used by the service name label. +*/}} +{{- define "pycsw.service.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "service" }} +{{- end }} + +{{/* +Create configmap name as used by the service name label. +*/}} +{{- define "pycsw.configmap.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "configmap" | indent 1 }} +{{- end }} + +{{/* +Create pycsw nginx configmap name as used by the service name label. +*/}} +{{- define "pycsw.nginx-configmap.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "nginx-configmap" | indent 1 }} +{{- end }} + +{{/* +Create deployment name as used by the service name label. +*/}} +{{- define "pycsw.deployment.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "deployment" | indent 1 }} +{{- end }} + + +{{/* +Create route name as used by the service name label. +*/}} +{{- define "pycsw.route.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "route" | indent 1 }} +{{- end }} + +{{/* +Create ingress name as used by the service name label. +*/}} +{{- define "pycsw.ingress.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name (include "pycsw.name" .) "ingress" | indent 1 }} +{{- end }} diff --git a/helm/pycsw/templates/_tplValues.tpl b/helm/pycsw/templates/_tplValues.tpl new file mode 100644 index 00000000..36a81f4a --- /dev/null +++ b/helm/pycsw/templates/_tplValues.tpl @@ -0,0 +1,54 @@ +{{/* +Copyright VMware, Inc. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template perhaps with scope if the scope is present. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} +*/}} +{{- define "common.tplvalues.render" -}} +{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} +{{- if contains "{{" (toJson .value) }} + {{- if .scope }} + {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} + {{- else }} + {{- tpl $value .context }} + {{- end }} +{{- else }} + {{- $value }} +{{- end }} +{{- end -}} + +{{/* +Merge a list of values that contains template after rendering them. +Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge +Usage: +{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} +*/}} +{{- define "common.tplvalues.merge" -}} +{{- $dst := dict -}} +{{- range .values -}} +{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} +{{- end -}} +{{ $dst | toYaml }} +{{- end -}} + +{{/* +End of usage example +*/}} + +{{/* +Custom definitions +*/}} + +{{- define "common.db.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.db .Values.global.db ) "context" . ) }} +{{- end -}} + +{{- define "common.authentication.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.authentication .Values.global.authentication ) "context" . ) }} +{{- end -}} diff --git a/helm/pycsw/templates/configmap.yaml b/helm/pycsw/templates/configmap.yaml new file mode 100644 index 00000000..5eac948a --- /dev/null +++ b/helm/pycsw/templates/configmap.yaml @@ -0,0 +1,33 @@ +{{- $chartName := include "pycsw.name" . -}} +{{- $configmapName := include "pycsw.configmap.fullname" . }} +{{- $tracingUrl := include "pycsw.tracingUrl" . -}} +{{- $metricsUrl := include "pycsw.metricsUrl" . -}} +{{- $db := (include "common.db.merged" .) | fromYaml }} +{{- if .Values.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $configmapName }} +data: + {{ if .Values.env.tracing.enabled }} + TELEMETRY_TRACING_ENABLED: 'true' + TELEMETRY_TRACING_URL: {{ $tracingUrl }} + {{ end }} + {{ if .Values.env.metrics.enabled }} + TELEMETRY_METRICS_ENABLED: 'true' + TELEMETRY_METRICS_URL: {{ $metricsUrl }} + {{ end }} + uwsgi.ini: {{ tpl (.Files.Get "config/pycswWsgi.ini") . | quote }} + CORS_ENABLED: {{ .Values.env.cors.enabled | quote }} + CORS_ALLOWED_HEADERS: {{ include "pycsw.cors.allowedHeaders" . | default (quote "") }} + CORS_ALLOWED_ORIGIN: {{ .Values.env.cors.allowedOrigin | quote }} + LOG_FORMAT: {{ .Values.env.logFormat | quote }} + DB_HOST: {{ $db.host }} + DB_PORT: {{ $db.port | quote }} + DB_NAME: {{ $db.name }} + POSTGRES_ENABLE_SSL_AUTH: {{ $db.sslEnabled | quote }} + DB_SCHEMA: {{ quote .Values.env.db.schema }} + PGAPPNAME: {{ $chartName }} + COORDINATE_PRECISION: {{ quote .Values.env.bboxPrecisionDigits }} + AUTH_ENABLED: {{ .Values.nginx.authorization.enabled | quote }} #maybe deprecated or used in other networks +{{- end }} diff --git a/helm/pycsw/templates/deployment.yaml b/helm/pycsw/templates/deployment.yaml new file mode 100644 index 00000000..13534678 --- /dev/null +++ b/helm/pycsw/templates/deployment.yaml @@ -0,0 +1,219 @@ +{{- $releaseName := .Release.Name -}} +{{- $chartName := include "pycsw.name" . -}} +{{- $configmapName := include "pycsw.configmap.fullname" . }} +{{- $deploymentName := include "pycsw.deployment.fullname" . }} +{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} +{{- $cloudProviderDockerRegistryUrl := include "pycsw.cloudProviderDockerRegistryUrl" . -}} +{{- $cloudProviderImagePullSecretName := include "pycsw.cloudProviderImagePullSecretName" . -}} +{{- $db := (include "common.db.merged" .) | fromYaml }} +{{ $sslSecretName := ternary .Values.authentication.ssl.externalSecretName (printf "%s%s" .Release.Name "-open-ssl") .Values.authentication.ssl.useExternal }} +{{ $postgresSecretName := ternary $db.secrets.externalSecretName (printf "%s%s" .Release.Name "-postgres-secret") $db.secrets.useExternal }} +{{- $imageTag := include "pycsw.tag" . -}} +{{- $serverURL := include "pycsw.serverURL" . -}} + +{{- if .Values.enabled -}} + +{{- $teamConfigmapName := include "pycsw.teamConfigmapName" . }} + +{{- if .Values.authentication.ssl.enabled }} +{{- if and .Values.authentication.ssl.useExternal (not .Values.authentication.ssl.externalSecretName) }} +{{- fail "When using external ssl secret the value for .Values.authentication.ssl.externalSecretName should be set" }} +{{- end }} +{{- end }} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $deploymentName }} + labels: + app: {{ $chartName }} + component: {{ $chartName }} + environment: {{ include "pycsw.environment" . }} + release: {{ $releaseName }} + {{- include "pycsw.labels" . | nindent 4 }} + annotations: + collectord.io/index: {{ quote .Values.splunkIndex }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ $chartName }} + release: {{ $releaseName }} + run: {{ $releaseName }}-{{ $chartName }} + {{- include "pycsw.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ $chartName }} + release: {{ $releaseName }} + run: {{ $releaseName }}-{{ $chartName }} + {{- include "pycsw.selectorLabels" . | nindent 8 }} + annotations: + {{- if .Values.resetOnConfigChange }} + checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- end }} + {{- if .Values.podAnnotations }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} + {{ include "mclabels.annotations" . | nindent 8 }} + + spec: + {{- if $cloudProviderImagePullSecretName }} + imagePullSecrets: + - name: {{ $cloudProviderImagePullSecretName | quote }} + {{- end }} + containers: + - name: {{ $releaseName }} + {{- with .Values.image }} + image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }} + {{- end }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + volumeMounts: + {{- if .Values.global.ca.secretName }} + - mountPath: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} + name: root-ca + subPath: {{ quote .Values.global.ca.key }} + {{- end }} + {{- if .Values.global.ca.secretName }} + - name: root-ca + mountPath: "/usr/local/share/ca-certificates" + {{- end }} + {{- if .Values.authentication.ssl.enabled }} + - name: open-ssl + mountPath: "/etc/ssl/openssl.cnf" + subPath: "openssl.cnf" + {{- end }} + - name: pyscw-config + mountPath: /etc/pycsw/pycsw.cfg + subPath: pycsw.cfg + - name: pyscw-mappings + mountPath: /etc/pycsw/mappings.py + subPath: mappings.py + - mountPath: "/pycsw/uwsgi.ini" + name: uwsgi-config + subPath: uwsgi.ini + {{- if $db.sslEnabled }} + {{- if $db.secrets.caFileKey }} + - name: ca-file + mountPath: /certs/ca.crt + subPath: ca.pem + {{- end }} + {{- if $db.secrets.keyFileKey }} + - name: key-file + mountPath: /certs/key.pem + subPath: key.pem + {{- end }} + {{- if $db.secrets.certFileKey }} + - name: cert-file + mountPath: /certs/cert.pem + subPath: cert.pem + {{- end }} + {{- end }} + env: + {{- if .Values.global.ca.secretName }} + - name: REQUESTS_CA_BUNDLE + value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} + - name: NODE_EXTRA_CA_CERTS + value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} + {{- end }} + - name: PYCSW_SERVER_URL + value: {{ $serverURL }} + - name: PYCSW_MAPPINGS_FILEPATH + value: /etc/pycsw/mappings.py + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ $postgresSecretName }} + key: username + {{- if .Values.env.db.requirePassword }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ $postgresSecretName }} + key: password + {{- end }} + - name: PYCSW_DATABASE_CONNECTION + value: {{ include "pycsw.connectionStringEnv" . | quote }} + - name: POSTGRES_CERTS_MOUNT_PATH + value: /certs + - name: POSTGRES_CERT_FILE_NAME + value: cert.pem + - name: POSTGRES_KEY_FILE_NAME + value: key.pem + envFrom: + - configMapRef: + name: {{ $configmapName }} + ports: + - name: http + containerPort: {{ .Values.pycswPort }} + protocol: TCP + readinessProbe: + httpGet: + path: /csw?service=CSW&request=GetCapabilities&version=3.0.0 + port: 8080 + initialDelaySeconds: 30 + timeoutSeconds: 5 + {{- if .Values.resources.enabled }} + resources: + {{- toYaml .Values.resources.value | nindent 12 }} + {{- end }} + ################################################## uwsgi exporter deployment############################################## + {{- if .Values.env.metrics.enabled }} + {{- template "pycsw-chart.uwsgi-exporter-container" (merge (dict "releaseName" .releaseName "chartName" .chartName "cloudProviderDockerRegistryUrl" $cloudProviderDockerRegistryUrl "resources" .Values.uwsgiExporter.resources) .) }} + {{- end }} + volumes: + {{- if .Values.global.ca.secretName }} + - name: root-ca + secret: + secretName: {{ .Values.global.ca.secretName }} + {{- end }} + {{- if .Values.authentication.ssl.enabled }} + - name: open-ssl + secret: + secretName: {{ $sslSecretName }} + {{- end }} + - name: pyscw-config + configMap: + name: {{ $teamConfigmapName }} + items: + - key: "pycsw.cfg" + path: "pycsw.cfg" + - name: pyscw-mappings + configMap: + name: {{ $teamConfigmapName }} + items: + - key: "mappings.py" + path: "mappings.py" + - name: uwsgi-config + configMap: + name: {{ $configmapName }} + items: + - key: "uwsgi.ini" + path: "uwsgi.ini" + {{- if $db.sslEnabled }} + {{- if $db.secrets.caFileKey }} + - name: ca-file + secret: + secretName: {{ $postgresSecretName }} + items: + - key: {{ $db.secrets.caFileKey }} + path: ca.pem + {{- end }} + {{- if $db.secrets.keyFileKey }} + - name: key-file + secret: + secretName: {{ $postgresSecretName }} + items: + - key: {{ $db.secrets.keyFileKey }} + path: key.pem + {{- end }} + {{- if $db.secrets.certFileKey }} + - name: cert-file + secret: + secretName: {{ $postgresSecretName }} + items: + - key: {{ $db.secrets.certFileKey }} + path: cert.pem + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/pycsw/templates/nginx/nginx-configmap.yaml b/helm/pycsw/templates/nginx/nginx-configmap.yaml new file mode 100644 index 00000000..2e27231e --- /dev/null +++ b/helm/pycsw/templates/nginx/nginx-configmap.yaml @@ -0,0 +1,18 @@ +{{- if .Values.nginx.enabled -}} +{{- $chartName := include "pycsw.name" . -}} +{{- $releaseName := .Release.Name -}} +{{- $nginxConfigmapName := include "pycsw.nginx-configmap.fullname" . }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $nginxConfigmapName }} + labels: + app: {{ $releaseName }}-{{ $chartName }} + component: nginx-configmap + environment: {{ .Values.environment }} + release: {{ $releaseName }} +data: + pycsw-location.conf: {{ tpl (.Files.Get "config/pycsw-location.conf") . | quote }} + pycsw-server.conf: {{ tpl (.Files.Get "config/pycsw-server.conf") . | quote }} + log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} +{{- end }} diff --git a/helm/pycsw/templates/service.yaml b/helm/pycsw/templates/service.yaml new file mode 100644 index 00000000..6e0e522b --- /dev/null +++ b/helm/pycsw/templates/service.yaml @@ -0,0 +1,32 @@ +{{- $releaseName := .Release.Name -}} +{{- $chartName := include "pycsw.name" . -}} +{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} +{{- $serviceName := include "pycsw.service.fullname" . -}} +{{- if .Values.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $serviceName }} + labels: + app: {{ $chartName }} + component: {{ $chartName }} + environment: {{ include "pycsw.environment" . }} + release: {{ $releaseName }} + {{- include "pycsw.labels" . | nindent 4 }} +spec: + {{- if eq $cloudProviderFlavor "minikube" }} + type: NodePort + {{- end }} + ports: + - port: {{ .Values.servicePort }} + targetPort: {{ .Values.pycswPort }} + protocol: TCP + {{- if eq $cloudProviderFlavor "minikube" }} + nodePort: {{ .Values.nodePort }} + {{- end }} + selector: + app: {{ $chartName }} + release: {{ $releaseName }} + run: {{ $releaseName }}-{{ $chartName }} + {{- include "pycsw.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml b/helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml new file mode 100644 index 00000000..300d463a --- /dev/null +++ b/helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml @@ -0,0 +1,33 @@ +{{- define "pycsw-chart.uwsgi-exporter-container" }} + - name: uwsgi-exporter + image: {{ .cloudProviderDockerRegistryUrl }}{{ .Values.uwsgiExporter.image.repository }}:{{ .Values.uwsgiExporter.image.tag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + args: + - "--stats.uri=http://localhost:{{ .Values.env.uwsgi.statsServer.stats }}" + - "--log.level={{ .Values.uwsgiExporter.env.logLevel }}" + {{- if .resources.enabled }} + resources: + {{- toYaml .resources.value | nindent 12 }} + {{- end }} + livenessProbe: + httpGet: + path: "/-/healthy" + port: "uwsgimetrics" + initialDelaySeconds: 2 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + readinessProbe: + httpGet: + path: "/metrics" + port: "uwsgimetrics" + initialDelaySeconds: 2 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + ports: + - name: "uwsgimetrics" + containerPort: {{ .Values.uwsgiExporter.port }} +{{- end }} diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml new file mode 100644 index 00000000..84071e77 --- /dev/null +++ b/helm/pycsw/values.yaml @@ -0,0 +1,254 @@ +global: + cloudProvider: + dockerRegistryUrl: "" + imagePullSecretName: "" + flavor: openshift + tracing: {} + metrics: {} + environment: "" + opalaEnabled: false + ca: + secretName: "" + path: "/usr/local/share/ca-certificates" + key: "ca.crt" + db: + host: "" + name: "" + port: 5432 + sslEnabled: false + secrets: + useExternal: true + externalSecretName: "" + caFileKey: "" + certFileKey: "" + keyFileKey: "" + +mclabels: + #environment: development + component: backend + partOf: serving + # owner and gisDomain must be set by the consuming chart + owner: "" + gisDomain: "" + prometheus: + enabled: true + port: 9117 + logScraping: true + +# override the chart name used in resource names/labels; required when deploying +# multiple instances of this chart in the same release (aliased dependencies) +nameOverride: "" + +# REQUIRED: name of a ConfigMap provided by the consuming chart, containing the keys: +# pycsw.cfg - the pycsw configuration file +# mappings.py - the pycsw field mappings +# The value may be a template, e.g. '{{ .Release.Name }}-pycsw-config' +existingConfigmap: "" + +enabled: true +environment: development +replicaCount: 1 +resetOnConfigChange: true +splunkIndex: "" +imagePullPolicy: Always + +cloudProvider: + dockerRegistryUrl: "" + imagePullSecretName: "" + flavor: openshift + +authentication: + ssl: + enabled: false + useExternal: false + externalSecretName: "" +db: + host: "" + name: "" + port: 5432 + sslEnabled: false + secrets: + useExternal: false + externalSecretName: "" + caFileKey: "" + certFileKey: "" + keyFileKey: "" + +image: + repository: pycsw + # defaults to the chart appVersion (prefixed with v) when empty + tag: "" + +pycswPort: 8000 +nodePort: 30018 +servicePort: 8080 + +# add pod annotations +# example: +# podAnnotations: +# annotation1: annotation-value-1 +# annotation2: annotation-value-2 +podAnnotations: {} + +env: + logFormat: >- + %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({x-forwarded-for}i)s %(L)s + bboxPrecisionDigits: 10 + uwsgi: + processes: 6 + threads: 10 + statsServer: + enabled: true + stats: 1717 + statsMinify: true + cors: + enabled: true + allowedOrigin: "*" + allowedHeaders: "x-api-key" + db: + # database schema holding the records table, e.g. RasterCatalogManager + schema: "" + requirePassword: true + tracing: + enabled: false + url: http://localhost:55681/v1/trace + metrics: + enabled: true + url: http://localhost:55681/v1/metrics + +resources: + enabled: true + value: + limits: + cpu: 2 + memory: 1200Mi + requests: + cpu: 2 + memory: 1200Mi + +nginx: + enabled: true + # distinct nameOverride per instance is REQUIRED when deploying multiple + # pycsw instances in one release: nginx (>=2.2.1) derives its pod selector + # labels from nameOverride, so identical values make services select each + # other's pods + nameOverride: "" + fullnameOverride: "" + replicaCount: 2 + image: + repository: common/nginx + # defaults to the nginx chart appVersion when empty + tag: "" + nginx: + extensions: + server: + enabled: true + fileName: pycsw-server.conf + location: + enabled: true + fileName: pycsw-location.conf + port: 8080 + targetPort: 8080 + nodePort: 30003 + # rendered into config/pycsw-server.conf (client_max_body_size) + clientMaxBodySize: 5000 + + opentelemetry: + serviceName: pycsw-nginx + exporterHost: infra-otel.infra-services + exporterPort: 4317 + samplerMethod: "AlwaysOff" + ratio: 10 + + backend: + enabled: false + + prometheusExporter: + enabled: true + image: + repository: common/nginx-prometheus-exporter + tag: 1.5.1 + pullPolicy: IfNotPresent + resources: + enabled: true + value: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + + authorization: + enabled: false + # authorization domain of the consuming team, e.g. raster / dem / 3d + domain: "" + url: http://opa-dev-opa-service.infra-services/v1/data/http/authz/decision + + # when using nameOverride, override the configmap name accordingly: + # "{{ .Release.Name }}--nginx-configmap" + extraVolumes: + - name: nginx-config + configMap: + name: "{{ .Release.Name }}-pycsw-nginx-configmap" + + extraVolumeMounts: + - name: nginx-config + mountPath: "/etc/nginx/conf.d/extensions/pycsw-location.conf" + subPath: pycsw-location.conf + - name: nginx-config + mountPath: "/etc/nginx/conf.d/extensions/pycsw-server.conf" + subPath: pycsw-server.conf + + resources: + enabled: true + value: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + + route: + enabled: true + # routesMapping must be set by the consuming chart, e.g. + # routesMapping: + # - path: /api/raster/v1 + # host: + routesMapping: [] + timeout: + enabled: false # defaults to 30s by openshift + duration: 60s # supported units (us, ms, s, m, h, d) + tls: + enabled: true + useCerts: false + certificate: "" + key: "" + caCertificate: "" + + ingress: + enabled: false + ingressClassName: "" + # ingressMapping must be set by the consuming chart when ingress is enabled + ingressMapping: [] + tls: + enabled: true + useExternal: "" + +uwsgiExporter: + image: + repository: "timonwong/uwsgi-exporter" + tag: "latest" + env: + logLevel: info # one of [debug, info, warn, error] + port: 9117 + resources: + enabled: true + value: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi diff --git a/release-please-config.json b/release-please-config.json index 4aa7d069..207662f6 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -34,6 +34,16 @@ "type": "yaml", "path": "helm/raster/Chart.yaml", "jsonpath": "$.appVersion" + }, + { + "type": "yaml", + "path": "helm/pycsw/Chart.yaml", + "jsonpath": "$.version" + }, + { + "type": "yaml", + "path": "helm/pycsw/Chart.yaml", + "jsonpath": "$.appVersion" } ] } From ebef810724392fb5e857743e36f73442b4b2c4fa Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Sun, 12 Jul 2026 14:15:39 +0300 Subject: [PATCH 02/15] helm: change auth url --- helm/pycsw/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 84071e77..309dacd9 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -183,7 +183,7 @@ nginx: enabled: false # authorization domain of the consuming team, e.g. raster / dem / 3d domain: "" - url: http://opa-dev-opa-service.infra-services/v1/data/http/authz/decision + url: http://opa-service/v1/data/http/authz/decision # when using nameOverride, override the configmap name accordingly: # "{{ .Release.Name }}--nginx-configmap" From ef4689b61e2b5d79a46c51d8a0f312bbb08c6081 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Sun, 12 Jul 2026 15:31:21 +0300 Subject: [PATCH 03/15] helm: remove nginx custom log format --- helm/pycsw/config/log_format.conf | 81 ------------------- .../templates/nginx/nginx-configmap.yaml | 1 - 2 files changed, 82 deletions(-) delete mode 100644 helm/pycsw/config/log_format.conf diff --git a/helm/pycsw/config/log_format.conf b/helm/pycsw/config/log_format.conf deleted file mode 100644 index 69e07c04..00000000 --- a/helm/pycsw/config/log_format.conf +++ /dev/null @@ -1,81 +0,0 @@ -map $msec $nanosec { - ~(.*)\.(.*) $1$2000000; -} - -log_format main escape=json - '{' - '"Timestamp": $nanosec,' - '"Attributes": {' - '"mapcolonies.time_local":"$time_local",' - {{ if and (.Values.global.opalaEnabled) (.Values.nginx.authorization.enabled) }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' - {{ end }} - '"http.status_code": $status,' - '"http.url": "$http_referer",' - '"http.x_forwarded_for": "$http_x_forwarded_for",' - '"http.proxy_add_x_forwarded_for": "$proxy_add_x_forwarded_for",' - '"http.user_agent": "$http_user_agent",' - '"http.request_time": $request_time,' - '"request_length": "$request_length",' - '"http.host": "$host",' - '"upstream_addr": "$upstream_addr",' - '"upstream_status": "$upstream_status",' - '"upstream_connect_time": "$upstream_connect_time",' - '"upstream_header_time": "$upstream_header_time",' - '"upstream_response_time": "$upstream_response_time",' - '"upstream_response_length": "$upstream_response_length",' - '"upstream_bytes_sent": "$upstream_bytes_sent",' - '"upstream_bytes_received": "$upstream_bytes_received",' - '"upstream_http_name": "$upstream_http_name",' - '"bytes_sent": "$bytes_sent",' - '"body_bytes_sent": "$body_bytes_sent",' - '"content_type":"$content_type",' - '"content_length":"$content_length",' - '"remote_addr": "$remote_addr",' - '"remote_port": "$remote_port",' - '"remote_user": "$remote_user",' - '"connection":"$connection",' - '"cache_status":"$upstream_cache_status",' - '"connection_requests": "$connection_requests",' - '"connections_active": "$connections_active",' - '"connections_reading": "$connections_reading",' - '"connections_writing": "$connections_writing",' - '"connections_waiting": "$connections_waiting",' - '"ancient_browser": "$ancient_browser",' - '"modern_browser": "$modern_browser",' - '"binary_remote_addr": "$binary_remote_addr",' - '"hostname": "$hostname",' - '"http_name": "$http_name",' - '"pid": "$pid",' - '"proxy_protocol_addr": "$proxy_protocol_addr",' - '"proxy_protocol_port": "$proxy_protocol_port",' - '"proxy_protocol_server_addr": "$proxy_protocol_server_addr",' - '"proxy_protocol_server_port": "$proxy_protocol_server_port",' - '"proxy_host": "$proxy_host",' - '"proxy_port": "$proxy_port",' - '"realip_remote_addr": "$realip_remote_addr",' - '"realip_remote_port": "$realip_remote_port",' - '"server_name": "$server_name",' - '"server_addr ": "$server_addr ",' - '"server_port": "$server_port",' - '"server_protocol": "$server_protocol",' - '"tcpinfo_rtt": "$tcpinfo_rtt",' - '"tcpinfo_rttvar": "$tcpinfo_rttvar",' - '"tcpinfo_snd_cwnd": "$tcpinfo_snd_cwnd",' - '"tcpinfo_rcv_space": "$tcpinfo_rcv_space",' - '"uid_got": "$uid_got",' - '"uid_reset": "$uid_reset",' - '"uid_set": "$uid_set"' - '},' - '"TraceId": "$otel_trace_id",' ## this is a byte sequence (hex-encoded in JSON) - '"SpanId": "$otel_span_id",' - {{ if .Values.nginx.authorization.enabled }} - '"TokenUser": "$jwt_payload_sub",' - {{ else }} - '"TokenUser": "NoAuth",' - {{ end }} - '"SeverityText": "INFO",' - '"SeverityNumber": 9,' - '"RequestBody": "$request_body",' - '"Body": "$request"' - '}'; \ No newline at end of file diff --git a/helm/pycsw/templates/nginx/nginx-configmap.yaml b/helm/pycsw/templates/nginx/nginx-configmap.yaml index 2e27231e..9be63978 100644 --- a/helm/pycsw/templates/nginx/nginx-configmap.yaml +++ b/helm/pycsw/templates/nginx/nginx-configmap.yaml @@ -14,5 +14,4 @@ metadata: data: pycsw-location.conf: {{ tpl (.Files.Get "config/pycsw-location.conf") . | quote }} pycsw-server.conf: {{ tpl (.Files.Get "config/pycsw-server.conf") . | quote }} - log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} {{- end }} From 510e7a08a929a2fef97af308d3e99fd433acd9b3 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Sun, 12 Jul 2026 15:31:51 +0300 Subject: [PATCH 04/15] helm: add mclabels values to nginx --- helm/pycsw/values.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 309dacd9..cf1cc5f0 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -33,7 +33,6 @@ mclabels: prometheus: enabled: true port: 9117 - logScraping: true # override the chart name used in resource names/labels; required when deploying # multiple instances of this chart in the same release (aliased dependencies) @@ -139,6 +138,15 @@ nginx: repository: common/nginx # defaults to the nginx chart appVersion when empty tag: "" + mclabels: + #environment: development + partOf: serving + # owner and gisDomain must be set by the consuming chart + owner: "" + gisDomain: "" + prometheus: + enabled: true + port: 9117 nginx: extensions: server: From bd7c497d1121a4c2f52fae016dcbf0850daa0ede Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Tue, 14 Jul 2026 13:19:38 +0300 Subject: [PATCH 05/15] helm: remove per-team charts, publish pycsw to common registry Delete helm/3d, helm/dem, helm/raster now that teams consume the unified helm/pycsw chart with their own injected config. helm/pycsw is the only chart in the repo. Publish the pycsw chart to oci:///helm/common (domain=common); drop the build-and-push matrix since a single chart remains. Trim release-please extra-files to the helm/pycsw Chart.yaml. Co-Authored-By: Claude Fable 5 --- .github/workflows/build-and-push.yaml | 19 +- helm/3d/Chart.yaml | 13 - helm/3d/config/default.conf | 58 ---- helm/3d/config/log_format.conf | 50 ---- helm/3d/config/mappings.py | 72 ----- helm/3d/config/nginx.conf | 36 --- helm/3d/config/pycsw.cfg | 73 ------ helm/3d/config/pycswWsgi.ini | 38 --- helm/3d/templates/_helpers.tpl | 139 ---------- helm/3d/templates/_tplValues.tpl | 92 ------- helm/3d/templates/configmap-nginx.yaml | 9 - helm/3d/templates/configmap.yaml | 37 --- helm/3d/templates/deployment.yaml | 202 -------------- helm/3d/templates/service.yaml | 30 --- helm/3d/values.yaml | 205 --------------- helm/dem/.helmignore | 26 -- helm/dem/Chart.yaml | 13 - helm/dem/config/default.conf | 61 ----- helm/dem/config/log_format.conf | 81 ------ helm/dem/config/mappings.py | 68 ----- helm/dem/config/nginx.conf | 37 --- helm/dem/config/pycsw.cfg | 74 ------ helm/dem/config/pycswWsgi.ini | 38 --- helm/dem/templates/_helpers.tpl | 173 ------------ helm/dem/templates/_resources.tpl | 42 --- helm/dem/templates/_tplValues.tpl | 54 ---- helm/dem/templates/configmap.yaml | 35 --- helm/dem/templates/deployment.yaml | 214 --------------- helm/dem/templates/nginx/nginx-configmap.yaml | 18 -- helm/dem/templates/service.yaml | 32 --- .../uwsgi-exporter-container.yaml | 33 --- helm/dem/values.yaml | 211 --------------- helm/raster/.helmignore | 26 -- helm/raster/Chart.yaml | 13 - helm/raster/config/log_format.conf | 81 ------ helm/raster/config/mappings.py | 65 ----- helm/raster/config/pycsw-location.conf | 6 - helm/raster/config/pycsw-server.conf | 10 - helm/raster/config/pycsw.cfg | 75 ------ helm/raster/config/pycswWsgi.ini | 38 --- helm/raster/templates/_helpers.tpl | 173 ------------ helm/raster/templates/_resources.tpl | 42 --- helm/raster/templates/_tplValues.tpl | 54 ---- helm/raster/templates/configmap.yaml | 35 --- helm/raster/templates/deployment.yaml | 214 --------------- .../templates/nginx/nginx-configmap.yaml | 18 -- helm/raster/templates/service.yaml | 32 --- .../uwsgi-exporter-container.yaml | 33 --- helm/raster/values.yaml | 247 ------------------ release-please-config.json | 30 --- 50 files changed, 3 insertions(+), 3472 deletions(-) delete mode 100644 helm/3d/Chart.yaml delete mode 100644 helm/3d/config/default.conf delete mode 100644 helm/3d/config/log_format.conf delete mode 100644 helm/3d/config/mappings.py delete mode 100644 helm/3d/config/nginx.conf delete mode 100644 helm/3d/config/pycsw.cfg delete mode 100644 helm/3d/config/pycswWsgi.ini delete mode 100644 helm/3d/templates/_helpers.tpl delete mode 100644 helm/3d/templates/_tplValues.tpl delete mode 100644 helm/3d/templates/configmap-nginx.yaml delete mode 100644 helm/3d/templates/configmap.yaml delete mode 100644 helm/3d/templates/deployment.yaml delete mode 100644 helm/3d/templates/service.yaml delete mode 100644 helm/3d/values.yaml delete mode 100644 helm/dem/.helmignore delete mode 100644 helm/dem/Chart.yaml delete mode 100644 helm/dem/config/default.conf delete mode 100644 helm/dem/config/log_format.conf delete mode 100644 helm/dem/config/mappings.py delete mode 100644 helm/dem/config/nginx.conf delete mode 100644 helm/dem/config/pycsw.cfg delete mode 100644 helm/dem/config/pycswWsgi.ini delete mode 100644 helm/dem/templates/_helpers.tpl delete mode 100644 helm/dem/templates/_resources.tpl delete mode 100644 helm/dem/templates/_tplValues.tpl delete mode 100644 helm/dem/templates/configmap.yaml delete mode 100644 helm/dem/templates/deployment.yaml delete mode 100644 helm/dem/templates/nginx/nginx-configmap.yaml delete mode 100644 helm/dem/templates/service.yaml delete mode 100644 helm/dem/templates/uwsgi-exporter/uwsgi-exporter-container.yaml delete mode 100644 helm/dem/values.yaml delete mode 100644 helm/raster/.helmignore delete mode 100644 helm/raster/Chart.yaml delete mode 100644 helm/raster/config/log_format.conf delete mode 100644 helm/raster/config/mappings.py delete mode 100644 helm/raster/config/pycsw-location.conf delete mode 100644 helm/raster/config/pycsw-server.conf delete mode 100644 helm/raster/config/pycsw.cfg delete mode 100644 helm/raster/config/pycswWsgi.ini delete mode 100644 helm/raster/templates/_helpers.tpl delete mode 100644 helm/raster/templates/_resources.tpl delete mode 100644 helm/raster/templates/_tplValues.tpl delete mode 100644 helm/raster/templates/configmap.yaml delete mode 100644 helm/raster/templates/deployment.yaml delete mode 100644 helm/raster/templates/nginx/nginx-configmap.yaml delete mode 100644 helm/raster/templates/service.yaml delete mode 100644 helm/raster/templates/uwsgi-exporter/uwsgi-exporter-container.yaml delete mode 100644 helm/raster/values.yaml diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index c87e30a7..0379d546 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -39,20 +39,7 @@ jobs: build_and_push_helm: name: publish pycsw helm to acr runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - domain: - - 3d - - dem - - raster - - pycsw steps: - - name: Display matrix and index - run: | - echo "Running on domain ${{ matrix.domain }}" - echo "This is matrix job #${{ strategy.job-index }}" - - name: checkout repo from latest commit uses: actions/checkout@v4 @@ -67,14 +54,14 @@ jobs: id: build_helm_chart uses: MapColonies/shared-workflows/actions/build-and-push-helm@build-and-push-helm-v1.0.1 with: - context: ./helm/${{ matrix.domain }} - domain: ${{ matrix.domain }} + context: ./helm/pycsw + domain: common registry: ${{ secrets.ACR_URL }} - name: Update Helm Package in artifacts.json uses: MapColonies/shared-workflows/actions/update-artifacts-file@update-artifacts-file-v1 with: - domain: ${{ matrix.domain }} + domain: common type: helm artifact_name: ${{ steps.build_helm_chart.outputs.chart }} artifact_tag: ${{ steps.build_helm_chart.outputs.ver }} diff --git a/helm/3d/Chart.yaml b/helm/3d/Chart.yaml deleted file mode 100644 index bfd980fc..00000000 --- a/helm/3d/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v2 -name: pycsw -description: A Helm chart for 3d pycsw deployment -type: application -version: 6.6.1 -appVersion: 6.6.1 -dependencies: - - name: nginx - version: 2.2.1 - repository: oci://acrarolibotnonprod.azurecr.io/helm/common - - name: mclabels - version: 1.0.1 - repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/3d/config/default.conf b/helm/3d/config/default.conf deleted file mode 100644 index b53ed345..00000000 --- a/helm/3d/config/default.conf +++ /dev/null @@ -1,58 +0,0 @@ -{{- $chartName := include "pycsw.name" . -}} -{{- $fullName := include "pycsw.fullname" . -}} -{{- $opala := (include "merged.opala" . ) | fromYaml }} - -upstream pycsw { - server {{ $fullName }}:{{ .Values.env.port }}; -} - -server { - listen {{ .Values.nginx.targetPort }}; - # the domain name it will serve for - server_name pycsw; - # max upload size, adjust to taste - keepalive_timeout 500; - proxy_connect_timeout 600; - proxy_send_timeout 600; - send_timeout 600; - client_max_body_size 5000; - client_header_timeout 600; - client_body_timeout 600; - client_header_buffer_size 12288; # 12K - large_client_header_buffers 4 12288; # 12K - fastcgi_read_timeout 300; - location /liveness { - access_log off; - log_not_found off; - return 200 "I'm alive\n"; - } - location / { - set $original_method $request_method; - set $original_args $args; - - {{ if eq $opala.enabled "true" }} - set $domain {{ $opala.domain }}; - auth_request /_validate_jwt; - {{ end }} - - include uwsgi_params; - uwsgi_pass pycsw; - uwsgi_hide_header Set-Cookie; # ensures the header will not be passed back to the client - uwsgi_param HTTP_Cookie ""; # ensures that a client cannot pass any prior cookies to the webapp and spoil your cache - } - - {{ if eq $opala.enabled "true" }} - location = /_validate_jwt { - internal; - - js_content auth.opaAuth; - } - - location = /opa { - internal; - - proxy_set_header Content-Type application/json; - proxy_pass {{ $opala.url }}; - } - {{ end }} -} diff --git a/helm/3d/config/log_format.conf b/helm/3d/config/log_format.conf deleted file mode 100644 index 676d180e..00000000 --- a/helm/3d/config/log_format.conf +++ /dev/null @@ -1,50 +0,0 @@ -{{- $opala := (include "merged.opala" . ) | fromYaml }} - -map $msec $nanosec { - ~(.*)\.(.*) $1$2000000; -} - -log_format json escape=json -'{' - '"Timestamp":$nanosec,' - '"Attributes":{' - '"mapcolonies.time_local":"$time_local",' - {{ if eq $opala.enabled "true" }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' - {{ else }} - '"mapcolonies.http.auth.token.client_name":"NO AUTH",' - {{ end }} - '"http.request.method":"$request_method",' - '"http.request.header.referer":"$http_referer",' - #'"http.request.body.size":$content_length,' - '"http.response.body.size":"$body_bytes_sent",' - '"http.response.header.x_forwarded_for":"$proxy_add_x_forwarded_for",' - '"http.response.status_code":"$status",' - '"user_agent.original":"$http_user_agent",' - '"network.protocol":"$server_protocol",' - '"mapcolonies.request_time":"$request_time",' - '"mapcolonies.http.upstream_connect_time":"$upstream_connect_time",' - '"mapcolonies.http.upstream_response_time":"$upstream_response_time",' - '"mapcolonies.http.upstream_addr":"$upstream_addr",' - '"mapcolonies.http.upstream_status_code":"$upstream_status",' - '"mapcolonies.http.upstream_cache_status":"$upstream_cache_status",' - '"mapcolonies.server":"$hostname",' - '"server.address":"$host",' - '"server.port":"$server_port",' - '"client.address":"$remote_addr",' - '"client.port":"$remote_port",' - '"url.scheme":"$scheme",' - '"url.path":"$uri",' - '"url.full":"$request_uri"' - '},' - '"Resource":{' - '"service.name":"{{ .Values.image.repository }}",' - '"service.version":"{{ .Values.image.tag }}"' - '},' - #'"TraceId":"$opentelemetry_trace_id",' ## this is a byte sequence (hex-encoded in JSON) - #'"SpanId":"$opentelemetry_span_id",' - '"SeverityText":"INFO",' - '"SeverityNumber":"9",' - '"InstrumentationScope":"access.log",' - '"Body":"$request"' -'}'; diff --git a/helm/3d/config/mappings.py b/helm/3d/config/mappings.py deleted file mode 100644 index 05e21604..00000000 --- a/helm/3d/config/mappings.py +++ /dev/null @@ -1,72 +0,0 @@ -MD_CORE_MODEL = { - 'typename': 'pycsw:CoreMetadata', - 'outputschema': 'http://pycsw.org/metadata', - 'mappings': { - # Needed fot PYCSW - 'pycsw:Links': 'links', - 'pycsw:Type': 'type', - 'pycsw:Typename': 'typename', - 'pycsw:Schema': 'schema', - 'pycsw:MDSource': 'mdsource', - 'pycsw:XML': 'xml', - 'pycsw:AnyText': 'anytext', - 'pycsw:InsertDate': 'insert_date', - 'pycsw:BoundingBox': 'wkt_geometry', - 'pycsw:Keywords': 'keywords', - - # Profile 3D fields - 'pycsw:Identifier': 'identifier', - 'pycsw:productId': 'product_id', - 'pycsw:title': 'product_name', - 'pycsw:productVersion': 'product_version', - 'pycsw:productType': 'product_type', - 'pycsw:productSubType': 'product_sub_type', - 'pycsw:abstract': 'description', - 'pycsw:creationDate': 'creation_date', - 'pycsw:updateDate': 'update_date', - 'pycsw:tempExtentBegin': 'source_start_date', - 'pycsw:tempExtentEnd': 'source_end_date', - 'pycsw:minResolution': 'min_resolution', - 'pycsw:maxResolution': 'max_resolution', - 'pycsw:horizontalAccuracyCE90': 'horizontal_accuracy_ce_90', - 'pycsw:accuracyLE90': 'accuracy_le_90', - 'pycsw:accuracySE90': 'accuracy_se_90', - 'pycsw:relativeAccuracySE90': 'relative_accuracy_se_90', - 'pycsw:visualAccuracy': 'visual_accuracy', - 'pycsw:sensorType': 'sensor_type', - 'pycsw:footprint': 'footprint', - 'pycsw:heightRangeFrom': 'height_range_from', - 'pycsw:heightRangeTo': 'height_range_to', - 'pycsw:CRS': 'srs', - 'pycsw:CRSName': 'srs_name', - 'pycsw:region': 'region', - 'pycsw:classification': 'classification', - 'pycsw:productionSystem': 'production_system', - 'pycsw:productionSystemVersion': 'production_system_version', - 'pycsw:creator': 'producer_name', - 'pycsw:minFlightAlt': 'min_flight_alt', - 'pycsw:maxFlightAlt': 'max_flight_alt', - 'pycsw:geographicArea': 'geographic_area', - 'pycsw:productBBox': 'product_bbox', - 'pycsw:productSource': 'product_source', - 'pycsw:productStatus': 'product_status', - - # Not in xml - 'pycsw:Title': 'title', - 'pycsw:AlternateTitle': 'title', - 'pycsw:Creator': 'producer_name', - 'pycsw:Abstract': 'description', - 'pycsw:Publisher': 'producer_name', - 'pycsw:Contributor': 'producer_name', - 'pycsw:Modified': 'update_date', - 'pycsw:Date': 'creation_date', - 'pycsw:Format': 'type', - 'pycsw:Source': 'product_name', - 'pycsw:AccessConstraints': 'classification', - 'pycsw:CRS': 'srs', - 'pycsw:Relation': '', - 'pycsw:Language': '', - 'pycsw:Keywords': '', - 'pycsw:TopicCategory': '' - } -} diff --git a/helm/3d/config/nginx.conf b/helm/3d/config/nginx.conf deleted file mode 100644 index 9a8f2a46..00000000 --- a/helm/3d/config/nginx.conf +++ /dev/null @@ -1,36 +0,0 @@ -{{- $opala := (include "merged.opala" . ) | fromYaml }} - -#user nginx; -worker_processes 4; - -error_log /var/log/nginx/error.log notice; -pid /tmp/nginx.pid; -load_module modules/ngx_http_js_module.so; -load_module /otel/otel_ngx_module.so; - -events { - worker_connections 1024; -} - -http { - opentelemetry_config /otel/otel-nginx.toml; - include /etc/nginx/mime.types; - default_type application/octet-stream; - - {{ if eq $opala.enabled "true" }} - js_import auth from /etc/nginx/auth.js; - js_set $jwt_payload_sub auth.jwtPayloadSub; - {{ end }} - - include /etc/nginx/log_format.conf; - access_log /var/log/nginx/access.log json; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/helm/3d/config/pycsw.cfg b/helm/3d/config/pycsw.cfg deleted file mode 100644 index 671ce94a..00000000 --- a/helm/3d/config/pycsw.cfg +++ /dev/null @@ -1,73 +0,0 @@ -[server] -home=/home/pycsw -url=${PYCSW_SERVER_URL} -mimetype=application/xml; charset=UTF-8 -encoding=UTF-8 -language=en-US -{{- if .Values.env.maxrecords}} -maxrecords={{ .Values.env.maxrecords }} -{{- end}} -loglevel={{ .Values.env.loglevel }} -logfile={{ .Values.env.logfile }} -#ogc_schemas_base=http://foo -#federatedcatalogues=http://catalog.data.gov/csw -#pretty_print=true -#gzip_compresslevel=8 -#domainquerytype=range -#domaincounts=true -#spatial_ranking=true -profiles={{ .Values.env.profiles }} - -[manager] -transactions=false -allowed_ips=127.0.0.1 -#csw_harvest_pagesize=10 - -[metadata:main] -identification_title=pycsw Geospatial Catalogue -identification_abstract=pycsw is an OGC CSW server implementation written in Python -identification_keywords=catalogue,discovery,metadata -identification_keywords_type=theme -identification_fees=None -identification_accessconstraints=None -provider_name=Organization Name -provider_url=https://pycsw.org/ -contact_name=Lastname, Firstname -contact_position=Position Title -contact_address=Mailing Address -contact_city=City -contact_stateorprovince=Administrative Area -contact_postalcode=Zip or Postal Code -contact_country=Country -contact_phone=+xx-xxx-xxx-xxxx -contact_fax=+xx-xxx-xxx-xxxx -contact_email=Email Address -contact_url=Contact URL -contact_hours=Hours of Service -contact_instructions=During hours of service. Off on weekends. -contact_role=pointOfContact - -[repository] -# sqlite -#database=sqlite:////home/pycsw/tests/functionaltests/suites/cite/data/cite.db -# postgres -database={{ template "pycsw-pg-connection-string" . }} -#database=postgresql://postgres:postgres@postgis-postgis/postgres -# mysql -#database=mysql://username:password@localhost/pycsw?charset=utf8 -mappings=${PYCSW_MAPPINGS_FILEPATH} -table=${DB_SCHEMA}.records -{{- if .Values.filterProductStatus }} -filter=(product_status != 'UNPUBLISHED' AND product_status != 'BEING_DELETED') -{{- end}} -stable_sort=true -[metadata:inspire] -#enabled=true -#languages_supported=eng,gre -#default_language=eng -#date=YYYY-MM-DD -#gemet_keywords=Utility and governmental services -#conformity_service=notEvaluated -#contact_name=Organization Name -#contact_email=Email Address -#temp_extent=YYYY-MM-DD/YYYY-MM-DD diff --git a/helm/3d/config/pycswWsgi.ini b/helm/3d/config/pycswWsgi.ini deleted file mode 100644 index 3726419b..00000000 --- a/helm/3d/config/pycswWsgi.ini +++ /dev/null @@ -1,38 +0,0 @@ -[uwsgi] -; based on https://github.com/kartoza/docker-mapproxy/blob/master/build_data/uwsgi.ini -chdir = /home/pycsw/pycsw -wsgi-file = cors.py -pidfile = /tmp/pycsw.pid -socket = :{{ .Values.env.targetPort }} -processes = {{ .Values.env.uwsgi.processes }} ; Maximum number of workers allowed -cheaper = 2 ; Minimum number of workers allowed -enable-threads = true -threads = {{ .Values.env.uwsgi.threads }} -master = true -disable-logging = true -vacuum = true -die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn) -need-app = true ; This parameter prevents uWSGI from starting if it is unable to find or load your application module -max-requests = 1000 ; Restart workers after this many requests -reload-on-rss = 2048 ; Restart workers after this much resident memory -buffer-size = 14336 ; 14K, Set the internal buffer size for uwsgi packet -worker-reload-mercy = 60 ; How long to wait before forcefully killing workers -wsgi-disable-file-wrapper = true -harakiri = 60 -py-callos-afterfork = true ; allow workers to trap signals -cheaper-algo = busyness -cheaper-initial = 2 ; Workers created at startup -cheaper-overload = 1 ; Length of a cycle in seconds -cheaper-step = 2 ; How many workers to spawn at a time -cheaper-busyness-multiplier = 30 ; How many cycles to wait before killing workers -cheaper-busyness-min = 20 ; Below this threshold, kill workers (if stable for multiplier cycles) -cheaper-busyness-max = 70 ; Above this threshold, spawn new workers -cheaper-busyness-backlog-alert = 2 ; Spawn emergency workers if more than this many requests are waiting in the queue -cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue -chmod-socket = 664 -uid = 1000 -gid = 0 -http-socket = :8080 -stats = :{{ .Values.env.uwsgi.statsServer.stats }} -stats-http = {{ .Values.env.uwsgi.statsServer.enabled }} -stats-min = {{ .Values.env.uwsgi.statsServer.statsMinify }} diff --git a/helm/3d/templates/_helpers.tpl b/helm/3d/templates/_helpers.tpl deleted file mode 100644 index 29ddb521..00000000 --- a/helm/3d/templates/_helpers.tpl +++ /dev/null @@ -1,139 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "pycsw.name" -}} -{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "pycsw.fullname" -}} -{{- $name := default .Chart.Name }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "pycsw.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "pycsw.labels" -}} -helm.sh/chart: {{ include "pycsw.chart" . }} -{{ include "pycsw.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{ include "mclabels.labels" . }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "pycsw.selectorLabels" -}} -app.kubernetes.io/name: {{ include "pycsw.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{ include "mclabels.selectorLabels" . }} -{{- end }} - -{{/* - Returns the pycsw server url based on the provided values. -*/}} -{{- define "pycsw.serverURL" -}} - {{- $serverURL := "" }} - {{- if not .Values.nginx.route.host }} - {{- $serverURL = printf "http://localhost:8000" }} - {{- else -}} - {{- $protocol := .Values.nginx.route.tls.enabled | ternary "https" "http" }} - {{- $serverURL = printf "%s://%s" $protocol .Values.nginx.route.host }} - {{- if .Values.nginx.route.path }} - {{- $serverURL = printf "%s%s" $serverURL .Values.nginx.route.path }} - {{- end -}} - {{- end -}} - {{- printf "%s" $serverURL | quote }} -{{- end -}} - -{{/* -Returns the cloud provider name from the chart's values if exists or from global, defaults to minikube -*/}} -{{- define "pycsw.cloudProviderFlavor" -}} -{{- if .Values.cloudProvider.flavor }} - {{- .Values.cloudProvider.flavor -}} -{{- else -}} - {{- .Values.global.cloudProvider.flavor | default "minikube" -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tag of the chart. -*/}} -{{- define "pycsw.tag" -}} -{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }} -{{- end }} - -{{/* -Returns the cloud provider docker registry url from the chart's values if exists or from global -*/}} -{{- define "pycsw.cloudProviderDockerRegistryUrl" -}} -{{- if .Values.cloudProvider.dockerRegistryUrl }} - {{- printf "%s/" .Values.cloudProvider.dockerRegistryUrl -}} -{{- else -}} - {{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider image pull secret name from the chart's values if exists or from global -*/}} -{{- define "pycsw.cloudProviderImagePullSecretName" -}} -{{- if .Values.cloudProvider.imagePullSecretName }} - {{- .Values.cloudProvider.imagePullSecretName -}} -{{- else if .Values.global.cloudProvider.imagePullSecretName -}} - {{- .Values.global.cloudProvider.imagePullSecretName -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw-pg-connection-string" -}} -{{- "postgresql://${DB_USER}" -}} -{{- if .Values.global.postgres.user.requirePassword -}} -{{- ":${DB_PASSWORD}" -}} -{{- end -}} -{{- "@${DB_HOST}:${DB_PORT}/${DB_NAME}" -}} -{{- if .Values.global.postgres.ssl.enabled -}} -{{- "?sslmode=require" -}} -{{- if .Values.global.postgres.ssl.caFileName -}} -{{- "&sslrootcert=" -}}/.postgresql/ca.pem -{{- end -}} -{{- if .Values.global.postgres.ssl.certFileName -}} -{{- "&sslcert=" -}}/.postgresql/cert.pem -{{- end -}} -{{- if .Values.global.postgres.ssl.keyFileName -}} -{{- "&sslkey=" -}}/.postgresql/key.pem -{{- end -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw.cors.allowedHeaders" -}} -{{- $headerList := list -}} -{{- if ne .Values.authentication.cors.allowedHeaders "" -}} -{{- range $k, $v := (split "," .Values.authentication.cors.allowedHeaders) -}} -{{- $headerList = append $headerList $v -}} -{{- end -}} -{{- $headerList = uniq $headerList -}} -{{- quote (join "," $headerList) -}} -{{- else -}} -"" -{{- end -}} -{{- end -}} diff --git a/helm/3d/templates/_tplValues.tpl b/helm/3d/templates/_tplValues.tpl deleted file mode 100644 index 901d8808..00000000 --- a/helm/3d/templates/_tplValues.tpl +++ /dev/null @@ -1,92 +0,0 @@ -{{/* -Copyright VMware, Inc. -SPDX-License-Identifier: APACHE-2.0 -*/}} - -{{/* vim: set filetype=mustache: */}} -{{/* -Renders a value that contains template perhaps with scope if the scope is present. -Usage: -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} -*/}} -{{- define "common.tplvalues.render" -}} -{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} -{{- if contains "{{" (toJson .value) }} - {{- if .scope }} - {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} - {{- else }} - {{- tpl $value .context }} - {{- end }} -{{- else }} - {{- $value }} -{{- end }} -{{- end -}} - -{{/* -Merge a list of values that contains template after rendering them. -Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge -Usage: -{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} -*/}} -{{- define "common.tplvalues.merge" -}} -{{- $dst := dict -}} -{{- range .values -}} -{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} -{{- end -}} -{{ $dst | toYaml }} -{{- end -}} -{{/* -End of usage example -*/}} - -{{/* -Common definitions -*/}} -{{- define "merged.ca" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.ca .Values.global.ca ) "context" . ) }} -{{- end -}} - -{{- define "merged.podAnnotations" -}} -{{- $globalAnnotations := dict }} -{{- range $key, $value := .Values.global.podAnnotations }} - {{- if $value.enabled }} - {{- $globalAnnotations = merge $globalAnnotations $value.annotations }} - {{- end }} -{{- end }} -{{- $mergedAnnotations := merge .Values.podAnnotations $globalAnnotations }} -{{- range $key, $value := $mergedAnnotations }} -{{ $key }}: "{{ $value }}" -{{- end }} -{{- end }} - -{{- define "merged.extraVolumes" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.extraVolumes .Values.global.extraVolumes ) "context" . ) }} -{{- end -}} - -{{- define "merged.sidecars" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.sidecars .Values.global.sidecars ) "context" . ) }} -{{- end -}} - -{{- define "merged.extraVolumeMounts" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.extraVolumeMounts .Values.global.extraVolumeMounts ) "context" . ) }} -{{- end -}} - -{{- define "merged.metrics" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.env.metrics .Values.global.metrics ) "context" . ) }} -{{- end -}} - -{{- define "merged.tracing" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.env.tracing .Values.global.tracing ) "context" . ) }} -{{- end -}} - -{{/* -Custom definitions -*/}} -{{- define "merged.postgres" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.postgres .Values.global.postgres ) "context" . ) }} -{{- end -}} - -{{- define "merged.opala" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.opala .Values.global.opala ) "context" . ) }} -{{- end -}} diff --git a/helm/3d/templates/configmap-nginx.yaml b/helm/3d/templates/configmap-nginx.yaml deleted file mode 100644 index cb4878da..00000000 --- a/helm/3d/templates/configmap-nginx.yaml +++ /dev/null @@ -1,9 +0,0 @@ -{{- $fullName := include "pycsw.fullname" . -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $fullName }}-nginx-configmap -data: - default.conf: {{ tpl (.Files.Get "config/default.conf") . | quote }} - nginx.conf: {{ tpl (.Files.Get "config/nginx.conf") . | quote }} - log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} diff --git a/helm/3d/templates/configmap.yaml b/helm/3d/templates/configmap.yaml deleted file mode 100644 index 8964fc98..00000000 --- a/helm/3d/templates/configmap.yaml +++ /dev/null @@ -1,37 +0,0 @@ -{{- $chartName := include "pycsw.name" . -}} -{{- $fullName := include "pycsw.fullname" . -}} -{{- $ca := (include "merged.ca" . ) | fromYaml }} -{{- $tracing := (include "merged.tracing" . ) | fromYaml }} -{{- $metrics := (include "merged.metrics" . ) | fromYaml }} -{{- $postgres := (include "merged.postgres" . ) | fromYaml }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $fullName }} -data: - {{ if $tracing.enabled }} - TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracing.url }} - {{ end }} - {{ if $metrics.enabled }} - TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metrics.url }} - {{ end }} - {{- if $ca.enabled }} - REQUESTS_CA_BUNDLE: {{ printf "%s/%s" $ca.path $ca.key | quote }} - NODE_EXTRA_CA_CERTS: {{ printf "%s/%s" $ca.path $ca.key | quote }} - {{- end }} - pycsw.cfg: {{ tpl (.Files.Get "config/pycsw.cfg") . | quote }} - mappings.py: {{ .Files.Get "config/mappings.py" | quote }} - uwsgi.ini: {{ tpl (.Files.Get "config/pycswWsgi.ini") . | quote }} - CORS_ENABLED: {{ .Values.authentication.cors.enabled | quote }} - CORS_ALLOWED_HEADERS: {{ template "pycsw.cors.allowedHeaders" . }} - CORS_ALLOWED_ORIGIN: {{ .Values.authentication.cors.allowedOrigin | quote }} - LOG_FORMAT: {{ .Values.env.logFormat | quote }} - DB_HOST: {{ quote $postgres.host }} - DB_PORT: {{ quote $postgres.port }} - DB_NAME: {{ quote $postgres.name }} - POSTGRES_ENABLE_SSL_AUTH: {{ quote $postgres.ssl.enabled }} - DB_SCHEMA: {{ quote $postgres.schema }} - COORDINATE_PRECISION: {{ quote .Values.env.bboxPrecisionDigits }} - PGAPPNAME: {{ $chartName }} diff --git a/helm/3d/templates/deployment.yaml b/helm/3d/templates/deployment.yaml deleted file mode 100644 index a2c27598..00000000 --- a/helm/3d/templates/deployment.yaml +++ /dev/null @@ -1,202 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $fullName := include "pycsw.fullname" . -}} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -{{- $tag := include "pycsw.tag" . -}} -{{- $cloudProviderImagePullSecretName := include "pycsw.cloudProviderImagePullSecretName" . -}} -{{- $cloudProviderDockerRegistryUrl := include "pycsw.cloudProviderDockerRegistryUrl" . -}} -{{- $ca := (include "merged.ca" . ) | fromYaml }} -{{- $podAnnotations := (include "merged.podAnnotations" . ) | fromYaml }} -{{- $extraVolumes := (include "merged.extraVolumes" . ) | fromYaml }} -{{- $extraVolumeMounts := (include "merged.extraVolumeMounts" . ) | fromYaml }} -{{- $sidecars := (include "merged.sidecars" . ) | fromYaml }} -{{- $postgres := (include "merged.postgres" . ) | fromYaml }} -{{- $serverURL := include "pycsw.serverURL" . -}} - - -{{- if $ca.enabled }} -{{- if and $ca.useExternal (not $ca.secretName) }} -{{- fail "When using external ca secret the value for ca.secretName should be set" }} -{{- end }} -{{- end }} - -{{- if $postgres.ssl.enabled }} -{{- if and $postgres.ssl.useExternal (not $postgres.ssl.secretName) }} -{{- fail "When using external ssl secret the value for .Values.authentication.ssl.secretName should be set" }} -{{- end }} -{{- end }} - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ $fullName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} - selector: - matchLabels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $fullName }} - {{- include "pycsw.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $fullName }} - {{- include "pycsw.selectorLabels" . | nindent 8 }} - annotations: - {{ include "mclabels.annotations" . | nindent 8 }} - {{ include "merged.podAnnotations" . | nindent 8 }} - {{- if .Values.resetOnConfigChange }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- end }} - spec: - {{- if $cloudProviderImagePullSecretName }} - imagePullSecrets: - - name: {{ $cloudProviderImagePullSecretName | quote }} - {{- end }} - containers: - - name: {{ $fullName }}-deployment - {{- with .Values.image }} - image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $tag }} - {{- end }} - volumeMounts: - - name: pyscw-config - mountPath: /etc/pycsw/pycsw.cfg - subPath: pycsw.cfg - - name: pyscw-mappings - mountPath: /etc/pycsw/mappings.py - subPath: mappings.py - - mountPath: "/pycsw/uwsgi.ini" - name: uwsgi-config - subPath: uwsgi.ini - {{- if $ca.enabled }} - - mountPath: {{ printf "%s/%s" $ca.path $ca.key | quote }} - name: root-ca - subPath: {{ quote $ca.key }} - {{- end }} - {{- if $extraVolumeMounts -}} - {{ toYaml $extraVolumeMounts | nindent 12 }} - {{- end }} - {{- if $postgres.ssl.enabled }} - - name: ca-file - mountPath: /certs/ca.crt - subPath: ca.pem - - name: key-file - mountPath: /certs/key.pem - subPath: key.pem - - name: cert-file - mountPath: /certs/cert.pem - subPath: cert.pem - {{- end }} - env: - - name: PYCSW_SERVER_URL - value: {{ $serverURL }} - - name: PYCSW_MAPPINGS_FILEPATH - value: /etc/pycsw/mappings.py - - name: DB_USER - valueFrom: - secretKeyRef: - name: {{ $postgres.user.secretName }} - key: username - {{- if $postgres.user.requirePassword }} - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: {{ $postgres.user.secretName }} - key: password - {{- end }} - {{- if $postgres.ssl.enabled }} - - name: POSTGRES_CERTS_MOUNT_PATH - value: /certs - - name: POSTGRES_CERT_FILE_NAME - value: cert.pem - - name: POSTGRES_KEY_FILE_NAME - value: key.pem - {{- end }} - envFrom: - - configMapRef: - name: {{ $fullName }} - ports: - - name: http - containerPort: {{ .Values.env.targetPort }} - protocol: {{ .Values.env.protocol }} - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - httpGet: - path: {{ .Values.livenessProbe.path }} - port: {{ .Values.env.port }} - {{- end }} - {{- if .Values.readinessProbe.enabled }} - readinessProbe: - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - httpGet: - path: {{ .Values.readinessProbe.path }} - port: {{ .Values.env.port }} - {{- end }} - {{- if .Values.resources.enabled }} - resources: - {{- toYaml .Values.resources.value | nindent 12 }} - {{- end }} - {{- if $sidecars }} - {{ tpl ($sidecars) . | nindent 8 }} - {{- end }} - volumes: - {{- if $ca.enabled }} - - name: root-ca - secret: - secretName: {{ $ca.secretName }} - {{- end }} - {{- if $extraVolumes -}} - {{ tpl (toYaml $extraVolumes) . | nindent 8 }} - {{- end }} - - name: pyscw-config - configMap: - name: {{ $fullName }} - items: - - key: "pycsw.cfg" - path: "pycsw.cfg" - - name: pyscw-mappings - configMap: - name: {{ $fullName }} - items: - - key: "mappings.py" - path: "mappings.py" - - name: uwsgi-config - configMap: - name: {{ $fullName }} - items: - - key: "uwsgi.ini" - path: "uwsgi.ini" - {{- if $postgres.ssl.enabled }} - - name: ca-file - secret: - secretName: {{ $postgres.ssl.secretName }} - items: - - key: {{ $postgres.ssl.caFileName }} - path: ca.pem - - name: key-file - secret: - secretName: {{ $postgres.ssl.secretName }} - items: - - key: {{ $postgres.ssl.keyFileName }} - path: key.pem - - name: cert-file - secret: - secretName: {{ $postgres.ssl.secretName }} - items: - - key: {{ $postgres.ssl.certFileName }} - path: cert.pem - {{- end }} diff --git a/helm/3d/templates/service.yaml b/helm/3d/templates/service.yaml deleted file mode 100644 index e4419c4a..00000000 --- a/helm/3d/templates/service.yaml +++ /dev/null @@ -1,30 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $fullName := include "pycsw.fullname" . -}} -{{- $serviceName := include "pycsw.fullname" . -}} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -apiVersion: v1 -kind: Service -metadata: - name: {{ $fullName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} -spec: - {{- if eq $cloudProviderFlavor "minikube" }} - type: NodePort - {{- end }} - ports: - - port: {{ .Values.env.port }} - targetPort: {{ .Values.env.targetPort }} - protocol: {{ .Values.env.protocol }} - {{- if eq $cloudProviderFlavor "minikube" }} - nodePort: {{ .Values.nodePort }} - {{- end }} - selector: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $fullName }} - {{- include "pycsw.selectorLabels" . | nindent 4 }} diff --git a/helm/3d/values.yaml b/helm/3d/values.yaml deleted file mode 100644 index c94c93db..00000000 --- a/helm/3d/values.yaml +++ /dev/null @@ -1,205 +0,0 @@ -global: - cloudProvider: - dockerRegistryUrl: test # - Filled for Helm lint to pass - flavor: openshift - imagePullSecretName: - imagePullPolicy: IfNotPresent - tracing: {} - metrics: {} - opala: - enabled: - - postgres: - host: - port: - schema: - name: - user: - requirePassword: false - rejectUnauthorized: false - useExternal: false - secretName: '' - username: '' - password: '' - ssl: - enabled: false - useExternal: false - secretName: '' - caFileName: '' - certFileName: '' - keyFileName: '' - -cloudProvider: - dockerRegistryUrl: # test # - Fill for Helm lint to pass - flavor: - imagePullSecretName: - -imagePullPolicy: - -image: - repository: pycsw - tag: - -nodePort: 30030 -replicaCount: 1 -revisionHistoryLimit: 3 # Amount of revisions we keep - -authentication: - cors: - enabled: true - allowedOrigin: '*' - allowedHeaders: '*' - -postgres: - host: - port: - schema: - name: - user: - requirePassword: false - rejectUnauthorized: false - useExternal: false - secretName: '' - username: '' - password: '' - ssl: - enabled: false - useExternal: false - secretName: '' - caFileName: '' - certFileName: '' - keyFileName: '' - -livenessProbe: - enabled: true - initialDelaySeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - path: /csw?service=CSW&request=GetCapabilities&version=3.0.0 - -readinessProbe: - enabled: true - initialDelaySeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - path: /csw?service=CSW&request=GetCapabilities&version=3.0.0 - -ca: - enabled: false - useExternal: false - secretName: - path: - key: - -extraVolumes: {} - -extraVolumeMounts: {} - -sidecars: {} - -podAnnotations: {} - -mclabels: - component: backend - partOf: serving - owner: 3d - gisDomain: 3d - logScraping: true - -opala: - enabled: - domain: - url: - -env: - port: 8080 - targetPort: 8000 - protocol: TCP - logLevel: WARNING - maxRecords: 50 - logfile: '' - profiles: mc_3d - bboxPrecisionDigits: 10 - logFormat: >- - %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" - %({x-forwarded-for}i)s %(L)s - tracing: - enabled: false - url: http://localhost:55681/v1/trace - metrics: - enabled: false - url: 'http://localhost:55681/v1/metrics' - uwsgi: - processes: - threads: - statsServer: - enabled: - stats: - statsMinify: - -filterProductStatus: false - -resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi - -route: - enabled: false - path: / - host: - timeout: - enabled: false # defaults to 30s by openshift - duration: 60s # supported units (us, ms, s, m, h, d) - rewriteTarget: '' - tls: - enabled: true - termination: edge - insecureEdgeTerminationPolicy: Redirect - useCerts: false - certificate: '' - key: '' - caCertificate: '' - -ingress: - enabled: false - path: / - host: localhost - cors: - enabled: true - origin: '*' - -nginx: - enabled: false - nameOverride: - replicaCount: 1 - environment: development - port: 8080 - internalServicePort: 80 - targetPort: 8080 - servicePort: 8080 - nodePort: 30001 - route: - enabled: - -uwsgiExporter: - image: - repository: "timonwong/uwsgi-exporter" - tag: "latest" - env: - logLevel: info # one of [debug, info, warn, error] - port: 9117 - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi diff --git a/helm/dem/.helmignore b/helm/dem/.helmignore deleted file mode 100644 index 0cb7b3bf..00000000 --- a/helm/dem/.helmignore +++ /dev/null @@ -1,26 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ -*.txt -*local.json -*local.yaml diff --git a/helm/dem/Chart.yaml b/helm/dem/Chart.yaml deleted file mode 100644 index cd629109..00000000 --- a/helm/dem/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v2 -name: pycsw -description: A Helm chart for pycsw service -type: application -version: 6.6.1 -appVersion: 6.6.1 -dependencies: - - name: nginx - version: 1.1.0 - repository: oci://acrarolibotnonprod.azurecr.io/helm - - name: mclabels - version: 1.0.1 - repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/dem/config/default.conf b/helm/dem/config/default.conf deleted file mode 100644 index c1386b7b..00000000 --- a/helm/dem/config/default.conf +++ /dev/null @@ -1,61 +0,0 @@ - -{{- $chartName := include "pycsw.name" . -}} -{{- $serviceName := include "service.fullname" . -}} -{{- $releaseName := .Release.Name -}} - -{{- $opalaEnabled := .Values.nginx.authorization.enabled }} - - -upstream pycsw { - server {{ $serviceName }}:{{ .Values.servicePort }}; -} - -server { - listen {{ .Values.nginx.nginxTargetPort }}; - # the domain name it will serve for - server_name pycsw; - # max upload size, adjust to taste - keepalive_timeout 500; - proxy_connect_timeout 600; - proxy_send_timeout 600; - send_timeout 600; - client_max_body_size 5000; - client_header_timeout 600; - client_body_timeout 600; - client_header_buffer_size 12288; # 12K - large_client_header_buffers 4 12288; # 12K - fastcgi_read_timeout 300; - location /liveness { - access_log off; - log_not_found off; - return 200 "I'm alive\n"; - } - location / { - set $original_method $request_method; - set $original_args $args; - {{- if $opalaEnabled }} - set $domain {{ .Values.nginx.authorization.domain }}; - auth_request /_validate_jwt; - {{ end }} - - include uwsgi_params; - uwsgi_pass pycsw; - uwsgi_hide_header Set-Cookie; # ensures the header will not be passed back to the client - uwsgi_param HTTP_Cookie ""; # ensures that a client cannot pass any prior cookies to the webapp and spoil your cache - } - - {{- if $opalaEnabled }} - location = /_validate_jwt { - internal; - - js_content auth.opaAuth; - } - - location = /opa { - internal; - - proxy_set_header Content-Type application/json; - proxy_pass {{ .Values.nginx.authorization.url }}; - } - {{ end }} -} diff --git a/helm/dem/config/log_format.conf b/helm/dem/config/log_format.conf deleted file mode 100644 index b2f323fa..00000000 --- a/helm/dem/config/log_format.conf +++ /dev/null @@ -1,81 +0,0 @@ -map $msec $nanosec { - ~(.*)\.(.*) $1$2000000; -} - -log_format json escape=json - '{' - '"Timestamp": $nanosec,' - '"Attributes": {' - '"mapcolonies.time_local":"$time_local",' - {{ if and (.Values.global.opalaEnabled) (.Values.nginx.authorization.enabled) }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' - {{ end }} - '"http.status_code": $status,' - '"http.url": "$http_referer",' - '"http.x_forwarded_for": "$http_x_forwarded_for",' - '"http.proxy_add_x_forwarded_for": "$proxy_add_x_forwarded_for",' - '"http.user_agent": "$http_user_agent",' - '"http.request_time": $request_time,' - '"request_length": "$request_length",' - '"http.host": "$host",' - '"upstream_addr": "$upstream_addr",' - '"upstream_status": "$upstream_status",' - '"upstream_connect_time": "$upstream_connect_time",' - '"upstream_header_time": "$upstream_header_time",' - '"upstream_response_time": "$upstream_response_time",' - '"upstream_response_length": "$upstream_response_length",' - '"upstream_bytes_sent": "$upstream_bytes_sent",' - '"upstream_bytes_received": "$upstream_bytes_received",' - '"upstream_http_name": "$upstream_http_name",' - '"bytes_sent": "$bytes_sent",' - '"body_bytes_sent": "$body_bytes_sent",' - '"content_type":"$content_type",' - '"content_length":"$content_length",' - '"remote_addr": "$remote_addr",' - '"remote_port": "$remote_port",' - '"remote_user": "$remote_user",' - '"connection":"$connection",' - '"cache_status":"$upstream_cache_status",' - '"connection_requests": "$connection_requests",' - '"connections_active": "$connections_active",' - '"connections_reading": "$connections_reading",' - '"connections_writing": "$connections_writing",' - '"connections_waiting": "$connections_waiting",' - '"ancient_browser": "$ancient_browser",' - '"modern_browser": "$modern_browser",' - '"binary_remote_addr": "$binary_remote_addr",' - '"hostname": "$hostname",' - '"http_name": "$http_name",' - '"pid": "$pid",' - '"proxy_protocol_addr": "$proxy_protocol_addr",' - '"proxy_protocol_port": "$proxy_protocol_port",' - '"proxy_protocol_server_addr": "$proxy_protocol_server_addr",' - '"proxy_protocol_server_port": "$proxy_protocol_server_port",' - '"proxy_host": "$proxy_host",' - '"proxy_port": "$proxy_port",' - '"realip_remote_addr": "$realip_remote_addr",' - '"realip_remote_port": "$realip_remote_port",' - '"server_name": "$server_name",' - '"server_addr ": "$server_addr ",' - '"server_port": "$server_port",' - '"server_protocol": "$server_protocol",' - '"tcpinfo_rtt": "$tcpinfo_rtt",' - '"tcpinfo_rttvar": "$tcpinfo_rttvar",' - '"tcpinfo_snd_cwnd": "$tcpinfo_snd_cwnd",' - '"tcpinfo_rcv_space": "$tcpinfo_rcv_space",' - '"uid_got": "$uid_got",' - '"uid_reset": "$uid_reset",' - '"uid_set": "$uid_set"' - '},' - '"TraceId": "$opentelemetry_trace_id",' ## this is a byte sequence (hex-encoded in JSON) - '"SpanId": "$opentelemetry_span_id",' - {{ if .Values.nginx.authorization.enabled }} - '"TokenUser": "$jwt_payload_sub",' - {{ else }} - '"TokenUser": "NoAuth",' - {{ end }} - '"SeverityText": "INFO",' - '"SeverityNumber": 9,' - '"RequestBody": "$request_body",' - '"Body": "$request"' - '}'; diff --git a/helm/dem/config/mappings.py b/helm/dem/config/mappings.py deleted file mode 100644 index 95b03837..00000000 --- a/helm/dem/config/mappings.py +++ /dev/null @@ -1,68 +0,0 @@ -MD_CORE_MODEL = { - 'typename': 'pycsw:CoreMetadata', - 'outputschema': 'http://pycsw.org/metadata', - 'mappings': { - # Needed for PYCSW - 'pycsw:Identifier': 'identifier', - 'pycsw:Typename': 'typename', - 'pycsw:Schema': 'schema', - 'pycsw:MdSource': 'mdsource', - 'pycsw:InsertDate': 'insert_date_utc', - 'pycsw:XML': 'xml', - 'pycsw:AnyText': 'anytext', - 'pycsw:BoundingBox': 'wkt_geometry', - 'pycsw:Links': 'links', - 'pycsw:Keywords': 'keywords', - 'pycsw:Type': 'type', - 'pycsw:Title': 'product_name', - 'pycsw:Abstract': 'description', - 'pycsw:AlternateTitle': 'product_name', - 'pycsw:AccessConstraints': 'classification', - 'pycsw:Creator': 'producer_name', - 'pycsw:CRS': 'srs_id', - 'pycsw:Publisher': 'producer_name', - 'pycsw:Contributor': 'producer_name', - 'pycsw:CreationDate': 'creation_date_utc', - 'pycsw:Date': 'creation_date_utc', - 'pycsw:Format': 'type', - 'pycsw:Modified': 'update_date_utc', - 'pycsw:Source': 'product_name', - 'pycsw:Relation': '', - 'pycsw:Language': '', - 'pycsw:TopicCategory': '', - - # Common profile fields - 'pycsw:Classification': 'classification', - 'pycsw:ProductId': 'product_id', - 'pycsw:ProductVersion': 'product_version', - 'pycsw:ProductType': 'product_type', - 'pycsw:productSubType': 'product_sub_type', - 'pycsw:CRSName': 'srs_name', - 'pycsw:updateDateUTC': 'update_date_utc', - 'pycsw:ingestionDateUTC': 'ingestion_date_utc', - 'pycsw:TempExtent_begin': 'acquisition_time_begin_utc', - 'pycsw:TempExtent_end': 'acquisition_time_end_utc', - 'pycsw:maxResolutionDegree': 'max_resolution_degree', - 'pycsw:minResolutionDegree': 'min_resolution_degree', - 'pycsw:maxResolutionMeter': 'max_resolution_meter', - 'pycsw:minResolutionMeter': 'min_resolution_meter', - 'pycsw:maxHorizontalAccuracyCEP90': 'max_horizontal_accuracy_cep_90', - 'pycsw:minHorizontalAccuracyCEP90': 'min_horizontal_accuracy_cep_90', - 'pycsw:maxAbsoluteAccuracyLEP90': 'max_absolute_accuracy_lep_90', - 'pycsw:minAbsoluteAccuracyLEP90': 'min_absolute_accuracy_lep_90', - 'pycsw:maxRelativeAccuracyLEP90': 'max_relative_accuracy_lep_90', - 'pycsw:minRelativeAccuracyLEP90': 'min_relative_accuracy_lep_90', - 'pycsw:sensorType': 'sensors', - 'pycsw:region': 'region', - 'pycsw:footprint': 'footprint_geojson', - 'pycsw:noDataValue': 'no_data_value', - 'pycsw:areaOrPoint': 'area_or_point', - 'pycsw:dataType': 'data_type', - 'pycsw:verticalType': 'vertical_type', - 'pycsw:verticalSrsId': 'vertical_srs_id', - 'pycsw:verticalSrsName': 'vertical_srs_name', - - 'pycsw:productBBox':'product_bbox', - 'pycsw:productStatus': 'product_status', - } -} diff --git a/helm/dem/config/nginx.conf b/helm/dem/config/nginx.conf deleted file mode 100644 index 6e1d7c35..00000000 --- a/helm/dem/config/nginx.conf +++ /dev/null @@ -1,37 +0,0 @@ -#user nginx; -worker_processes 4; - -error_log /var/log/nginx/error.log notice; -pid /tmp/nginx.pid; -load_module modules/ngx_http_js_module.so; -load_module /otel/otel_ngx_module.so; - - - -events { - worker_connections 1024; -} - - -http { - opentelemetry_config /otel/otel-nginx.toml; - include /etc/nginx/mime.types; - default_type application/octet-stream; - - {{ if .Values.nginx.authorization.enabled }} - js_import auth from /etc/nginx/auth.js; - js_set $jwt_payload_sub auth.jwtPayloadSub; - {{ end }} - - include /etc/nginx/log_format.conf; - access_log /var/log/nginx/access.log json; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/helm/dem/config/pycsw.cfg b/helm/dem/config/pycsw.cfg deleted file mode 100644 index fbe03ddb..00000000 --- a/helm/dem/config/pycsw.cfg +++ /dev/null @@ -1,74 +0,0 @@ -[server] -home=/home/pycsw -url=${PYCSW_SERVER_URL} -mimetype=application/xml; charset=UTF-8 -encoding=UTF-8 -language=en-US -{{- if .Values.env.maxrecords}} -maxrecords={{ .Values.env.maxrecords }} -{{- end}} -loglevel={{ .Values.env.loglevel }} -logfile={{ .Values.env.logfile }} -#ogc_schemas_base=http://foo -#federatedcatalogues=http://catalog.data.gov/csw -#pretty_print=true -#gzip_compresslevel=8 -#domainquerytype=range -#domaincounts=true -#spatial_ranking=true -profiles={{ .Values.env.profiles }} - -[manager] -transactions=false -allowed_ips=127.0.0.1 -#csw_harvest_pagesize=10 - -[metadata:main] -identification_title=pycsw Geospatial Catalogue -identification_abstract=pycsw is an OGC CSW server implementation written in Python -identification_keywords=catalogue,discovery,metadata -identification_keywords_type=theme -identification_fees=None -identification_accessconstraints=None -provider_name=Organization Name -provider_url=https://pycsw.org/ -contact_name=Lastname, Firstname -contact_position=Position Title -contact_address=Mailing Address -contact_city=City -contact_stateorprovince=Administrative Area -contact_postalcode=Zip or Postal Code -contact_country=Country -contact_phone=+xx-xxx-xxx-xxxx -contact_fax=+xx-xxx-xxx-xxxx -contact_email=Email Address -contact_url=Contact URL -contact_hours=Hours of Service -contact_instructions=During hours of service. Off on weekends. -contact_role=pointOfContact - -[repository] -# sqlite -#database=sqlite:////home/pycsw/tests/functionaltests/suites/cite/data/cite.db -# postgres -database={{ template "pycsw-pg-connection-string" . }} -#database=postgresql://postgres:postgres@postgis-postgis/postgres -# mysql -#database=mysql://username:password@localhost/pycsw?charset=utf8 -mappings=${PYCSW_MAPPINGS_FILEPATH} -table=${DB_SCHEMA}.records -#filter=type = 'http://purl.org/dc/dcmitype/Dataset' -{{- if .Values.filterProductStatus }} -filter=(product_status != 'UNPUBLISHED' AND product_status != 'BEING_DELETED') -{{- end }} -stable_sort=true -[metadata:inspire] -#enabled=true -#languages_supported=eng,gre -#default_language=eng -#date=YYYY-MM-DD -#gemet_keywords=Utility and governmental services -#conformity_service=notEvaluated -#contact_name=Organization Name -#contact_email=Email Address -#temp_extent=YYYY-MM-DD/YYYY-MM-DD diff --git a/helm/dem/config/pycswWsgi.ini b/helm/dem/config/pycswWsgi.ini deleted file mode 100644 index 4c9d53e5..00000000 --- a/helm/dem/config/pycswWsgi.ini +++ /dev/null @@ -1,38 +0,0 @@ -[uwsgi] -; based on https://github.com/kartoza/docker-mapproxy/blob/master/build_data/uwsgi.ini -chdir = /home/pycsw/pycsw -wsgi-file = cors.py -pidfile = /tmp/pycsw.pid -socket = :{{ .Values.pycswPort }} -processes = {{ .Values.env.uwsgi.processes }} ; Maximum number of workers allowed -cheaper = 2 ; Minimum number of workers allowed -enable-threads = true -threads = {{ .Values.env.uwsgi.threads }} -master = true -disable-logging = true -vacuum = true -die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn) -need-app = true ; This parameter prevents uWSGI from starting if it is unable to find or load your application module -max-requests = 1000 ; Restart workers after this many requests -reload-on-rss = 2048 ; Restart workers after this much resident memory -buffer-size = 14336 ; 14K, Set the internal buffer size for uwsgi packet -worker-reload-mercy = 60 ; How long to wait before forcefully killing workers -wsgi-disable-file-wrapper = true -harakiri = 60 -py-callos-afterfork = true ; allow workers to trap signals -cheaper-algo = busyness -cheaper-initial = 2 ; Workers created at startup -cheaper-overload = 1 ; Length of a cycle in seconds -cheaper-step = 2 ; How many workers to spawn at a time -cheaper-busyness-multiplier = 30 ; How many cycles to wait before killing workers -cheaper-busyness-min = 20 ; Below this threshold, kill workers (if stable for multiplier cycles) -cheaper-busyness-max = 70 ; Above this threshold, spawn new workers -cheaper-busyness-backlog-alert = 2 ; Spawn emergency workers if more than this many requests are waiting in the queue -cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue -chmod-socket = 664 -uid = 1000 -gid = 0 -http-socket = :8080 -stats = :{{ .Values.env.uwsgi.statsServer.stats }} -stats-http = {{ .Values.env.uwsgi.statsServer.enabled }} -stats-min = {{ .Values.env.uwsgi.statsServer.statsMinify }} diff --git a/helm/dem/templates/_helpers.tpl b/helm/dem/templates/_helpers.tpl deleted file mode 100644 index 4613eb62..00000000 --- a/helm/dem/templates/_helpers.tpl +++ /dev/null @@ -1,173 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "pycsw.name" -}} -{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "pycsw.fullname" -}} -{{- $name := default .Chart.Name }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "pycsw.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "pycsw.labels" -}} -helm.sh/chart: {{ include "pycsw.chart" . }} -{{ include "pycsw.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{ include "mclabels.labels" . }} -{{- end }} - -{{/* -Returns the tag of the chart. -*/}} -{{- define "pycsw.tag" -}} -{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "pycsw.selectorLabels" -}} -app.kubernetes.io/name: {{ include "pycsw.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{ include "mclabels.selectorLabels" . }} -{{- end }} - -{{/* -Returns the environment from global if exists or from the chart's values, defaults to development -*/}} -{{- define "pycsw.environment" -}} -{{- if .Values.global.environment }} - {{- .Values.global.environment -}} -{{- else -}} - {{- .Values.environment | default "development" -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the pycsw server url based on the provided values, default localhost -*/}} -{{- define "pycsw.serverURL" -}} - {{- if not .Values.nginx.route.host }} - {{- printf "http://localhost:8000" -}} - {{- else -}} - {{- $protocol := ternary "https" "http" .Values.nginx.route.tls.enabled -}} - {{- printf "%s://%s" $protocol .Values.nginx.route.host -}} - {{- if .Values.nginx.route.path -}} - {{- printf "%s" .Values.nginx.route.path -}} - {{- end -}} - {{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube -*/}} -{{- define "pycsw.cloudProviderFlavor" -}} -{{- if .Values.global.cloudProvider.flavor }} - {{- .Values.global.cloudProvider.flavor -}} -{{- else if .Values.cloudProvider -}} - {{- .Values.cloudProvider.flavor | default "minikube" -}} -{{- else -}} - {{ "minikube" }} -{{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider docker registry url from global if exists or from the chart's values -*/}} -{{- define "pycsw.cloudProviderDockerRegistryUrl" -}} -{{- if .Values.global.cloudProvider.dockerRegistryUrl }} - {{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}} -{{- else if .Values.cloudProvider.dockerRegistryUrl -}} - {{- printf "%s/" .Values.cloudProvider.dockerRegistryUrl -}} -{{- else -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider image pull secret name from global if exists or from the chart's values -*/}} -{{- define "pycsw.cloudProviderImagePullSecretName" -}} -{{- if .Values.global.cloudProvider.imagePullSecretName }} - {{- .Values.global.cloudProvider.imagePullSecretName -}} -{{- else if .Values.cloudProvider.imagePullSecretName -}} - {{- .Values.cloudProvider.imagePullSecretName -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tracing url from global if exists or from the chart's values -*/}} -{{- define "pycsw.tracingUrl" -}} -{{- if .Values.global.tracing.url }} - {{- .Values.global.tracing.url -}} -{{- else if .Values.cloudProvider -}} - {{- .Values.env.tracing.url -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tracing url from global if exists or from the chart's values -*/}} -{{- define "pycsw.metricsUrl" -}} -{{- if .Values.global.metrics.url }} - {{- .Values.global.metrics.url -}} -{{- else -}} - {{- .Values.env.metrics.url -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw-pg-connection-string" -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{- "postgresql://${DB_USER}" -}} -{{- if .Values.env.db.requirePassword -}} -{{- ":${DB_PASSWORD}" -}} -{{- end -}} -{{- "@${DB_HOST}:${DB_PORT}/${DB_NAME}" -}} -{{- if $db.sslEnabled -}} -{{- "?sslmode=require" -}} -{{- if $db.secrets.caFileKey -}} -{{- "&sslrootcert=" -}}/.postgresql/ca.pem -{{- end -}} -{{- if $db.secrets.certFileKey -}} -{{- "&sslcert=" -}}/.postgresql/cert.pem -{{- end -}} -{{- if $db.secrets.keyFileKey -}} -{{- "&sslkey=" -}}/.postgresql/key.pem -{{- end -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw.cors.allowedHeaders" -}} -{{- $authentication := (include "common.authentication.merged" .) | fromYaml }} -{{- $headerList := list -}} -{{- if ne .Values.env.cors.allowedHeaders "" -}} -{{- range $k, $v := (split "," .Values.env.cors.allowedHeaders) -}} -{{- $headerList = append $headerList $v -}} -{{- end -}} -{{- $headerList = uniq $headerList -}} -{{- quote (join "," $headerList) -}} -{{- end -}} -{{- end -}} diff --git a/helm/dem/templates/_resources.tpl b/helm/dem/templates/_resources.tpl deleted file mode 100644 index bf7a281f..00000000 --- a/helm/dem/templates/_resources.tpl +++ /dev/null @@ -1,42 +0,0 @@ -{{/* -Create service name as used by the service name label. -*/}} -{{- define "service.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "service" }} -{{- end }} - -{{/* -Create configmap name as used by the service name label. -*/}} -{{- define "configmap.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "configmap" | indent 1 }} -{{- end }} - -{{/* -Create pycsw nginx configmap name as used by the service name label. -*/}} -{{- define "nginx-configmap.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "nginx-configmap" | indent 1 }} -{{- end }} - -{{/* -Create deployment name as used by the service name label. -*/}} -{{- define "deployment.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "deployment" | indent 1 }} -{{- end }} - - -{{/* -Create route name as used by the service name label. -*/}} -{{- define "route.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "route" | indent 1 }} -{{- end }} - -{{/* -Create ingress name as used by the service name label. -*/}} -{{- define "ingress.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "ingress" | indent 1 }} -{{- end }} diff --git a/helm/dem/templates/_tplValues.tpl b/helm/dem/templates/_tplValues.tpl deleted file mode 100644 index 36a81f4a..00000000 --- a/helm/dem/templates/_tplValues.tpl +++ /dev/null @@ -1,54 +0,0 @@ -{{/* -Copyright VMware, Inc. -SPDX-License-Identifier: APACHE-2.0 -*/}} - -{{/* vim: set filetype=mustache: */}} -{{/* -Renders a value that contains template perhaps with scope if the scope is present. -Usage: -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} -*/}} -{{- define "common.tplvalues.render" -}} -{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} -{{- if contains "{{" (toJson .value) }} - {{- if .scope }} - {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} - {{- else }} - {{- tpl $value .context }} - {{- end }} -{{- else }} - {{- $value }} -{{- end }} -{{- end -}} - -{{/* -Merge a list of values that contains template after rendering them. -Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge -Usage: -{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} -*/}} -{{- define "common.tplvalues.merge" -}} -{{- $dst := dict -}} -{{- range .values -}} -{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} -{{- end -}} -{{ $dst | toYaml }} -{{- end -}} - -{{/* -End of usage example -*/}} - -{{/* -Custom definitions -*/}} - -{{- define "common.db.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.db .Values.global.db ) "context" . ) }} -{{- end -}} - -{{- define "common.authentication.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.authentication .Values.global.authentication ) "context" . ) }} -{{- end -}} diff --git a/helm/dem/templates/configmap.yaml b/helm/dem/templates/configmap.yaml deleted file mode 100644 index fa8dcc2b..00000000 --- a/helm/dem/templates/configmap.yaml +++ /dev/null @@ -1,35 +0,0 @@ -{{- $chartName := include "pycsw.name" . -}} -{{- $configmapName := include "configmap.fullname" . }} -{{- $tracingUrl := include "pycsw.tracingUrl" . -}} -{{- $metricsUrl := include "pycsw.metricsUrl" . -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{- if .Values.enabled -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $configmapName }} -data: - {{ if .Values.env.tracing.enabled }} - TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracingUrl }} - {{ end }} - {{ if .Values.env.metrics.enabled }} - TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metricsUrl }} - {{ end }} - pycsw.cfg: {{ tpl (.Files.Get "config/pycsw.cfg") . | quote }} - mappings.py: {{ .Files.Get "config/mappings.py" | quote }} - uwsgi.ini: {{ tpl (.Files.Get "config/pycswWsgi.ini") . | quote }} - CORS_ENABLED: {{ .Values.env.cors.enabled | quote }} - CORS_ALLOWED_HEADERS: {{ template "pycsw.cors.allowedHeaders" . }} - CORS_ALLOWED_ORIGIN: {{ .Values.env.cors.allowedOrigin | quote }} - LOG_FORMAT: {{ .Values.env.logFormat | quote }} - DB_HOST: {{ $db.host }} - DB_PORT: {{ $db.port | quote }} - DB_NAME: {{ $db.name }} - POSTGRES_ENABLE_SSL_AUTH: {{ $db.sslEnabled | quote }} - DB_SCHEMA: {{ quote .Values.env.db.schema }} - PGAPPNAME: {{ $chartName }} - COORDINATE_PRECISION: {{ quote .Values.env.bboxPrecisionDigits }} - AUTH_ENABLED: {{ .Values.nginx.authorization.enabled | quote }} #maybe deprecated or used in other networks -{{- end }} diff --git a/helm/dem/templates/deployment.yaml b/helm/dem/templates/deployment.yaml deleted file mode 100644 index d15690e3..00000000 --- a/helm/dem/templates/deployment.yaml +++ /dev/null @@ -1,214 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $configmapName := include "configmap.fullname" . }} -{{- $deploymentName := include "deployment.fullname" . }} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -{{- $cloudProviderDockerRegistryUrl := include "pycsw.cloudProviderDockerRegistryUrl" . -}} -{{- $cloudProviderImagePullSecretName := include "pycsw.cloudProviderImagePullSecretName" . -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{ $sslSecretName := ternary .Values.authentication.ssl.externalSecretName (printf "%s%s" .Release.Name "-open-ssl") .Values.authentication.ssl.useExternal }} -{{ $postgresSecretName := ternary $db.secrets.externalSecretName (printf "%s%s" .Release.Name "-postgres-secret") $db.secrets.useExternal }} -{{- $imageTag := include "pycsw.tag" . -}} -{{- $serverURL := include "pycsw.serverURL" . -}} - -{{- if .Values.enabled -}} - -{{- if .Values.authentication.ssl.enabled }} -{{- if and .Values.authentication.ssl.useExternal (not .Values.authentication.ssl.externalSecretName) }} -{{- fail "When using external ssl secret the value for .Values.authentication.ssl.externalSecretName should be set" }} -{{- end }} -{{- end }} - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ $deploymentName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - environment: {{ include "pycsw.environment" . }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} - annotations: - collectord.io/index: {{ quote .Values.splunkIndex }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 8 }} - annotations: - {{- if .Values.resetOnConfigChange }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- end }} - {{- if .Values.podAnnotations }} - {{- toYaml .Values.podAnnotations | nindent 8 }} - {{- end }} - {{ include "mclabels.annotations" . | nindent 8 }} - - spec: - {{- if $cloudProviderImagePullSecretName }} - imagePullSecrets: - - name: {{ $cloudProviderImagePullSecretName | quote }} - {{- end }} - containers: - - name: {{ $releaseName }} - {{- with .Values.image }} - image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }} - {{- end }} - volumeMounts: - {{- if .Values.global.ca.secretName }} - - mountPath: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} - name: root-ca - subPath: {{ quote .Values.caKey }} - {{- end }} - {{- if .Values.global.ca.secretName }} - - name: root-ca - mountPath: "/usr/local/share/ca-certificates" - {{- end }} - {{- if .Values.authentication.ssl.enabled }} - - name: open-ssl - mountPath: "/etc/ssl/openssl.cnf" - subPath: "openssl.cnf" - {{- end }} - - name: pyscw-config - mountPath: /etc/pycsw/pycsw.cfg - subPath: pycsw.cfg - - name: pyscw-mappings - mountPath: /etc/pycsw/mappings.py - subPath: mappings.py - - mountPath: "/pycsw/uwsgi.ini" - name: uwsgi-config - subPath: uwsgi.ini - {{- if $db.sslEnabled }} - {{- if $db.secrets.caFileKey }} - - name: ca-file - mountPath: /certs/ca.crt - subPath: ca.pem - {{- end }} - {{- if $db.secrets.keyFileKey }} - - name: key-file - mountPath: /certs/key.pem - subPath: key.pem - {{- end }} - {{- if $db.secrets.certFileKey }} - - name: cert-file - mountPath: /certs/cert.pem - subPath: cert.pem - {{- end }} - {{- end }} - env: - {{- if .Values.global.ca.secretName }} - - name: REQUESTS_CA_BUNDLE - value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }} - - name: NODE_EXTRA_CA_CERTS - value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }} - {{- end }} - - name: PYCSW_SERVER_URL - value: {{ $serverURL }} - - name: PYCSW_MAPPINGS_FILEPATH - value: /etc/pycsw/mappings.py - - name: DB_USER - valueFrom: - secretKeyRef: - name: {{ $postgresSecretName }} - key: username - {{- if .Values.env.db.requirePassword }} - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: {{ $postgresSecretName }} - key: password - {{- end }} - - name: POSTGRES_CERTS_MOUNT_PATH - value: /certs - - name: POSTGRES_CERT_FILE_NAME - value: cert.pem - - name: POSTGRES_KEY_FILE_NAME - value: key.pem - envFrom: - - configMapRef: - name: {{ $configmapName }} - ports: - - name: http - containerPort: {{ .Values.pycswPort }} - protocol: TCP - readinessProbe: - httpGet: - path: /csw?service=CSW&request=GetCapabilities&version=3.0.0 - port: 8080 - initialDelaySeconds: 30 - timeoutSeconds: 5 - {{- if .Values.resources.enabled }} - resources: - {{- toYaml .Values.resources.value | nindent 12 }} - {{- end }} - ################################################## uwsgi exporter deployment############################################## - {{- if .Values.env.metrics.enabled }} - {{- template "pycsw-chart.uwsgi-exporter-container" (merge (dict "releaseName" .releaseName "chartName" .chartName "cloudProviderDockerRegistryUrl" $cloudProviderDockerRegistryUrl "resources" .Values.uwsgiExporter.resources) .) }} - {{- end }} - volumes: - {{- if .Values.global.ca.secretName }} - - name: root-ca - secret: - secretName: {{ .Values.global.ca.secretName }} - {{- end }} - {{- if .Values.authentication.ssl.enabled }} - - name: open-ssl - secret: - secretName: {{ $sslSecretName }} - {{- end }} - - name: pyscw-config - configMap: - name: {{ $configmapName }} - items: - - key: "pycsw.cfg" - path: "pycsw.cfg" - - name: pyscw-mappings - configMap: - name: {{ $configmapName }} - items: - - key: "mappings.py" - path: "mappings.py" - - name: uwsgi-config - configMap: - name: {{ $configmapName }} - items: - - key: "uwsgi.ini" - path: "uwsgi.ini" - {{- if $db.sslEnabled }} - {{- if $db.secrets.caFileKey }} - - name: ca-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.caFileKey }} - path: ca.pem - {{- end }} - {{- if $db.secrets.keyFileKey }} - - name: key-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.keyFileKey }} - path: key.pem - {{- end }} - {{- if $db.secrets.certFileKey }} - - name: cert-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.certFileKey }} - path: cert.pem - {{- end }} - {{- end }} -{{- end -}} diff --git a/helm/dem/templates/nginx/nginx-configmap.yaml b/helm/dem/templates/nginx/nginx-configmap.yaml deleted file mode 100644 index 7a35a310..00000000 --- a/helm/dem/templates/nginx/nginx-configmap.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.nginx.enabled -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $releaseName := .Release.Name -}} -{{- $nginxConfigmapName := include "nginx-configmap.fullname" . }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $nginxConfigmapName }} - labels: - app: {{ $releaseName }}-{{ $chartName }} - component: nginx-configmap - environment: {{ .Values.environment }} - release: {{ $releaseName }} -data: - default.conf: {{ tpl (.Files.Get "config/default.conf") . | quote }} - nginx.conf: {{ tpl (.Files.Get "config/nginx.conf") . | quote }} - log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} -{{- end }} diff --git a/helm/dem/templates/service.yaml b/helm/dem/templates/service.yaml deleted file mode 100644 index c531377c..00000000 --- a/helm/dem/templates/service.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -{{- $serviceName := include "service.fullname" . -}} -{{- if .Values.enabled -}} -apiVersion: v1 -kind: Service -metadata: - name: {{ $serviceName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - environment: {{ include "pycsw.environment" . }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} -spec: - {{- if eq $cloudProviderFlavor "minikube" }} - type: NodePort - {{- end }} - ports: - - port: {{ .Values.servicePort }} - targetPort: {{ .Values.pycswPort }} - protocol: TCP - {{- if eq $cloudProviderFlavor "minikube" }} - nodePort: {{ .Values.nodePort }} - {{- end }} - selector: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 4 }} -{{- end }} diff --git a/helm/dem/templates/uwsgi-exporter/uwsgi-exporter-container.yaml b/helm/dem/templates/uwsgi-exporter/uwsgi-exporter-container.yaml deleted file mode 100644 index 300d463a..00000000 --- a/helm/dem/templates/uwsgi-exporter/uwsgi-exporter-container.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- define "pycsw-chart.uwsgi-exporter-container" }} - - name: uwsgi-exporter - image: {{ .cloudProviderDockerRegistryUrl }}{{ .Values.uwsgiExporter.image.repository }}:{{ .Values.uwsgiExporter.image.tag }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - args: - - "--stats.uri=http://localhost:{{ .Values.env.uwsgi.statsServer.stats }}" - - "--log.level={{ .Values.uwsgiExporter.env.logLevel }}" - {{- if .resources.enabled }} - resources: - {{- toYaml .resources.value | nindent 12 }} - {{- end }} - livenessProbe: - httpGet: - path: "/-/healthy" - port: "uwsgimetrics" - initialDelaySeconds: 2 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - readinessProbe: - httpGet: - path: "/metrics" - port: "uwsgimetrics" - initialDelaySeconds: 2 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - ports: - - name: "uwsgimetrics" - containerPort: {{ .Values.uwsgiExporter.port }} -{{- end }} diff --git a/helm/dem/values.yaml b/helm/dem/values.yaml deleted file mode 100644 index 74d723f5..00000000 --- a/helm/dem/values.yaml +++ /dev/null @@ -1,211 +0,0 @@ -global: - cloudProvider: - dockerRegistryUrl: "" - imagePullSecretName: "" - flavor: openshift - tracing: {} - metrics: {} - environment: "" - ca: - secretName: "" - path: "/usr/local/share/ca-certificates" - key: "ca.crt" - db: - host: "" - name: "" - port: 5432 - sslEnabled: false - rejectUnauthorized: false - secrets: - useExternal: true - externalSecretName: "dem-dev-postgres-secret" - caFileKey: "" - certFileKey: "" - keyFileKey: "" - -mclabels: - component: backend - partOf: serving - owner: dem - gisDomain: dem - prometheus: - enabled: true - port: 9117 - longScraping: true - -enabled: true -environment: development -replicaCount: 1 -initialDelaySeconds: 60 -resetOnConfigChange: true -splunkIndex: "" -imagePullPolicy: Always - -cloudProvider: - dockerRegistryUrl: "" - imagePullSecretName: "" - flavor: openshift - -authentication: - ssl: - enabled: false - useExternal: false - externalSecretName: "" -db: - host: "" - name: "" - port: 5432 - sslEnabled: false - rejectUnauthorized: false - secrets: - useExternal: false - externalSecretName: "" - caFileKey: "" - certFileKey: "" - keyFileKey: "" - -image: - repository: common/pycsw - tag: - -internalServicePort: 80 -pycswPort: 8000 -nodePort: 30018 -servicePort: 8080 - -# add pod annotations -# example: -# podAnnotations: -# annotation1: annotation-value-1 -# annotation2: annotation-value-2 -podAnnotations: {} - -filterProductStatus: false - -env: - loglevel: WARNING - maxrecords: null - bboxPrecisionDigits: 10 - logfile: "" - profiles: mc_dem - logFormat: >- - %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({x-forwarded-for}i)s %(L)s - uwsgi: - processes: 6 - threads: 10 - statsServer: - enabled: true - stats: 1717 - statsMinify: true - cors: - enabled: true - allowedOrigin: "*" - allowedHeaders: "x-api-key" - db: - schema: DemCatalogManager - requirePassword: true - tracing: - enabled: false - url: http://localhost:55681/v1/trace - metrics: - prometheus: - scrape: true - port: 9117 - enabled: true - url: http://localhost:55681/v1/metrics - -resources: - enabled: true - value: - limits: - cpu: 2 - memory: 1200Mi - requests: - cpu: 2 - memory: 1200Mi - -nginx: - enabled: true - fullnameOverride: "" - replicaCount: 1 - image: - repository: common/nginx-otel-unprivileged - tag: "v1.0.0" - - port: 8080 - internalServicePort: 80 - nginxTargetPort: 8080 - targetPort: 8080 - nodePort: 30003 - - authorization: - enabled: true - domain: "dem" - url: http://opa-dev-opa-service.infra-services/v1/data/http/authz/decision - token: - queryName: token - - extraVolumes: - - name: nginx-config - configMap: - name: "{{ .Release.Name }}-pycsw-nginx-configmap" - - extraVolumeMounts: - - name: nginx-config - mountPath: "/etc/nginx/conf.d/default.conf" - subPath: default.conf - - mountPath: "/etc/nginx/nginx.conf" - name: nginx-config - subPath: nginx.conf - - name: nginx-config - mountPath: "/etc/nginx/log_format.conf" - subPath: log_format.conf - - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi - - route: - enabled: true - path: /api/dem/v2 - host: - timeout: - enabled: false # defaults to 30s by openshift - duration: 60s # supported units (us, ms, s, m, h, d) - tls: - enabled: true - useCerts: false - certificate: "" - key: "" - caCertificate: "" - - ingress: - enabled: false - path: /api/dem/v2 - host: "localhost" - tls: - enabled: true - useExternal: "" - -uwsgiExporter: - image: - repository: "common/timonwong/uwsgi-exporter" - tag: "latest" - env: - logLevel: info # one of [debug, info, warn, error] - port: 9117 - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi diff --git a/helm/raster/.helmignore b/helm/raster/.helmignore deleted file mode 100644 index 0cb7b3bf..00000000 --- a/helm/raster/.helmignore +++ /dev/null @@ -1,26 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ -*.txt -*local.json -*local.yaml diff --git a/helm/raster/Chart.yaml b/helm/raster/Chart.yaml deleted file mode 100644 index 55a1209e..00000000 --- a/helm/raster/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v2 -name: pycsw -description: A Helm chart for pycsw service -type: application -version: 6.6.1 -appVersion: 6.6.1 -dependencies: - - name: nginx - version: 2.1.6 - repository: oci://acrarolibotnonprod.azurecr.io/helm/common - - name: mclabels - version: 1.0.1 - repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/raster/config/log_format.conf b/helm/raster/config/log_format.conf deleted file mode 100644 index 69e07c04..00000000 --- a/helm/raster/config/log_format.conf +++ /dev/null @@ -1,81 +0,0 @@ -map $msec $nanosec { - ~(.*)\.(.*) $1$2000000; -} - -log_format main escape=json - '{' - '"Timestamp": $nanosec,' - '"Attributes": {' - '"mapcolonies.time_local":"$time_local",' - {{ if and (.Values.global.opalaEnabled) (.Values.nginx.authorization.enabled) }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' - {{ end }} - '"http.status_code": $status,' - '"http.url": "$http_referer",' - '"http.x_forwarded_for": "$http_x_forwarded_for",' - '"http.proxy_add_x_forwarded_for": "$proxy_add_x_forwarded_for",' - '"http.user_agent": "$http_user_agent",' - '"http.request_time": $request_time,' - '"request_length": "$request_length",' - '"http.host": "$host",' - '"upstream_addr": "$upstream_addr",' - '"upstream_status": "$upstream_status",' - '"upstream_connect_time": "$upstream_connect_time",' - '"upstream_header_time": "$upstream_header_time",' - '"upstream_response_time": "$upstream_response_time",' - '"upstream_response_length": "$upstream_response_length",' - '"upstream_bytes_sent": "$upstream_bytes_sent",' - '"upstream_bytes_received": "$upstream_bytes_received",' - '"upstream_http_name": "$upstream_http_name",' - '"bytes_sent": "$bytes_sent",' - '"body_bytes_sent": "$body_bytes_sent",' - '"content_type":"$content_type",' - '"content_length":"$content_length",' - '"remote_addr": "$remote_addr",' - '"remote_port": "$remote_port",' - '"remote_user": "$remote_user",' - '"connection":"$connection",' - '"cache_status":"$upstream_cache_status",' - '"connection_requests": "$connection_requests",' - '"connections_active": "$connections_active",' - '"connections_reading": "$connections_reading",' - '"connections_writing": "$connections_writing",' - '"connections_waiting": "$connections_waiting",' - '"ancient_browser": "$ancient_browser",' - '"modern_browser": "$modern_browser",' - '"binary_remote_addr": "$binary_remote_addr",' - '"hostname": "$hostname",' - '"http_name": "$http_name",' - '"pid": "$pid",' - '"proxy_protocol_addr": "$proxy_protocol_addr",' - '"proxy_protocol_port": "$proxy_protocol_port",' - '"proxy_protocol_server_addr": "$proxy_protocol_server_addr",' - '"proxy_protocol_server_port": "$proxy_protocol_server_port",' - '"proxy_host": "$proxy_host",' - '"proxy_port": "$proxy_port",' - '"realip_remote_addr": "$realip_remote_addr",' - '"realip_remote_port": "$realip_remote_port",' - '"server_name": "$server_name",' - '"server_addr ": "$server_addr ",' - '"server_port": "$server_port",' - '"server_protocol": "$server_protocol",' - '"tcpinfo_rtt": "$tcpinfo_rtt",' - '"tcpinfo_rttvar": "$tcpinfo_rttvar",' - '"tcpinfo_snd_cwnd": "$tcpinfo_snd_cwnd",' - '"tcpinfo_rcv_space": "$tcpinfo_rcv_space",' - '"uid_got": "$uid_got",' - '"uid_reset": "$uid_reset",' - '"uid_set": "$uid_set"' - '},' - '"TraceId": "$otel_trace_id",' ## this is a byte sequence (hex-encoded in JSON) - '"SpanId": "$otel_span_id",' - {{ if .Values.nginx.authorization.enabled }} - '"TokenUser": "$jwt_payload_sub",' - {{ else }} - '"TokenUser": "NoAuth",' - {{ end }} - '"SeverityText": "INFO",' - '"SeverityNumber": 9,' - '"RequestBody": "$request_body",' - '"Body": "$request"' - '}'; \ No newline at end of file diff --git a/helm/raster/config/mappings.py b/helm/raster/config/mappings.py deleted file mode 100644 index 3d00cf54..00000000 --- a/helm/raster/config/mappings.py +++ /dev/null @@ -1,65 +0,0 @@ -MD_CORE_MODEL = { - 'typename': 'pycsw:CoreMetadata', - 'outputschema': 'http://pycsw.org/metadata', - 'mappings': { - # Needed for PYCSW - 'pycsw:Identifier': 'identifier', - 'pycsw:Typename': 'typename', - 'pycsw:Schema': 'schema', - 'pycsw:MdSource': 'mdsource', - 'pycsw:InsertDate': 'insert_date', - 'pycsw:XML': 'xml', - 'pycsw:AnyText': 'anytext', - 'pycsw:BoundingBox': 'wkt_geometry', - 'pycsw:Links': 'links', - 'pycsw:Keywords': 'keywords', - - # Common profile fields - 'pycsw:Type': 'type', - 'pycsw:Classification': 'classification', - 'pycsw:AccessConstraints': 'classification', - 'pycsw:ProductId': 'product_id', - 'pycsw:Title': 'product_name', - 'pycsw:AlternateTitle': 'product_name', - 'pycsw:ProductVersion': 'product_version', - 'pycsw:ProductType': 'product_type', - 'pycsw:productSubType': 'product_sub_type', - 'pycsw:Abstract': 'description', - 'pycsw:CRS': 'srs', - 'pycsw:CRSName': 'srs_name', - 'pycsw:Creator': 'producer_name', - 'pycsw:Publisher': 'producer_name', - 'pycsw:Contributor': 'producer_name', - 'pycsw:CreationDate': 'creation_date_utc', - 'pycsw:Date': 'creation_date_utc', - 'pycsw:Format': 'type', - 'pycsw:Modified': 'update_date_utc', - 'pycsw:UpdateDate': 'update_date_utc', - 'pycsw:IngestionDate': 'ingestion_date', - 'pycsw:TempExtent_begin': 'imaging_time_begin_utc', - 'pycsw:TempExtent_end': 'imaging_time_end_utc', - 'pycsw:Resolution': 'max_resolution_deg', - 'pycsw:minResolutionDeg': 'min_resolution_deg', - 'pycsw:horizontalAccuracyCE90': 'min_horizontal_accuracy_ce_90', - 'pycsw:maxHorizontalAccuracyCE90': 'max_horizontal_accuracy_ce_90', - 'pycsw:sensorType': 'sensors', - 'pycsw:Region': 'region', - 'pycsw:footprint': 'footprint_geojson', - 'pycsw:Source': 'product_name', - 'pycsw:transparency': 'transparency', - 'pycsw:MimeType': 'tile_mime_format', - - 'pycsw:Relation': '', - 'pycsw:Language': '', - 'pycsw:TopicCategory': '', - - 'pycsw:maxResolutionMeter': 'max_resolution_meter', - 'pycsw:minResolutionMeter': 'min_resolution_meter', - 'pycsw:productBBox':'product_bbox', - 'pycsw:productStatus': 'product_status', - - # Added for mc-raster - 'pycsw:Rms': 'rms', - 'pycsw:Scale': 'scale', - } -} diff --git a/helm/raster/config/pycsw-location.conf b/helm/raster/config/pycsw-location.conf deleted file mode 100644 index 8324e526..00000000 --- a/helm/raster/config/pycsw-location.conf +++ /dev/null @@ -1,6 +0,0 @@ - -# pycsw custom uwsgi settings injected into root location -uwsgi_pass {{ include "service.fullname" . }}:{{ .Values.servicePort }}; -include uwsgi_params; -uwsgi_hide_header Set-Cookie; -uwsgi_param HTTP_Cookie ""; diff --git a/helm/raster/config/pycsw-server.conf b/helm/raster/config/pycsw-server.conf deleted file mode 100644 index ed865a8d..00000000 --- a/helm/raster/config/pycsw-server.conf +++ /dev/null @@ -1,10 +0,0 @@ -# pycsw server-level settings -keepalive_timeout 500; -proxy_connect_timeout 600; -proxy_send_timeout 600; -send_timeout 600; -client_max_body_size 5000; -client_header_timeout 600; -client_body_timeout 600; -client_header_buffer_size 12288; # 12K -large_client_header_buffers 4 12288; # 12K diff --git a/helm/raster/config/pycsw.cfg b/helm/raster/config/pycsw.cfg deleted file mode 100644 index a2013ab4..00000000 --- a/helm/raster/config/pycsw.cfg +++ /dev/null @@ -1,75 +0,0 @@ -[server] -home=/home/pycsw -url=${PYCSW_SERVER_URL} -mimetype=application/xml; charset=UTF-8 -encoding=UTF-8 -language=en-US -{{- if .Values.env.maxrecords}} -maxrecords={{ .Values.env.maxrecords }} -{{- end}} -loglevel={{ .Values.env.loglevel }} -logfile={{ .Values.env.logfile }} -#ogc_schemas_base=http://foo -#federatedcatalogues=http://catalog.data.gov/csw -#pretty_print=true -#gzip_compresslevel=8 -#domainquerytype=range -#domaincounts=true -#spatial_ranking=true -profiles={{ .Values.env.profiles }} - -[manager] -transactions=false -allowed_ips=127.0.0.1 -#csw_harvest_pagesize=10 - -[metadata:main] -identification_title=pycsw Geospatial Catalogue -identification_abstract=pycsw is an OGC CSW server implementation written in Python -identification_keywords=catalogue,discovery,metadata -identification_keywords_type=theme -identification_fees=None -identification_accessconstraints=None -provider_name=Organization Name -provider_url=https://pycsw.org/ -contact_name=Lastname, Firstname -contact_position=Position Title -contact_address=Mailing Address -contact_city=City -contact_stateorprovince=Administrative Area -contact_postalcode=Zip or Postal Code -contact_country=Country -contact_phone=+xx-xxx-xxx-xxxx -contact_fax=+xx-xxx-xxx-xxxx -contact_email=Email Address -contact_url=Contact URL -contact_hours=Hours of Service -contact_instructions=During hours of service. Off on weekends. -contact_role=pointOfContact - -[repository] -# sqlite -#database=sqlite:////home/pycsw/tests/functionaltests/suites/cite/data/cite.db -# postgres -database={{ template "pycsw-pg-connection-string" . }} -#database=postgresql://postgres:postgres@postgis-postgis/postgres -# mysql -#database=mysql://username:password@localhost/pycsw?charset=utf8 -mappings=${PYCSW_MAPPINGS_FILEPATH} -table=${DB_SCHEMA}.records -#filter=type = 'http://purl.org/dc/dcmitype/Dataset' -{{- if .Values.filterProductStatus }} -filter=product_status != 'UNPUBLISHED' -{{- end }} -stable_sort=true - -[metadata:inspire] -#enabled=true -#languages_supported=eng,gre -#default_language=eng -#date=YYYY-MM-DD -#gemet_keywords=Utility and governmental services -#conformity_service=notEvaluated -#contact_name=Organization Name -#contact_email=Email Address -#temp_extent=YYYY-MM-DD/YYYY-MM-DD diff --git a/helm/raster/config/pycswWsgi.ini b/helm/raster/config/pycswWsgi.ini deleted file mode 100644 index 4c9d53e5..00000000 --- a/helm/raster/config/pycswWsgi.ini +++ /dev/null @@ -1,38 +0,0 @@ -[uwsgi] -; based on https://github.com/kartoza/docker-mapproxy/blob/master/build_data/uwsgi.ini -chdir = /home/pycsw/pycsw -wsgi-file = cors.py -pidfile = /tmp/pycsw.pid -socket = :{{ .Values.pycswPort }} -processes = {{ .Values.env.uwsgi.processes }} ; Maximum number of workers allowed -cheaper = 2 ; Minimum number of workers allowed -enable-threads = true -threads = {{ .Values.env.uwsgi.threads }} -master = true -disable-logging = true -vacuum = true -die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn) -need-app = true ; This parameter prevents uWSGI from starting if it is unable to find or load your application module -max-requests = 1000 ; Restart workers after this many requests -reload-on-rss = 2048 ; Restart workers after this much resident memory -buffer-size = 14336 ; 14K, Set the internal buffer size for uwsgi packet -worker-reload-mercy = 60 ; How long to wait before forcefully killing workers -wsgi-disable-file-wrapper = true -harakiri = 60 -py-callos-afterfork = true ; allow workers to trap signals -cheaper-algo = busyness -cheaper-initial = 2 ; Workers created at startup -cheaper-overload = 1 ; Length of a cycle in seconds -cheaper-step = 2 ; How many workers to spawn at a time -cheaper-busyness-multiplier = 30 ; How many cycles to wait before killing workers -cheaper-busyness-min = 20 ; Below this threshold, kill workers (if stable for multiplier cycles) -cheaper-busyness-max = 70 ; Above this threshold, spawn new workers -cheaper-busyness-backlog-alert = 2 ; Spawn emergency workers if more than this many requests are waiting in the queue -cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue -chmod-socket = 664 -uid = 1000 -gid = 0 -http-socket = :8080 -stats = :{{ .Values.env.uwsgi.statsServer.stats }} -stats-http = {{ .Values.env.uwsgi.statsServer.enabled }} -stats-min = {{ .Values.env.uwsgi.statsServer.statsMinify }} diff --git a/helm/raster/templates/_helpers.tpl b/helm/raster/templates/_helpers.tpl deleted file mode 100644 index 4613eb62..00000000 --- a/helm/raster/templates/_helpers.tpl +++ /dev/null @@ -1,173 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "pycsw.name" -}} -{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "pycsw.fullname" -}} -{{- $name := default .Chart.Name }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "pycsw.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "pycsw.labels" -}} -helm.sh/chart: {{ include "pycsw.chart" . }} -{{ include "pycsw.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{ include "mclabels.labels" . }} -{{- end }} - -{{/* -Returns the tag of the chart. -*/}} -{{- define "pycsw.tag" -}} -{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "pycsw.selectorLabels" -}} -app.kubernetes.io/name: {{ include "pycsw.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{ include "mclabels.selectorLabels" . }} -{{- end }} - -{{/* -Returns the environment from global if exists or from the chart's values, defaults to development -*/}} -{{- define "pycsw.environment" -}} -{{- if .Values.global.environment }} - {{- .Values.global.environment -}} -{{- else -}} - {{- .Values.environment | default "development" -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the pycsw server url based on the provided values, default localhost -*/}} -{{- define "pycsw.serverURL" -}} - {{- if not .Values.nginx.route.host }} - {{- printf "http://localhost:8000" -}} - {{- else -}} - {{- $protocol := ternary "https" "http" .Values.nginx.route.tls.enabled -}} - {{- printf "%s://%s" $protocol .Values.nginx.route.host -}} - {{- if .Values.nginx.route.path -}} - {{- printf "%s" .Values.nginx.route.path -}} - {{- end -}} - {{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube -*/}} -{{- define "pycsw.cloudProviderFlavor" -}} -{{- if .Values.global.cloudProvider.flavor }} - {{- .Values.global.cloudProvider.flavor -}} -{{- else if .Values.cloudProvider -}} - {{- .Values.cloudProvider.flavor | default "minikube" -}} -{{- else -}} - {{ "minikube" }} -{{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider docker registry url from global if exists or from the chart's values -*/}} -{{- define "pycsw.cloudProviderDockerRegistryUrl" -}} -{{- if .Values.global.cloudProvider.dockerRegistryUrl }} - {{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}} -{{- else if .Values.cloudProvider.dockerRegistryUrl -}} - {{- printf "%s/" .Values.cloudProvider.dockerRegistryUrl -}} -{{- else -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the cloud provider image pull secret name from global if exists or from the chart's values -*/}} -{{- define "pycsw.cloudProviderImagePullSecretName" -}} -{{- if .Values.global.cloudProvider.imagePullSecretName }} - {{- .Values.global.cloudProvider.imagePullSecretName -}} -{{- else if .Values.cloudProvider.imagePullSecretName -}} - {{- .Values.cloudProvider.imagePullSecretName -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tracing url from global if exists or from the chart's values -*/}} -{{- define "pycsw.tracingUrl" -}} -{{- if .Values.global.tracing.url }} - {{- .Values.global.tracing.url -}} -{{- else if .Values.cloudProvider -}} - {{- .Values.env.tracing.url -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tracing url from global if exists or from the chart's values -*/}} -{{- define "pycsw.metricsUrl" -}} -{{- if .Values.global.metrics.url }} - {{- .Values.global.metrics.url -}} -{{- else -}} - {{- .Values.env.metrics.url -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw-pg-connection-string" -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{- "postgresql://${DB_USER}" -}} -{{- if .Values.env.db.requirePassword -}} -{{- ":${DB_PASSWORD}" -}} -{{- end -}} -{{- "@${DB_HOST}:${DB_PORT}/${DB_NAME}" -}} -{{- if $db.sslEnabled -}} -{{- "?sslmode=require" -}} -{{- if $db.secrets.caFileKey -}} -{{- "&sslrootcert=" -}}/.postgresql/ca.pem -{{- end -}} -{{- if $db.secrets.certFileKey -}} -{{- "&sslcert=" -}}/.postgresql/cert.pem -{{- end -}} -{{- if $db.secrets.keyFileKey -}} -{{- "&sslkey=" -}}/.postgresql/key.pem -{{- end -}} -{{- end -}} -{{- end -}} - -{{- define "pycsw.cors.allowedHeaders" -}} -{{- $authentication := (include "common.authentication.merged" .) | fromYaml }} -{{- $headerList := list -}} -{{- if ne .Values.env.cors.allowedHeaders "" -}} -{{- range $k, $v := (split "," .Values.env.cors.allowedHeaders) -}} -{{- $headerList = append $headerList $v -}} -{{- end -}} -{{- $headerList = uniq $headerList -}} -{{- quote (join "," $headerList) -}} -{{- end -}} -{{- end -}} diff --git a/helm/raster/templates/_resources.tpl b/helm/raster/templates/_resources.tpl deleted file mode 100644 index bf7a281f..00000000 --- a/helm/raster/templates/_resources.tpl +++ /dev/null @@ -1,42 +0,0 @@ -{{/* -Create service name as used by the service name label. -*/}} -{{- define "service.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "service" }} -{{- end }} - -{{/* -Create configmap name as used by the service name label. -*/}} -{{- define "configmap.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "configmap" | indent 1 }} -{{- end }} - -{{/* -Create pycsw nginx configmap name as used by the service name label. -*/}} -{{- define "nginx-configmap.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "nginx-configmap" | indent 1 }} -{{- end }} - -{{/* -Create deployment name as used by the service name label. -*/}} -{{- define "deployment.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "deployment" | indent 1 }} -{{- end }} - - -{{/* -Create route name as used by the service name label. -*/}} -{{- define "route.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "route" | indent 1 }} -{{- end }} - -{{/* -Create ingress name as used by the service name label. -*/}} -{{- define "ingress.fullname" -}} -{{- printf "%s-%s-%s" .Release.Name .Chart.Name "ingress" | indent 1 }} -{{- end }} diff --git a/helm/raster/templates/_tplValues.tpl b/helm/raster/templates/_tplValues.tpl deleted file mode 100644 index 36a81f4a..00000000 --- a/helm/raster/templates/_tplValues.tpl +++ /dev/null @@ -1,54 +0,0 @@ -{{/* -Copyright VMware, Inc. -SPDX-License-Identifier: APACHE-2.0 -*/}} - -{{/* vim: set filetype=mustache: */}} -{{/* -Renders a value that contains template perhaps with scope if the scope is present. -Usage: -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} -{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} -*/}} -{{- define "common.tplvalues.render" -}} -{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} -{{- if contains "{{" (toJson .value) }} - {{- if .scope }} - {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} - {{- else }} - {{- tpl $value .context }} - {{- end }} -{{- else }} - {{- $value }} -{{- end }} -{{- end -}} - -{{/* -Merge a list of values that contains template after rendering them. -Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge -Usage: -{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} -*/}} -{{- define "common.tplvalues.merge" -}} -{{- $dst := dict -}} -{{- range .values -}} -{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} -{{- end -}} -{{ $dst | toYaml }} -{{- end -}} - -{{/* -End of usage example -*/}} - -{{/* -Custom definitions -*/}} - -{{- define "common.db.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.db .Values.global.db ) "context" . ) }} -{{- end -}} - -{{- define "common.authentication.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.authentication .Values.global.authentication ) "context" . ) }} -{{- end -}} diff --git a/helm/raster/templates/configmap.yaml b/helm/raster/templates/configmap.yaml deleted file mode 100644 index fa8dcc2b..00000000 --- a/helm/raster/templates/configmap.yaml +++ /dev/null @@ -1,35 +0,0 @@ -{{- $chartName := include "pycsw.name" . -}} -{{- $configmapName := include "configmap.fullname" . }} -{{- $tracingUrl := include "pycsw.tracingUrl" . -}} -{{- $metricsUrl := include "pycsw.metricsUrl" . -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{- if .Values.enabled -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $configmapName }} -data: - {{ if .Values.env.tracing.enabled }} - TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracingUrl }} - {{ end }} - {{ if .Values.env.metrics.enabled }} - TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metricsUrl }} - {{ end }} - pycsw.cfg: {{ tpl (.Files.Get "config/pycsw.cfg") . | quote }} - mappings.py: {{ .Files.Get "config/mappings.py" | quote }} - uwsgi.ini: {{ tpl (.Files.Get "config/pycswWsgi.ini") . | quote }} - CORS_ENABLED: {{ .Values.env.cors.enabled | quote }} - CORS_ALLOWED_HEADERS: {{ template "pycsw.cors.allowedHeaders" . }} - CORS_ALLOWED_ORIGIN: {{ .Values.env.cors.allowedOrigin | quote }} - LOG_FORMAT: {{ .Values.env.logFormat | quote }} - DB_HOST: {{ $db.host }} - DB_PORT: {{ $db.port | quote }} - DB_NAME: {{ $db.name }} - POSTGRES_ENABLE_SSL_AUTH: {{ $db.sslEnabled | quote }} - DB_SCHEMA: {{ quote .Values.env.db.schema }} - PGAPPNAME: {{ $chartName }} - COORDINATE_PRECISION: {{ quote .Values.env.bboxPrecisionDigits }} - AUTH_ENABLED: {{ .Values.nginx.authorization.enabled | quote }} #maybe deprecated or used in other networks -{{- end }} diff --git a/helm/raster/templates/deployment.yaml b/helm/raster/templates/deployment.yaml deleted file mode 100644 index d15690e3..00000000 --- a/helm/raster/templates/deployment.yaml +++ /dev/null @@ -1,214 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $configmapName := include "configmap.fullname" . }} -{{- $deploymentName := include "deployment.fullname" . }} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -{{- $cloudProviderDockerRegistryUrl := include "pycsw.cloudProviderDockerRegistryUrl" . -}} -{{- $cloudProviderImagePullSecretName := include "pycsw.cloudProviderImagePullSecretName" . -}} -{{- $db := (include "common.db.merged" .) | fromYaml }} -{{ $sslSecretName := ternary .Values.authentication.ssl.externalSecretName (printf "%s%s" .Release.Name "-open-ssl") .Values.authentication.ssl.useExternal }} -{{ $postgresSecretName := ternary $db.secrets.externalSecretName (printf "%s%s" .Release.Name "-postgres-secret") $db.secrets.useExternal }} -{{- $imageTag := include "pycsw.tag" . -}} -{{- $serverURL := include "pycsw.serverURL" . -}} - -{{- if .Values.enabled -}} - -{{- if .Values.authentication.ssl.enabled }} -{{- if and .Values.authentication.ssl.useExternal (not .Values.authentication.ssl.externalSecretName) }} -{{- fail "When using external ssl secret the value for .Values.authentication.ssl.externalSecretName should be set" }} -{{- end }} -{{- end }} - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ $deploymentName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - environment: {{ include "pycsw.environment" . }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} - annotations: - collectord.io/index: {{ quote .Values.splunkIndex }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 8 }} - annotations: - {{- if .Values.resetOnConfigChange }} - checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- end }} - {{- if .Values.podAnnotations }} - {{- toYaml .Values.podAnnotations | nindent 8 }} - {{- end }} - {{ include "mclabels.annotations" . | nindent 8 }} - - spec: - {{- if $cloudProviderImagePullSecretName }} - imagePullSecrets: - - name: {{ $cloudProviderImagePullSecretName | quote }} - {{- end }} - containers: - - name: {{ $releaseName }} - {{- with .Values.image }} - image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }} - {{- end }} - volumeMounts: - {{- if .Values.global.ca.secretName }} - - mountPath: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} - name: root-ca - subPath: {{ quote .Values.caKey }} - {{- end }} - {{- if .Values.global.ca.secretName }} - - name: root-ca - mountPath: "/usr/local/share/ca-certificates" - {{- end }} - {{- if .Values.authentication.ssl.enabled }} - - name: open-ssl - mountPath: "/etc/ssl/openssl.cnf" - subPath: "openssl.cnf" - {{- end }} - - name: pyscw-config - mountPath: /etc/pycsw/pycsw.cfg - subPath: pycsw.cfg - - name: pyscw-mappings - mountPath: /etc/pycsw/mappings.py - subPath: mappings.py - - mountPath: "/pycsw/uwsgi.ini" - name: uwsgi-config - subPath: uwsgi.ini - {{- if $db.sslEnabled }} - {{- if $db.secrets.caFileKey }} - - name: ca-file - mountPath: /certs/ca.crt - subPath: ca.pem - {{- end }} - {{- if $db.secrets.keyFileKey }} - - name: key-file - mountPath: /certs/key.pem - subPath: key.pem - {{- end }} - {{- if $db.secrets.certFileKey }} - - name: cert-file - mountPath: /certs/cert.pem - subPath: cert.pem - {{- end }} - {{- end }} - env: - {{- if .Values.global.ca.secretName }} - - name: REQUESTS_CA_BUNDLE - value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }} - - name: NODE_EXTRA_CA_CERTS - value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }} - {{- end }} - - name: PYCSW_SERVER_URL - value: {{ $serverURL }} - - name: PYCSW_MAPPINGS_FILEPATH - value: /etc/pycsw/mappings.py - - name: DB_USER - valueFrom: - secretKeyRef: - name: {{ $postgresSecretName }} - key: username - {{- if .Values.env.db.requirePassword }} - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: {{ $postgresSecretName }} - key: password - {{- end }} - - name: POSTGRES_CERTS_MOUNT_PATH - value: /certs - - name: POSTGRES_CERT_FILE_NAME - value: cert.pem - - name: POSTGRES_KEY_FILE_NAME - value: key.pem - envFrom: - - configMapRef: - name: {{ $configmapName }} - ports: - - name: http - containerPort: {{ .Values.pycswPort }} - protocol: TCP - readinessProbe: - httpGet: - path: /csw?service=CSW&request=GetCapabilities&version=3.0.0 - port: 8080 - initialDelaySeconds: 30 - timeoutSeconds: 5 - {{- if .Values.resources.enabled }} - resources: - {{- toYaml .Values.resources.value | nindent 12 }} - {{- end }} - ################################################## uwsgi exporter deployment############################################## - {{- if .Values.env.metrics.enabled }} - {{- template "pycsw-chart.uwsgi-exporter-container" (merge (dict "releaseName" .releaseName "chartName" .chartName "cloudProviderDockerRegistryUrl" $cloudProviderDockerRegistryUrl "resources" .Values.uwsgiExporter.resources) .) }} - {{- end }} - volumes: - {{- if .Values.global.ca.secretName }} - - name: root-ca - secret: - secretName: {{ .Values.global.ca.secretName }} - {{- end }} - {{- if .Values.authentication.ssl.enabled }} - - name: open-ssl - secret: - secretName: {{ $sslSecretName }} - {{- end }} - - name: pyscw-config - configMap: - name: {{ $configmapName }} - items: - - key: "pycsw.cfg" - path: "pycsw.cfg" - - name: pyscw-mappings - configMap: - name: {{ $configmapName }} - items: - - key: "mappings.py" - path: "mappings.py" - - name: uwsgi-config - configMap: - name: {{ $configmapName }} - items: - - key: "uwsgi.ini" - path: "uwsgi.ini" - {{- if $db.sslEnabled }} - {{- if $db.secrets.caFileKey }} - - name: ca-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.caFileKey }} - path: ca.pem - {{- end }} - {{- if $db.secrets.keyFileKey }} - - name: key-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.keyFileKey }} - path: key.pem - {{- end }} - {{- if $db.secrets.certFileKey }} - - name: cert-file - secret: - secretName: {{ $postgresSecretName }} - items: - - key: {{ $db.secrets.certFileKey }} - path: cert.pem - {{- end }} - {{- end }} -{{- end -}} diff --git a/helm/raster/templates/nginx/nginx-configmap.yaml b/helm/raster/templates/nginx/nginx-configmap.yaml deleted file mode 100644 index 524e03aa..00000000 --- a/helm/raster/templates/nginx/nginx-configmap.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.nginx.enabled -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $releaseName := .Release.Name -}} -{{- $nginxConfigmapName := include "nginx-configmap.fullname" . }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $nginxConfigmapName }} - labels: - app: {{ $releaseName }}-{{ $chartName }} - component: nginx-configmap - environment: {{ .Values.environment }} - release: {{ $releaseName }} -data: - pycsw-location.conf: {{ tpl (.Files.Get "config/pycsw-location.conf") . | quote }} - pycsw-server.conf: {{ tpl (.Files.Get "config/pycsw-server.conf") . | quote }} - log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} -{{- end }} diff --git a/helm/raster/templates/service.yaml b/helm/raster/templates/service.yaml deleted file mode 100644 index c531377c..00000000 --- a/helm/raster/templates/service.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "pycsw.name" . -}} -{{- $cloudProviderFlavor := include "pycsw.cloudProviderFlavor" . -}} -{{- $serviceName := include "service.fullname" . -}} -{{- if .Values.enabled -}} -apiVersion: v1 -kind: Service -metadata: - name: {{ $serviceName }} - labels: - app: {{ $chartName }} - component: {{ $chartName }} - environment: {{ include "pycsw.environment" . }} - release: {{ $releaseName }} - {{- include "pycsw.labels" . | nindent 4 }} -spec: - {{- if eq $cloudProviderFlavor "minikube" }} - type: NodePort - {{- end }} - ports: - - port: {{ .Values.servicePort }} - targetPort: {{ .Values.pycswPort }} - protocol: TCP - {{- if eq $cloudProviderFlavor "minikube" }} - nodePort: {{ .Values.nodePort }} - {{- end }} - selector: - app: {{ $chartName }} - release: {{ $releaseName }} - run: {{ $releaseName }}-{{ $chartName }} - {{- include "pycsw.selectorLabels" . | nindent 4 }} -{{- end }} diff --git a/helm/raster/templates/uwsgi-exporter/uwsgi-exporter-container.yaml b/helm/raster/templates/uwsgi-exporter/uwsgi-exporter-container.yaml deleted file mode 100644 index 300d463a..00000000 --- a/helm/raster/templates/uwsgi-exporter/uwsgi-exporter-container.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- define "pycsw-chart.uwsgi-exporter-container" }} - - name: uwsgi-exporter - image: {{ .cloudProviderDockerRegistryUrl }}{{ .Values.uwsgiExporter.image.repository }}:{{ .Values.uwsgiExporter.image.tag }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - args: - - "--stats.uri=http://localhost:{{ .Values.env.uwsgi.statsServer.stats }}" - - "--log.level={{ .Values.uwsgiExporter.env.logLevel }}" - {{- if .resources.enabled }} - resources: - {{- toYaml .resources.value | nindent 12 }} - {{- end }} - livenessProbe: - httpGet: - path: "/-/healthy" - port: "uwsgimetrics" - initialDelaySeconds: 2 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - readinessProbe: - httpGet: - path: "/metrics" - port: "uwsgimetrics" - initialDelaySeconds: 2 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - ports: - - name: "uwsgimetrics" - containerPort: {{ .Values.uwsgiExporter.port }} -{{- end }} diff --git a/helm/raster/values.yaml b/helm/raster/values.yaml deleted file mode 100644 index 5b9b830b..00000000 --- a/helm/raster/values.yaml +++ /dev/null @@ -1,247 +0,0 @@ -global: - cloudProvider: - dockerRegistryUrl: "" - imagePullSecretName: "" - flavor: openshift - tracing: {} - metrics: {} - environment: "" - opalaEnabled: false - ca: - secretName: "" - path: "/usr/local/share/ca-certificates" - key: "ca.crt" - db: - host: "" - name: "" - port: 5432 - sslEnabled: false - rejectUnauthorized: false - secrets: - useExternal: true - externalSecretName: "raster-dev-postgres-secret" - caFileKey: "" - certFileKey: "" - keyFileKey: "" - -mclabels: - #environment: development - component: backend - partOf: serving - owner: raster - gisDomain: raster - prometheus: - enabled: true - port: 9117 - longScraping: true - -enabled: true -environment: development -replicaCount: 5 -initialDelaySeconds: 60 -resetOnConfigChange: true -splunkIndex: "" -imagePullPolicy: Always - -cloudProvider: - dockerRegistryUrl: "" - imagePullSecretName: "" - flavor: openshift - -authentication: - ssl: - enabled: false - useExternal: false - externalSecretName: "" -db: - host: "" - name: "" - port: 5432 - sslEnabled: false - rejectUnauthorized: false - secrets: - useExternal: false - externalSecretName: "" - caFileKey: "" - certFileKey: "" - keyFileKey: "" - -image: - repository: pycsw - tag: "latest" - -internalServicePort: 80 -pycswPort: 8000 -nodePort: 30018 -servicePort: 8080 - -# add pod annotations -# example: -# podAnnotations: -# annotation1: annotation-value-1 -# annotation2: annotation-value-2 -podAnnotations: {} - -filterProductStatus: false - -env: - loglevel: WARNING - maxrecords: null - bboxPrecisionDigits: 10 - logfile: "" - profiles: mc_raster - logFormat: >- - %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({x-forwarded-for}i)s %(L)s - uwsgi: - processes: 6 - threads: 10 - statsServer: - enabled: true - stats: 1717 - statsMinify: true - cors: - enabled: true - allowedOrigin: "*" - allowedHeaders: "x-api-key" - db: - schema: RasterCatalogManager - requirePassword: true - tracing: - enabled: false - url: http://localhost:55681/v1/trace - metrics: - prometheus: - scrape: true - port: 9117 - enabled: true - url: http://localhost:55681/v1/metrics - -resources: - enabled: true - value: - limits: - cpu: 2 - memory: 1200Mi - requests: - cpu: 2 - memory: 1200Mi - -nginx: - enabled: true - fullnameOverride: "" - replicaCount: 2 - image: - repository: common/nginx - tag: "v2.1.6" - nginx: - extensions: - server: - enabled: true - fileName: pycsw-server.conf - location: - enabled: true - fileName: pycsw-location.conf - port: 8080 - internalServicePort: 80 - targetPort: 8080 - nodePort: 30003 - clientMaxBodySize: 5000 - - opentelemetry: - serviceName: pycsw-nginx - exporterHost: infra-otel.infra-services - exporterPort: 4317 - samplerMethod: "AlwaysOff" - ratio: 10 - - backend: - enabled: false - - prometheusExporter: - enabled: true - image: - repository: common/nginx/nginx-prometheus-exporter - tag: latest - pullPolicy: IfNotPresent - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi - - authorization: - enabled: true - domain: "raster" - url: http://opa-dev-opa-service.infra-services/v1/data/http/authz/decision - token: - queryName: token - - extraVolumes: - - name: nginx-config - configMap: - name: "{{ .Release.Name }}-pycsw-nginx-configmap" - - extraVolumeMounts: - - name: nginx-config - mountPath: "/etc/nginx/conf.d/extensions/pycsw-location.conf" - subPath: pycsw-location.conf - - name: nginx-config - mountPath: "/etc/nginx/conf.d/extensions/pycsw-server.conf" - subPath: pycsw-server.conf - - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi - - route: - enabled: true - routesMapping: - - path: /api/raster/v1 - host: - timeout: - enabled: false # defaults to 30s by openshift - duration: 60s # supported units (us, ms, s, m, h, d) - tls: - enabled: true - useCerts: false - certificate: "" - key: "" - caCertificate: "" - - ingress: - enabled: false - ingressClassName: "" - ingressMapping: - - host: "localhost" - path: /api/raster/v1 - pathType: Prefix - tls: - enabled: true - useExternal: "" - -uwsgiExporter: - image: - repository: "timonwong/uwsgi-exporter" - tag: "latest" - env: - logLevel: info # one of [debug, info, warn, error] - port: 9117 - resources: - enabled: true - value: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi diff --git a/release-please-config.json b/release-please-config.json index 207662f6..75eaf76d 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,36 +5,6 @@ "packages": { ".": { "extra-files": [ - { - "type": "yaml", - "path": "helm/3d/Chart.yaml", - "jsonpath": "$.version" - }, - { - "type": "yaml", - "path": "helm/3d/Chart.yaml", - "jsonpath": "$.appVersion" - }, - { - "type": "yaml", - "path": "helm/dem/Chart.yaml", - "jsonpath": "$.version" - }, - { - "type": "yaml", - "path": "helm/dem/Chart.yaml", - "jsonpath": "$.appVersion" - }, - { - "type": "yaml", - "path": "helm/raster/Chart.yaml", - "jsonpath": "$.version" - }, - { - "type": "yaml", - "path": "helm/raster/Chart.yaml", - "jsonpath": "$.appVersion" - }, { "type": "yaml", "path": "helm/pycsw/Chart.yaml", From 5ae046431d1599e28f433f47a83cca1c6792fe30 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Tue, 14 Jul 2026 13:27:59 +0300 Subject: [PATCH 06/15] helm: move chart to helm/ root as the sole chart pycsw is the only chart in the repo, so promote it from helm/pycsw to the helm/ root. Chart name stays "pycsw" so it still publishes as oci:///helm/common/pycsw:. Point the build-and-push context and release-please extra-files at helm/. Co-Authored-By: Claude Fable 5 --- .github/workflows/build-and-push.yaml | 2 +- helm/{pycsw => }/.helmignore | 0 helm/{pycsw => }/Chart.yaml | 0 helm/{pycsw => }/README.md | 0 helm/{pycsw => }/config/pycsw-location.conf | 0 helm/{pycsw => }/config/pycsw-server.conf | 0 helm/{pycsw => }/config/pycswWsgi.ini | 0 helm/{pycsw => }/templates/_helpers.tpl | 0 helm/{pycsw => }/templates/_resources.tpl | 0 helm/{pycsw => }/templates/_tplValues.tpl | 0 helm/{pycsw => }/templates/configmap.yaml | 0 helm/{pycsw => }/templates/deployment.yaml | 0 helm/{pycsw => }/templates/nginx/nginx-configmap.yaml | 0 helm/{pycsw => }/templates/service.yaml | 0 .../templates/uwsgi-exporter/uwsgi-exporter-container.yaml | 0 helm/{pycsw => }/values.yaml | 0 release-please-config.json | 4 ++-- 17 files changed, 3 insertions(+), 3 deletions(-) rename helm/{pycsw => }/.helmignore (100%) rename helm/{pycsw => }/Chart.yaml (100%) rename helm/{pycsw => }/README.md (100%) rename helm/{pycsw => }/config/pycsw-location.conf (100%) rename helm/{pycsw => }/config/pycsw-server.conf (100%) rename helm/{pycsw => }/config/pycswWsgi.ini (100%) rename helm/{pycsw => }/templates/_helpers.tpl (100%) rename helm/{pycsw => }/templates/_resources.tpl (100%) rename helm/{pycsw => }/templates/_tplValues.tpl (100%) rename helm/{pycsw => }/templates/configmap.yaml (100%) rename helm/{pycsw => }/templates/deployment.yaml (100%) rename helm/{pycsw => }/templates/nginx/nginx-configmap.yaml (100%) rename helm/{pycsw => }/templates/service.yaml (100%) rename helm/{pycsw => }/templates/uwsgi-exporter/uwsgi-exporter-container.yaml (100%) rename helm/{pycsw => }/values.yaml (100%) diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index 0379d546..7afbc78a 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -54,7 +54,7 @@ jobs: id: build_helm_chart uses: MapColonies/shared-workflows/actions/build-and-push-helm@build-and-push-helm-v1.0.1 with: - context: ./helm/pycsw + context: ./helm domain: common registry: ${{ secrets.ACR_URL }} diff --git a/helm/pycsw/.helmignore b/helm/.helmignore similarity index 100% rename from helm/pycsw/.helmignore rename to helm/.helmignore diff --git a/helm/pycsw/Chart.yaml b/helm/Chart.yaml similarity index 100% rename from helm/pycsw/Chart.yaml rename to helm/Chart.yaml diff --git a/helm/pycsw/README.md b/helm/README.md similarity index 100% rename from helm/pycsw/README.md rename to helm/README.md diff --git a/helm/pycsw/config/pycsw-location.conf b/helm/config/pycsw-location.conf similarity index 100% rename from helm/pycsw/config/pycsw-location.conf rename to helm/config/pycsw-location.conf diff --git a/helm/pycsw/config/pycsw-server.conf b/helm/config/pycsw-server.conf similarity index 100% rename from helm/pycsw/config/pycsw-server.conf rename to helm/config/pycsw-server.conf diff --git a/helm/pycsw/config/pycswWsgi.ini b/helm/config/pycswWsgi.ini similarity index 100% rename from helm/pycsw/config/pycswWsgi.ini rename to helm/config/pycswWsgi.ini diff --git a/helm/pycsw/templates/_helpers.tpl b/helm/templates/_helpers.tpl similarity index 100% rename from helm/pycsw/templates/_helpers.tpl rename to helm/templates/_helpers.tpl diff --git a/helm/pycsw/templates/_resources.tpl b/helm/templates/_resources.tpl similarity index 100% rename from helm/pycsw/templates/_resources.tpl rename to helm/templates/_resources.tpl diff --git a/helm/pycsw/templates/_tplValues.tpl b/helm/templates/_tplValues.tpl similarity index 100% rename from helm/pycsw/templates/_tplValues.tpl rename to helm/templates/_tplValues.tpl diff --git a/helm/pycsw/templates/configmap.yaml b/helm/templates/configmap.yaml similarity index 100% rename from helm/pycsw/templates/configmap.yaml rename to helm/templates/configmap.yaml diff --git a/helm/pycsw/templates/deployment.yaml b/helm/templates/deployment.yaml similarity index 100% rename from helm/pycsw/templates/deployment.yaml rename to helm/templates/deployment.yaml diff --git a/helm/pycsw/templates/nginx/nginx-configmap.yaml b/helm/templates/nginx/nginx-configmap.yaml similarity index 100% rename from helm/pycsw/templates/nginx/nginx-configmap.yaml rename to helm/templates/nginx/nginx-configmap.yaml diff --git a/helm/pycsw/templates/service.yaml b/helm/templates/service.yaml similarity index 100% rename from helm/pycsw/templates/service.yaml rename to helm/templates/service.yaml diff --git a/helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml b/helm/templates/uwsgi-exporter/uwsgi-exporter-container.yaml similarity index 100% rename from helm/pycsw/templates/uwsgi-exporter/uwsgi-exporter-container.yaml rename to helm/templates/uwsgi-exporter/uwsgi-exporter-container.yaml diff --git a/helm/pycsw/values.yaml b/helm/values.yaml similarity index 100% rename from helm/pycsw/values.yaml rename to helm/values.yaml diff --git a/release-please-config.json b/release-please-config.json index 75eaf76d..fa852c80 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,12 +7,12 @@ "extra-files": [ { "type": "yaml", - "path": "helm/pycsw/Chart.yaml", + "path": "helm/Chart.yaml", "jsonpath": "$.version" }, { "type": "yaml", - "path": "helm/pycsw/Chart.yaml", + "path": "helm/Chart.yaml", "jsonpath": "$.appVersion" } ] From 5175e4f232dcbd8a18aa154c8916c1260c9b5c62 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Mon, 20 Jul 2026 11:36:38 +0300 Subject: [PATCH 07/15] helm: address PR review feedback on unified chart - remove leading empty line in pycsw-location.conf - rename pycsw.teamConfigmapName helper to pycsw.existingConfigmapName to align with the existingConfigmap value - add logScraping: true to mclabels and nginx.mclabels - genericize routesMapping example (raster -> ) Co-Authored-By: Claude Opus 4.8 (1M context) --- helm/pycsw/config/pycsw-location.conf | 1 - helm/pycsw/templates/_helpers.tpl | 2 +- helm/pycsw/templates/deployment.yaml | 6 +++--- helm/pycsw/values.yaml | 4 +++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/helm/pycsw/config/pycsw-location.conf b/helm/pycsw/config/pycsw-location.conf index dffe1d70..afba6f54 100644 --- a/helm/pycsw/config/pycsw-location.conf +++ b/helm/pycsw/config/pycsw-location.conf @@ -1,4 +1,3 @@ - # pycsw custom uwsgi settings injected into root location uwsgi_pass {{ include "pycsw.service.fullname" . }}:{{ .Values.servicePort }}; include uwsgi_params; diff --git a/helm/pycsw/templates/_helpers.tpl b/helm/pycsw/templates/_helpers.tpl index fd126954..79e0dcf0 100644 --- a/helm/pycsw/templates/_helpers.tpl +++ b/helm/pycsw/templates/_helpers.tpl @@ -138,7 +138,7 @@ Returns the name of the ConfigMap provided by the consuming chart, holding the pycsw.cfg and mappings.py keys. The value may itself be a template. Fails rendering when not provided. */}} -{{- define "pycsw.teamConfigmapName" -}} +{{- define "pycsw.existingConfigmapName" -}} {{- $name := include "common.tplvalues.render" (dict "value" .Values.existingConfigmap "context" .) -}} {{- required "existingConfigmap is required: set it to the name of a ConfigMap containing the keys pycsw.cfg and mappings.py (provided by the consuming chart)" $name -}} {{- end -}} diff --git a/helm/pycsw/templates/deployment.yaml b/helm/pycsw/templates/deployment.yaml index 13534678..2bc70bd4 100644 --- a/helm/pycsw/templates/deployment.yaml +++ b/helm/pycsw/templates/deployment.yaml @@ -13,7 +13,7 @@ {{- if .Values.enabled -}} -{{- $teamConfigmapName := include "pycsw.teamConfigmapName" . }} +{{- $existingConfigmapName := include "pycsw.existingConfigmapName" . }} {{- if .Values.authentication.ssl.enabled }} {{- if and .Values.authentication.ssl.useExternal (not .Values.authentication.ssl.externalSecretName) }} @@ -174,13 +174,13 @@ spec: {{- end }} - name: pyscw-config configMap: - name: {{ $teamConfigmapName }} + name: {{ $existingConfigmapName }} items: - key: "pycsw.cfg" path: "pycsw.cfg" - name: pyscw-mappings configMap: - name: {{ $teamConfigmapName }} + name: {{ $existingConfigmapName }} items: - key: "mappings.py" path: "mappings.py" diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index cf1cc5f0..7ebf7199 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -30,6 +30,7 @@ mclabels: # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: "" + logScraping: true prometheus: enabled: true port: 9117 @@ -144,6 +145,7 @@ nginx: # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: "" + logScraping: true prometheus: enabled: true port: 9117 @@ -222,7 +224,7 @@ nginx: enabled: true # routesMapping must be set by the consuming chart, e.g. # routesMapping: - # - path: /api/raster/v1 + # - path: /api//v1 # host: routesMapping: [] timeout: From 44a71f98b1a329176d957bf9e463fb9273b7302b Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 23 Jul 2026 15:57:29 +0300 Subject: [PATCH 08/15] chore: rename helm nginx config files --- helm/pycsw/config/{pycsw-location.conf => location.conf} | 0 helm/pycsw/config/{pycsw-server.conf => server.conf} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename helm/pycsw/config/{pycsw-location.conf => location.conf} (100%) rename helm/pycsw/config/{pycsw-server.conf => server.conf} (100%) diff --git a/helm/pycsw/config/pycsw-location.conf b/helm/pycsw/config/location.conf similarity index 100% rename from helm/pycsw/config/pycsw-location.conf rename to helm/pycsw/config/location.conf diff --git a/helm/pycsw/config/pycsw-server.conf b/helm/pycsw/config/server.conf similarity index 100% rename from helm/pycsw/config/pycsw-server.conf rename to helm/pycsw/config/server.conf From c0172402ff6da40811404e831181c8e9fa77c499 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 23 Jul 2026 16:05:50 +0300 Subject: [PATCH 09/15] helm: update chart version --- helm/pycsw/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/pycsw/Chart.yaml b/helm/pycsw/Chart.yaml index 88bcb4bd..a3df5dbf 100644 --- a/helm/pycsw/Chart.yaml +++ b/helm/pycsw/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pycsw description: Common Helm chart for pycsw service, consumed as a dependency by team deployment charts type: application -version: 6.6.1 -appVersion: 6.6.1 +version: 6.7.0 +appVersion: 6.7.0 dependencies: - name: nginx version: 2.2.1 From bbc53bce5d553511e96165aa5ec52718e94ac6bf Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 23 Jul 2026 16:06:28 +0300 Subject: [PATCH 10/15] helm: remove image tag from values --- helm/pycsw/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 7ebf7199..4c59275a 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -77,7 +77,7 @@ db: image: repository: pycsw # defaults to the chart appVersion (prefixed with v) when empty - tag: "" + # tag: "" pycswPort: 8000 nodePort: 30018 From e8c5dafa7d3349ef21c5b97aba242053e72d21ca Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 23 Jul 2026 16:08:16 +0300 Subject: [PATCH 11/15] helm: use specific version for timonwong/uwsgi-exporter --- helm/pycsw/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 4c59275a..50fcdf63 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -248,8 +248,8 @@ nginx: uwsgiExporter: image: - repository: "timonwong/uwsgi-exporter" - tag: "latest" + repository: "common/timonwong/uwsgi-exporter" + tag: "v1.3.0" env: logLevel: info # one of [debug, info, warn, error] port: 9117 From a7bfcdee518e37ae908919b2cb9c766535b587ed Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 23 Jul 2026 16:58:05 +0300 Subject: [PATCH 12/15] helm: fix stale nginx conf refs after rename The nginx config files were renamed config/pycsw-{location,server}.conf -> config/{location,server}.conf but references still pointed at the old names, breaking .Files.Get at render. Update values.yaml (fileName, extraVolumeMounts), nginx-configmap keys/Files.Get, and README. Verified: helm template renders clean; configmap emits location.conf/server.conf. --- helm/pycsw/README.md | 2 +- helm/pycsw/templates/nginx/nginx-configmap.yaml | 4 ++-- helm/pycsw/values.yaml | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/helm/pycsw/README.md b/helm/pycsw/README.md index 34360fc0..283fc9ea 100644 --- a/helm/pycsw/README.md +++ b/helm/pycsw/README.md @@ -91,7 +91,7 @@ must set: ## Nginx Nginx uses the modular extension layout: this chart ships generic -`pycsw-server.conf` / `pycsw-location.conf` snippets mounted into the nginx +`server.conf` / `location.conf` snippets mounted into the nginx subchart's `extensions` directory. Team-specific nginx behavior is driven by values (`nginx.authorization`, `nginx.route.routesMapping`); additional snippets can be added through the nginx subchart's own values. diff --git a/helm/pycsw/templates/nginx/nginx-configmap.yaml b/helm/pycsw/templates/nginx/nginx-configmap.yaml index 9be63978..bcb6e465 100644 --- a/helm/pycsw/templates/nginx/nginx-configmap.yaml +++ b/helm/pycsw/templates/nginx/nginx-configmap.yaml @@ -12,6 +12,6 @@ metadata: environment: {{ .Values.environment }} release: {{ $releaseName }} data: - pycsw-location.conf: {{ tpl (.Files.Get "config/pycsw-location.conf") . | quote }} - pycsw-server.conf: {{ tpl (.Files.Get "config/pycsw-server.conf") . | quote }} + location.conf: {{ tpl (.Files.Get "config/location.conf") . | quote }} + server.conf: {{ tpl (.Files.Get "config/server.conf") . | quote }} {{- end }} diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 50fcdf63..44c3ae30 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -153,14 +153,14 @@ nginx: extensions: server: enabled: true - fileName: pycsw-server.conf + fileName: server.conf location: enabled: true - fileName: pycsw-location.conf + fileName: location.conf port: 8080 targetPort: 8080 nodePort: 30003 - # rendered into config/pycsw-server.conf (client_max_body_size) + # rendered into config/server.conf (client_max_body_size) clientMaxBodySize: 5000 opentelemetry: @@ -204,11 +204,11 @@ nginx: extraVolumeMounts: - name: nginx-config - mountPath: "/etc/nginx/conf.d/extensions/pycsw-location.conf" - subPath: pycsw-location.conf + mountPath: "/etc/nginx/conf.d/extensions/location.conf" + subPath: location.conf - name: nginx-config - mountPath: "/etc/nginx/conf.d/extensions/pycsw-server.conf" - subPath: pycsw-server.conf + mountPath: "/etc/nginx/conf.d/extensions/server.conf" + subPath: server.conf resources: enabled: true From 55f66f737fd142400b60fa40c23cc2399416a774 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Wed, 29 Jul 2026 17:06:11 +0300 Subject: [PATCH 13/15] helm: widen cors allowedHeaders to *, drop nginx image tag, generic db schema example - env.cors.allowedHeaders "x-api-key" -> "*" - comment out nginx.image.tag (falls back to nginx chart appVersion) - genericize env.db.schema example (drop raster-specific name) Co-Authored-By: Claude Opus 4.8 (1M context) --- helm/pycsw/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index 44c3ae30..b3dfce59 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -104,9 +104,9 @@ env: cors: enabled: true allowedOrigin: "*" - allowedHeaders: "x-api-key" + allowedHeaders: "*" db: - # database schema holding the records table, e.g. RasterCatalogManager + # database schema holding the records table, e.g. CatalogManager schema: "" requirePassword: true tracing: @@ -138,7 +138,7 @@ nginx: image: repository: common/nginx # defaults to the nginx chart appVersion when empty - tag: "" + # tag: "" mclabels: #environment: development partOf: serving From d2a04cbf1293c17a732153aa81d37c284b36c6ed Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Wed, 29 Jul 2026 17:30:27 +0300 Subject: [PATCH 14/15] helm: bump mclabels dependency to 1.1.0 1.1.0 requires the new mclabels `criticality` field; set it to `customer` on both the pycsw and nginx mclabels blocks. Co-Authored-By: Claude Opus 4.8 (1M context) --- helm/pycsw/Chart.yaml | 2 +- helm/pycsw/values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/helm/pycsw/Chart.yaml b/helm/pycsw/Chart.yaml index a3df5dbf..1e849a79 100644 --- a/helm/pycsw/Chart.yaml +++ b/helm/pycsw/Chart.yaml @@ -9,5 +9,5 @@ dependencies: version: 2.2.1 repository: oci://acrarolibotnonprod.azurecr.io/helm/common - name: mclabels - version: 1.0.1 + version: 1.1.0 repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/pycsw/values.yaml b/helm/pycsw/values.yaml index b3dfce59..acab78d9 100644 --- a/helm/pycsw/values.yaml +++ b/helm/pycsw/values.yaml @@ -27,6 +27,7 @@ mclabels: #environment: development component: backend partOf: serving + criticality: customer # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: "" @@ -142,6 +143,7 @@ nginx: mclabels: #environment: development partOf: serving + criticality: customer # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: "" From 14435c35fdc4bb902c712d7d5291453ea42cb173 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 30 Jul 2026 09:21:26 +0300 Subject: [PATCH 15/15] helm: bump mclabels dependency to 1.1.0 1.1.0 requires the new mclabels `criticality` field; set it to `customer` on both the pycsw and nginx mclabels blocks. Co-Authored-By: Claude Opus 4.8 (1M context) --- helm/Chart.yaml | 2 +- helm/values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index a3df5dbf..1e849a79 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -9,5 +9,5 @@ dependencies: version: 2.2.1 repository: oci://acrarolibotnonprod.azurecr.io/helm/common - name: mclabels - version: 1.0.1 + version: 1.1.0 repository: oci://acrarolibotnonprod.azurecr.io/helm/infra diff --git a/helm/values.yaml b/helm/values.yaml index 44c3ae30..620fd807 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -27,6 +27,7 @@ mclabels: #environment: development component: backend partOf: serving + criticality: customer # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: "" @@ -142,6 +143,7 @@ nginx: mclabels: #environment: development partOf: serving + criticality: customer # owner and gisDomain must be set by the consuming chart owner: "" gisDomain: ""