diff --git a/helm/config/mapProxyUwsgi.ini b/helm/config/mapProxyUwsgi.ini index 27d4838..6a06cc4 100644 --- a/helm/config/mapProxyUwsgi.ini +++ b/helm/config/mapProxyUwsgi.ini @@ -1,5 +1,4 @@ [uwsgi] -{{- $metrics := (include "common.metrics.merged" .) | fromYaml }} ; based on https://github.com/kartoza/docker-mapproxy/blob/master/build_data/uwsgi.ini chdir = /mapproxy wsgi-file = app.py @@ -35,7 +34,7 @@ worker-reload-mercy = 60 ; How long to wait before forcefully killin wsgi-disable-file-wrapper = true harakiri = {{ .Values.mapproxy.uwsgi.harakiri }} chmod-socket = 664 -{{ if $metrics.enabled }} +{{ if .Values.telemetry.metrics.enabled }} stats = :{{ .Values.mapproxy.uwsgi.statsServer.stats }} stats-http = true stats-min = {{ .Values.mapproxy.uwsgi.statsServer.statsMinify }} diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index 661c57f..1945355 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -114,4 +114,15 @@ Returns the cloud provider image pull secret name from global if exists or from {{- $headerList = uniq $headerList -}} {{- quote (join "," $headerList) -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* +Returns the tracing url from global if exists or from the chart's values +*/}} +{{- define "mapproxy.tracingUrl" -}} +{{- if .Values.global.telemetry.tracing.url }} + {{- .Values.global.telemetry.tracing.url -}} +{{- else if .Values.telemetry.tracing.url -}} + {{- .Values.telemetry.tracing.url -}} +{{- end -}} +{{- end -}} diff --git a/helm/templates/_tplValues.tpl b/helm/templates/_tplValues.tpl index bf10856..563fce6 100644 --- a/helm/templates/_tplValues.tpl +++ b/helm/templates/_tplValues.tpl @@ -60,11 +60,3 @@ Custom definitions {{- define "common.fs.merged" -}} {{- include "common.tplvalues.merge" ( dict "values" ( list .Values.storage.fs .Values.global.storage.fs ) "context" . ) }} {{- end -}} - -{{- define "common.tracing.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }} -{{- end -}} - -{{- define "common.metrics.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics .Values.global.metrics ) "context" . ) }} -{{- end -}} diff --git a/helm/templates/intital-container/mapproxy-init-container.yaml b/helm/templates/intital-container/mapproxy-init-container.yaml index f7e5ae1..2c4b323 100644 --- a/helm/templates/intital-container/mapproxy-init-container.yaml +++ b/helm/templates/intital-container/mapproxy-init-container.yaml @@ -71,7 +71,7 @@ name: internal-storage subPath: config/mapproxy.yaml {{- end }} - {{- if .Values.global.ca.enabled }} + {{- if .Values.global.ca.secretName }} - name: REQUESTS_CA_BUNDLE value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }} {{- end }} diff --git a/helm/templates/mapproxinator/mapproxinator-configmap.yaml b/helm/templates/mapproxinator/mapproxinator-configmap.yaml index 753c8a5..4703315 100644 --- a/helm/templates/mapproxinator/mapproxinator-configmap.yaml +++ b/helm/templates/mapproxinator/mapproxinator-configmap.yaml @@ -5,8 +5,8 @@ {{- $db := (include "common.db.merged" .) | fromYaml }} {{- $s3 := (include "common.s3.merged" .) | fromYaml }} {{- $storage := (include "common.storage.merged" .) | fromYaml }} -{{- $metrics := (include "common.metrics.merged" .) | fromYaml }} -{{- $tracing := (include "common.tracing.merged" .) | fromYaml }} +{{- $telemetry := .Values.telemetry -}} +{{- $tracingUrl := include "mapproxy.tracingUrl" . -}} apiVersion: v1 kind: ConfigMap @@ -22,14 +22,11 @@ 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 }} - TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracing.url }} - {{ end }} - {{ if $metrics.enabled }} - TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metrics.url }} - {{ end }} + TELEMETRY_TRACING_ENABLED: {{ $telemetry.tracing.enabled | quote }} + {{- if $telemetry.tracing.enabled }} + TELEMETRY_TRACING_URL: {{ $tracingUrl | quote }} + {{- end }} + TELEMETRY_METRICS_ENABLED: {{ $telemetry.metrics.enabled | quote }} 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/templates/mapproxy-bundle.yaml b/helm/templates/mapproxy-bundle.yaml index f5f732c..30c17f2 100644 --- a/helm/templates/mapproxy-bundle.yaml +++ b/helm/templates/mapproxy-bundle.yaml @@ -8,7 +8,6 @@ {{- $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 }} {{- $s3SecretName := ternary $s3.secretName (printf "%s%s" .Release.Name "-s3-secret") (ne $s3.secretName "") }} - {{- $metrics := (include "common.metrics.merged" .) | fromYaml }} replicas: {{ .replicaCount }} selector: matchLabels: @@ -46,7 +45,7 @@ ######################################################### Mapproxinator Deployment ######################################################### {{- template "mapproxy-chart.mapproxinator-container" (merge (dict "releaseName" .releaseName "chartName" .chartName "cloudProviderDockerRegistryUrl" $cloudProviderDockerRegistryUrl "s3SecretName" $s3SecretName "postgresSecretName" $postgresSecretName) .) }} ######################################################### uwsgi Deployment ######################################################### - {{- if $metrics.enabled }} + {{- if .Values.telemetry.metrics.enabled }} {{- template "mapproxy-chart.uwsgi-exporter-container" (merge (dict "releaseName" .releaseName "chartName" .chartName "cloudProviderDockerRegistryUrl" $cloudProviderDockerRegistryUrl "resources" .Values.uwsgiExporter.resources) .) }} {{- end }} volumes: diff --git a/helm/templates/mapproxy/mapproxy-configmap.yaml b/helm/templates/mapproxy/mapproxy-configmap.yaml index 862e75b..ba2ce1e 100644 --- a/helm/templates/mapproxy/mapproxy-configmap.yaml +++ b/helm/templates/mapproxy/mapproxy-configmap.yaml @@ -3,7 +3,8 @@ {{- $releaseName := .Release.Name -}} {{- $configmapName := include "configmap.fullname" . -}} {{- $s3 := (include "common.s3.merged" .) | fromYaml }} -{{- $tracing := (include "common.tracing.merged" .) | fromYaml }} +{{- $tracing := .Values.telemetry.tracing -}} +{{- $tracingUrl := include "mapproxy.tracingUrl" . -}} apiVersion: v1 kind: ConfigMap metadata: @@ -21,7 +22,9 @@ data: S3_USERNAME: {{ $s3.username | quote }} # ── Telemetry / Tracing ─────────────────────────────────────────────────── TELEMETRY_TRACING_ENABLED: {{ $tracing.enabled | quote }} - TELEMETRY_TRACING_ENDPOINT: {{ $tracing.url | quote }} + {{- if $tracing.enabled }} + TELEMETRY_TRACING_ENDPOINT: {{ $tracingUrl | quote }} + {{- end }} TELEMETRY_TRACING_SAMPLING_RATIO_DENOMINATOR: {{ $tracing.samplingRatioDenominator | quote }} TELEMETRY_BOTO_ENABLED: {{ .Values.mapproxy.env.telemetry.boto.enabled | quote }} TELEMETRY_BOTO_CAPTURE_HEADERS: {{ .Values.mapproxy.env.telemetry.boto.captureHeaders | quote }} diff --git a/helm/templates/mapproxy/mapproxy-container.yaml b/helm/templates/mapproxy/mapproxy-container.yaml index 83069e3..b3ebde3 100644 --- a/helm/templates/mapproxy/mapproxy-container.yaml +++ b/helm/templates/mapproxy/mapproxy-container.yaml @@ -2,7 +2,6 @@ {{- $configmapName := include "configmap.fullname" . -}} {{- $storage := (include "common.storage.merged" .) | fromYaml }} {{- $fs := (include "common.fs.merged" .) | fromYaml }} -{{- $metrics := (include "common.metrics.merged" .) | fromYaml }} {{- $caCertPath := printf "%s/%s" .Values.global.ca.path .Values.global.ca.key }} - name: mapproxy image: {{ .cloudProviderDockerRegistryUrl }}{{ .Values.mapproxy.image.repository }}:{{ .Values.mapproxy.image.tag }} @@ -47,7 +46,7 @@ value: {{ .Values.mapproxy.uwsgi.threads | quote }} - name: HARAKIRI value: {{ .Values.mapproxy.uwsgi.harakiri | quote }} - {{- if $metrics.enabled }} + {{- if .Values.telemetry.metrics.enabled }} # Stats server for uwsgi-exporter / Prometheus - name: UWSGI_STATS_ENABLED value: "true" diff --git a/helm/templates/mapproxy/mapproxy-wmts-deployment.yaml b/helm/templates/mapproxy/mapproxy-wmts-deployment.yaml index c4fc8a0..dcf07c7 100644 --- a/helm/templates/mapproxy/mapproxy-wmts-deployment.yaml +++ b/helm/templates/mapproxy/mapproxy-wmts-deployment.yaml @@ -6,12 +6,6 @@ {{- $replicaCount := .Values.mapproxy.wmts.replicaCount }} {{- $wmtsDeploymentName := include "wmts-deployment.fullname" . }} -{{- if .Values.global.ca.enabled }} -{{- if and .Values.global.ca.secretName (not .Values.global.ca.secretName) }} -{{- fail "When using external ca secret the value for .Values.global.ca.secretName should be set" }} -{{- end }} -{{- end }} - {{- 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" }} diff --git a/helm/values.yaml b/helm/values.yaml index a9fb67d..f51d653 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -3,16 +3,8 @@ global: dockerRegistryUrl: my-registry-url.io imagePullSecretName: "my-registry-secret" flavor: openshift - tracing: - enabled: false - url: "" - samplingRatioDenominator: 1000 - metrics: - enabled: false - url: "" - prometheus: - scrape: false - port: 9117 + telemetry: + tracing: {} environment: "" authentication: jwtPublicKeySecretName: map-colonies-jwks @@ -73,22 +65,19 @@ db: name: "" port: 5432 sslEnabled: false - schema: "" + schema: MapproxyConfig rejectUnauthorized: false secrets: useExternal: false externalSecretName: "" -tracing: - enabled: false - url: "" - # samplingRatioDenominator: 1000 -metrics: - enabled: false - url: "" - prometheus: - scrape: false - port: 9117 +telemetry: + tracing: + enabled: true + url: http://localhost:4317 + samplingRatioDenominator: 1000 + metrics: + enabled: true # add pod annotations # example: @@ -101,7 +90,7 @@ environment: development initialDelaySeconds: 60 splunkIndex: "" resetOnConfigChange: true -imagePullPolicy: Always +imagePullPolicy: IfNotPresent cloudProvider: dockerRegistryUrl: my-registry-url.io @@ -160,9 +149,6 @@ mapproxy: image: repository: docker-mapproxy tag: "latest" - db: - nameOverride: - schema: MapproxyConfig port: 80 targetPort: 8080 uwsgi: