From a494da714af418704d68cc7a4d69de1a71b1023b Mon Sep 17 00:00:00 2001 From: roicohen326 Date: Wed, 5 Aug 2026 11:50:56 +0300 Subject: [PATCH] fix: restore config management support for mapproxinator mapproxinator v1.3.0 adopted @map-colonies/config, which fetches config over HTTP at startup. The chart sets no CONFIG_* variables, so the library falls back to its default server URL and the container exits: ConfigError [httpGeneralError]: connect ECONNREFUSED 127.0.0.1:8080 at async initConfig (/usr/src/app/common/config.js:14:22) This support existed once. #85 added it on 25 Jun; #86 (the v2.0.0 MapProxy 6 rewrite) removed it a day later, so 2.0.0, 2.1.0 and 2.1.1 all shipped without it. This restores it in both configmaps - the init container and mapproxinator use separate ones, and both containers run the same image. Deviation from #85: version defaults to 'latest', not ''. Verified against the real image - an empty value fails schema validation: 'version' property must be equal to the allowed value path: '{base}.version', allowedValue: 'latest' serverUrl now matches the exporter-trigger convention. Verified by running mapproxinator:v1.3.0 in-cluster with the rendered env: config initialization succeeds ("initializing configuration") and the process proceeds to its normal FS provider step. Consumers set global.configManagement.offlineMode=true to cover both containers with one value. --- helm/templates/_tplValues.tpl | 8 ++++++++ .../initial-container-configmap.yaml | 7 +++++++ .../mapproxinator/mapproxinator-configmap.yaml | 15 +++++++++++---- helm/values.yaml | 11 +++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/helm/templates/_tplValues.tpl b/helm/templates/_tplValues.tpl index bf10856..db4945c 100644 --- a/helm/templates/_tplValues.tpl +++ b/helm/templates/_tplValues.tpl @@ -45,6 +45,14 @@ End of usage example Custom definitions */}} +{{- define "common.initContainer.configManagement.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.initContainer.configManagement .Values.global.configManagement ) "context" . ) }} +{{- end -}} + +{{- define "common.mapproxinator.configManagement.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.mapproxinator.configManagement .Values.global.configManagement ) "context" . ) }} +{{- end -}} + {{- define "common.storage.merged" -}} {{- include "common.tplvalues.merge" ( dict "values" ( list .Values.storage .Values.global.storage ) "context" . ) }} {{- end -}} diff --git a/helm/templates/intital-container/initial-container-configmap.yaml b/helm/templates/intital-container/initial-container-configmap.yaml index abe49aa..4fb0450 100644 --- a/helm/templates/intital-container/initial-container-configmap.yaml +++ b/helm/templates/intital-container/initial-container-configmap.yaml @@ -2,6 +2,7 @@ {{- $chartName := include "mapproxy.name" . -}} {{- $releaseName := .Release.Name -}} {{- $initConfigmapName := include "init-configmap.fullname" . -}} +{{- $configManagement := (include "common.initContainer.configManagement.merged" .) | fromYaml }} {{- $db := (include "common.db.merged" .) | fromYaml }} {{- $s3 := (include "common.s3.merged" .) | fromYaml }} {{- $storage := (include "common.storage.merged" .) | fromYaml }} @@ -16,6 +17,12 @@ metadata: release: {{ $releaseName }} data: LOG_LEVEL: {{ .Values.initContainer.env.logLevel | quote }} + {{- with $configManagement }} + CONFIG_NAME: {{ .name | quote }} + CONFIG_VERSION: {{ .version | quote }} + CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }} + CONFIG_SERVER_URL: {{ .serverUrl | quote }} + {{- end }} CONFIG_PROVIDER: {{ $storage.mapproxyConfigProvider }} S3_ENDPOINT_URL: {{ $s3.endpointUrl }} S3_BUCKET: {{ $s3.tilesBucket }} diff --git a/helm/templates/mapproxinator/mapproxinator-configmap.yaml b/helm/templates/mapproxinator/mapproxinator-configmap.yaml index 753c8a5..44c36e3 100644 --- a/helm/templates/mapproxinator/mapproxinator-configmap.yaml +++ b/helm/templates/mapproxinator/mapproxinator-configmap.yaml @@ -2,6 +2,7 @@ {{- $chartName := include "mapproxy.name" . -}} {{- $releaseName := .Release.Name -}} {{- $mapproxinatorConfigmapName := include "mapproxinator-configmap.fullname" . -}} +{{- $configManagement := (include "common.mapproxinator.configManagement.merged" .) | fromYaml }} {{- $db := (include "common.db.merged" .) | fromYaml }} {{- $s3 := (include "common.s3.merged" .) | fromYaml }} {{- $storage := (include "common.storage.merged" .) | fromYaml }} @@ -22,14 +23,20 @@ data: RESPONSE_COMPRESSION_ENABLED: {{ .Values.mapproxinator.env.responseCompressionEnabled | quote }} LOG_LEVEL: {{ .Values.mapproxinator.env.logLevel | quote }} LOG_PRETTY_PRINT_ENABLED: {{ .Values.mapproxinator.env.logPrettyPrintEnabled | quote }} - {{ if $tracing.enabled }} + {{- if $tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' TELEMETRY_TRACING_URL: {{ $tracing.url }} - {{ end }} - {{ if $metrics.enabled }} + {{- end }} + {{- if $metrics.enabled }} TELEMETRY_METRICS_ENABLED: 'true' TELEMETRY_METRICS_URL: {{ $metrics.url }} - {{ end }} + {{- end }} + {{- with $configManagement }} + CONFIG_NAME: {{ .name | quote }} + CONFIG_VERSION: {{ .version | quote }} + CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }} + CONFIG_SERVER_URL: {{ .serverUrl | quote }} + {{- end }} SERVER_PORT: {{ .Values.mapproxinator.targetPort | quote }} CONFIG_PROVIDER: {{ $storage.mapproxyConfigProvider | quote }} POLL_TIMEOUT_FREQUENCY_MS: {{ .Values.mapproxinator.env.poll.timeout.frequencyMS | quote }} diff --git a/helm/values.yaml b/helm/values.yaml index a9fb67d..84f586e 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -3,6 +3,7 @@ global: dockerRegistryUrl: my-registry-url.io imagePullSecretName: "my-registry-secret" flavor: openshift + configManagement: {} tracing: enabled: false url: "" @@ -213,6 +214,11 @@ initContainer: image: repository: mapproxinator tag: "latest" + configManagement: + offlineMode: false + name: 'mapproxinator' + version: 'latest' + serverUrl: 'http://localhost:8080/api' env: logLevel: warn ssl: @@ -394,6 +400,11 @@ mapproxinator: port: 80 targetPort: 8081 nodePort: 30002 + configManagement: + offlineMode: false + name: 'mapproxinator' + version: 'latest' + serverUrl: 'http://localhost:8080/api' env: logLevel: warn poll: