From 4dfd7d29e39a2e0ffccf273904b5c79b4a28254c Mon Sep 17 00:00:00 2001 From: Felix Delattre Date: Mon, 28 Oct 2024 13:30:36 +0100 Subject: [PATCH] Introduced .Values.externalServices. Co-authored-by: Ciaran Sweet --- .../eoapi/templates/services/configmap.yaml | 7 +- .../eoapi/templates/services/deployment.yaml | 7 +- helm-chart/eoapi/templates/services/hpa.yaml | 5 +- .../templates/services/ingress-nginx.yaml | 6 +- .../eoapi/templates/services/service.yaml | 7 +- helm-chart/eoapi/values.yaml | 324 +++++++++--------- 6 files changed, 172 insertions(+), 184 deletions(-) diff --git a/helm-chart/eoapi/templates/services/configmap.yaml b/helm-chart/eoapi/templates/services/configmap.yaml index 92be1d3..84253f9 100644 --- a/helm-chart/eoapi/templates/services/configmap.yaml +++ b/helm-chart/eoapi/templates/services/configmap.yaml @@ -1,5 +1,4 @@ -{{- range $serviceName, $v := .Values -}} -{{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} +{{- range $serviceName, $v := .Values.externalServices -}} {{- if index $v "enabled" }} apiVersion: v1 kind: ConfigMap @@ -12,7 +11,5 @@ data: --- {{/* END: if index $v "enabled" */}} {{- end }} -{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} -{{- end }} -{{/* END: range $serviceName, $v := .Values*/}} +{{/* END: range $serviceName, $v := .Values.externalServices */}} {{- end }} diff --git a/helm-chart/eoapi/templates/services/deployment.yaml b/helm-chart/eoapi/templates/services/deployment.yaml index 6deba2b..0defc81 100644 --- a/helm-chart/eoapi/templates/services/deployment.yaml +++ b/helm-chart/eoapi/templates/services/deployment.yaml @@ -1,6 +1,5 @@ {{ include "eoapi.validateTempDB" . }} -{{- range $serviceName, $v := .Values -}} -{{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} +{{- range $serviceName, $v := .Values.externalServices -}} {{- if index $v "enabled" }} apiVersion: apps/v1 kind: Deployment @@ -68,7 +67,5 @@ spec: --- {{/* END: if index $v "enabled" */}} {{- end }} -{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} -{{- end }} -{{/* END: range $serviceName, $v := .Values*/}} +{{/* END: range $serviceName, $v := .Values.externalServices */}} {{- end }} diff --git a/helm-chart/eoapi/templates/services/hpa.yaml b/helm-chart/eoapi/templates/services/hpa.yaml index 611023a..34d07b2 100644 --- a/helm-chart/eoapi/templates/services/hpa.yaml +++ b/helm-chart/eoapi/templates/services/hpa.yaml @@ -1,6 +1,5 @@ {{- include "eoapi.validateAutoscaleRules" . -}} -{{- range $serviceName, $v := .Values -}} -{{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} +{{- range $serviceName, $v := .Values.externalServices -}} {{- if index $v "autoscaling" "enabled" }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler @@ -44,7 +43,5 @@ spec: --- {{/* END: if index $v "autoscaling" "enabled" */}} {{- end }} -{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} -{{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} diff --git a/helm-chart/eoapi/templates/services/ingress-nginx.yaml b/helm-chart/eoapi/templates/services/ingress-nginx.yaml index 2802845..6a30a81 100644 --- a/helm-chart/eoapi/templates/services/ingress-nginx.yaml +++ b/helm-chart/eoapi/templates/services/ingress-nginx.yaml @@ -30,8 +30,7 @@ spec: rules: - http: paths: - {{- range $serviceName, $v := .Values }} - {{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} + {{- range $serviceName, $v := .Values.externalServices }} {{- if (and (index $v "enabled") (not $.Values.testing)) }} - pathType: Prefix path: "/{{ $serviceName }}(/|$)(.*)" @@ -49,8 +48,7 @@ spec: port: number: {{ $.Values.service.port }} {{- end }}{{/* END: if index $v "enabled" */}} - {{- end }}{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} - {{- end }}{{/* END: range $serviceName, $v := .Values*/}} + {{- end }}{{/* END: range $serviceName, $v := .Values.externalServices */}} {{- if (and (not $.Values.testing) (.Values.docServer.enabled)) }} - pathType: Prefix path: /(/|$) diff --git a/helm-chart/eoapi/templates/services/service.yaml b/helm-chart/eoapi/templates/services/service.yaml index b66a737..a50ef0f 100644 --- a/helm-chart/eoapi/templates/services/service.yaml +++ b/helm-chart/eoapi/templates/services/service.yaml @@ -1,5 +1,4 @@ -{{- range $serviceName, $v := .Values -}} -{{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} +{{- range $serviceName, $v := .Values.externalServices -}} {{- if index $v "enabled" }} apiVersion: v1 kind: Service @@ -28,7 +27,5 @@ spec: --- {{/* END: if index $v "enabled" */}} {{- end }} -{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} -{{- end }} -{{/* END: range $serviceName, $v := .Values*/}} +{{/* END: range $serviceName, $v := .Values.externalServices */}} {{- end }} diff --git a/helm-chart/eoapi/values.yaml b/helm-chart/eoapi/values.yaml index 97537b3..ecdf679 100644 --- a/helm-chart/eoapi/values.yaml +++ b/helm-chart/eoapi/values.yaml @@ -170,169 +170,171 @@ pgstacBootstrap: ###################### # API SERVICES ###################### -raster: - enabled: true - autoscaling: - # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart - # see ../../../docs/autoscaling.md for more information - enabled: false - minReplicas: 1 - maxReplicas: 10 - # `type`: "cpu" || "requestRate" || "both" - type: "requestRate" - behaviour: - scaleDown: - stabilizationWindowSeconds: 60 - scaleUp: - stabilizationWindowSeconds: 0 - targets: - # matches `type` value above unless `type: "both"` is selected - cpu: 75 - # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' - # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities - # so when the average unit among these pods is /1000 then scale - # you can watch the actual/target in real time using `kubectl get hpa/` - requestRate: 100000m - image: - name: ghcr.io/stac-utils/titiler-pgstac - tag: uvicorn-1.4.0 - command: - - "uvicorn" - - "titiler.pgstac.main:app" - - "--host=$(HOST)" - - "--port=$(PORT)" - settings: - # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: "768m" - memory: "4096Mi" - requests: - cpu: "256m" - memory: "3072Mi" - envVars: - ############## - # titiler - ############## - GDAL_CACHEMAX: "200" # 200 mb - GDAL_DISABLE_READDIR_ON_OPEN: "EMPTY_DIR" - GDAL_INGESTED_BYTES_AT_OPEN: "32768" - GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: "YES" - GDAL_HTTP_MULTIPLEX: "YES" - GDAL_HTTP_VERSION: "2" - PYTHONWARNINGS: "ignore" - VSI_CACHE: "TRUE" - VSI_CACHE_SIZE: "5000000" # 5 MB (per file-handle) - ############## - # uvicorn - ############## - HOST: "0.0.0.0" - PORT: "8080" - # https://www.uvicorn.org/settings/#production - WEB_CONCURRENCY: "5" -stac: - enabled: true - autoscaling: - # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart - # see ../../../docs/autoscaling.md for more information - enabled: false - minReplicas: 1 - maxReplicas: 10 - # `type`: "cpu" || "requestRate" || "both" - type: "requestRate" - behaviour: - scaleDown: - stabilizationWindowSeconds: 60 - scaleUp: - stabilizationWindowSeconds: 0 - targets: - # matches `type` value above unless `type: "both"` is selected - cpu: 75 - # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' - # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities - # so when the average unit among these pods is /1000 then scale - # you can watch the actual/target in real time using `kubectl get hpa/` - requestRate: 100000m - image: - name: ghcr.io/stac-utils/stac-fastapi-pgstac - tag: 2.4.9 - command: - - "uvicorn" - - "stac_fastapi.pgstac.app:app" - - "--host=$(HOST)" - - "--port=$(PORT)" - settings: - # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: "768m" - memory: "1024Mi" - requests: - cpu: "256m" - memory: "1024Mi" - envVars: - ############## - # uvicorn - ############## - HOST: "0.0.0.0" - PORT: "8080" - # https://www.uvicorn.org/settings/#production - WEB_CONCURRENCY: "5" +externalServices: + raster: + enabled: true + autoscaling: + # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart + # see ../../../docs/autoscaling.md for more information + enabled: false + minReplicas: 1 + maxReplicas: 10 + # `type`: "cpu" || "requestRate" || "both" + type: "requestRate" + behaviour: + scaleDown: + stabilizationWindowSeconds: 60 + scaleUp: + stabilizationWindowSeconds: 0 + targets: + # matches `type` value above unless `type: "both"` is selected + cpu: 75 + # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities + # so when the average unit among these pods is /1000 then scale + # you can watch the actual/target in real time using `kubectl get hpa/` + requestRate: 100000m + image: + name: ghcr.io/stac-utils/titiler-pgstac + tag: uvicorn-1.4.0 + command: + - "uvicorn" + - "titiler.pgstac.main:app" + - "--host=$(HOST)" + - "--port=$(PORT)" + settings: + # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + resources: + limits: + cpu: "768m" + memory: "4096Mi" + requests: + cpu: "256m" + memory: "3072Mi" + envVars: + ############## + # titiler + ############## + GDAL_CACHEMAX: "200" # 200 mb + GDAL_DISABLE_READDIR_ON_OPEN: "EMPTY_DIR" + GDAL_INGESTED_BYTES_AT_OPEN: "32768" + GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: "YES" + GDAL_HTTP_MULTIPLEX: "YES" + GDAL_HTTP_VERSION: "2" + PYTHONWARNINGS: "ignore" + VSI_CACHE: "TRUE" + VSI_CACHE_SIZE: "5000000" # 5 MB (per file-handle) + ############## + # uvicorn + ############## + HOST: "0.0.0.0" + PORT: "8080" + # https://www.uvicorn.org/settings/#production + WEB_CONCURRENCY: "5" -vector: - enabled: true - autoscaling: - # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart - # see ../../../docs/autoscaling.md for more information - enabled: false - minReplicas: 1 - maxReplicas: 10 - # `type`: "cpu" || "requestRate" || "both" - type: "requestRate" - behaviour: - scaleDown: - stabilizationWindowSeconds: 60 - scaleUp: - stabilizationWindowSeconds: 0 - targets: - # matches `type` value above unless `type: "both"` is selected - cpu: 75 - # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' - # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities - # so when the average unit among these pods is /1000 then scale - # you can watch the actual/target in real time using `kubectl get hpa/` - requestRate: 100000m - image: - name: ghcr.io/developmentseed/tipg - tag: uvicorn-0.6.1 - command: - - "uvicorn" - - "tipg.main:app" - - "--host=$(HOST)" - - "--port=$(PORT)" - settings: - # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: "768m" - memory: "1024Mi" - requests: - cpu: "256m" - memory: "256Mi" - envVars: - ############## - # tipg - ############## - TIPG_CATALOG_TTL: "300" - TIPG_DEBUG: "True" - ############## - # uvicorn - ############## - HOST: "0.0.0.0" - PORT: "8080" - # https://www.uvicorn.org/settings/#production - WEB_CONCURRENCY: "5" + stac: + enabled: true + autoscaling: + # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart + # see ../../../docs/autoscaling.md for more information + enabled: false + minReplicas: 1 + maxReplicas: 10 + # `type`: "cpu" || "requestRate" || "both" + type: "requestRate" + behaviour: + scaleDown: + stabilizationWindowSeconds: 60 + scaleUp: + stabilizationWindowSeconds: 0 + targets: + # matches `type` value above unless `type: "both"` is selected + cpu: 75 + # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities + # so when the average unit among these pods is /1000 then scale + # you can watch the actual/target in real time using `kubectl get hpa/` + requestRate: 100000m + image: + name: ghcr.io/stac-utils/stac-fastapi-pgstac + tag: 2.4.9 + command: + - "uvicorn" + - "stac_fastapi.pgstac.app:app" + - "--host=$(HOST)" + - "--port=$(PORT)" + settings: + # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + resources: + limits: + cpu: "768m" + memory: "1024Mi" + requests: + cpu: "256m" + memory: "1024Mi" + envVars: + ############## + # uvicorn + ############## + HOST: "0.0.0.0" + PORT: "8080" + # https://www.uvicorn.org/settings/#production + WEB_CONCURRENCY: "5" + + vector: + enabled: true + autoscaling: + # NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart + # see ../../../docs/autoscaling.md for more information + enabled: false + minReplicas: 1 + maxReplicas: 10 + # `type`: "cpu" || "requestRate" || "both" + type: "requestRate" + behaviour: + scaleDown: + stabilizationWindowSeconds: 60 + scaleUp: + stabilizationWindowSeconds: 0 + targets: + # matches `type` value above unless `type: "both"` is selected + cpu: 75 + # 'm' units here represents generic milli (one-thousandth) unit instead of 'decimal' + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#quantities + # so when the average unit among these pods is /1000 then scale + # you can watch the actual/target in real time using `kubectl get hpa/` + requestRate: 100000m + image: + name: ghcr.io/developmentseed/tipg + tag: uvicorn-0.6.1 + command: + - "uvicorn" + - "tipg.main:app" + - "--host=$(HOST)" + - "--port=$(PORT)" + settings: + # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + resources: + limits: + cpu: "768m" + memory: "1024Mi" + requests: + cpu: "256m" + memory: "256Mi" + envVars: + ############## + # tipg + ############## + TIPG_CATALOG_TTL: "300" + TIPG_DEBUG: "True" + ############## + # uvicorn + ############## + HOST: "0.0.0.0" + PORT: "8080" + # https://www.uvicorn.org/settings/#production + WEB_CONCURRENCY: "5" docServer: enabled: true