diff --git a/helm-chart/.gitignore b/helm-chart/.gitignore new file mode 100644 index 00000000..c6f42624 --- /dev/null +++ b/helm-chart/.gitignore @@ -0,0 +1 @@ +.deploy.sh diff --git a/helm-chart/eoapi/CHANGELOG.md b/helm-chart/eoapi/CHANGELOG.md index e7153ab3..35d82f58 100644 --- a/helm-chart/eoapi/CHANGELOG.md +++ b/helm-chart/eoapi/CHANGELOG.md @@ -1,33 +1,37 @@ -version numbers below correspond to helm chart `appVersion`: see ./helm-chart/eoapi/Chart.yaml +##### version numbers below correspond to helm chart `appVersion`: see ./helm-chart/eoapi/Chart.yaml --- -# 0.1.6 (2023-09-27) +### 0.1.7 (2023-10-01) + +* adds `autoscaling` options to each service for HPA + +### 0.1.6 (2023-09-27) * adds `docServer.enable` flag to the `values.yaml` and service templates -# 0.1.5 (2023-09-16) +### 0.1.5 (2023-09-16) * adds a cpu and memory limits/requests to the `db` config block -# 0.1.4 (2023-09-09) +### 0.1.4 (2023-09-09) * adds a `testing: false` value to `values.yaml` * plumb through `{{ $.Release.Name }}` into all the right templates so our CI can `helm install` into a single namespace and run tests in parallel -# 0.1.3 (2023-09-05) +### 0.1.3 (2023-09-05) * test on GKE and add documentation where needed for [GKE template changes](https://github.com/developmentseed/eoapi-k8s/issues/29) * CI/CD should run on GKE so we debug less test failures on minikube for [move CI/CD away from minikube](https://github.com/developmentseed/eoapi-k8s/issues/36) * documentation about default configuration and additional options for [documentation](https://github.com/developmentseed/eoapi-k8s/issues/19) -# 0.1.2 (2023-08-31) +### 0.1.2 (2023-08-31) * move `command` blocks out to `values.yml` for [generalizing ticket](https://github.com/developmentseed/eoapi-k8s/issues/31) * add `livenessProbe` for all deployments for [livenessProbe bug](https://github.com/developmentseed/eoapi-k8s/issues/26) -# 0.1.1 (2023-07-21) +### 0.1.1 (2023-07-21) * For the shared-nginx ingress option [add root path with docs](https://github.com/developmentseed/eoapi-k8s/issues/18) pointing to path rewrites -# 0.1.0 (2023-07-01) +### 0.1.0 (2023-07-01) * Adds basic AWS EKS services with ALB and NLB options diff --git a/helm-chart/eoapi/Chart.yaml b/helm-chart/eoapi/Chart.yaml index 8a562232..c7aa5c13 100644 --- a/helm-chart/eoapi/Chart.yaml +++ b/helm-chart/eoapi/Chart.yaml @@ -17,10 +17,10 @@ kubeVersion: ">=1.23.0-0" # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: "0.1.8" +version: "0.1.9" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.1.6" +appVersion: "0.1.7" diff --git a/helm-chart/eoapi/templates/services/hpa.yaml b/helm-chart/eoapi/templates/services/hpa.yaml new file mode 100644 index 00000000..56d92792 --- /dev/null +++ b/helm-chart/eoapi/templates/services/hpa.yaml @@ -0,0 +1,33 @@ +{{- range $serviceName, $v := .Values -}} +{{- if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) }} +{{- if index $v "autoscaling" "enabled" }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hpa-{{ $serviceName }}-{{ $.Release.Name }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ $serviceName }}-{{ $.Release.Name }} + minReplicas: {{ index $v "autoscaling" "minReplicas" }} + maxReplicas: {{ index $v "autoscaling" "maxReplicas" }} + behavior: + scaleDown: + stabilizationWindowSeconds: 180 + scaleUp: + stabilizationWindowSeconds: 60 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ index $v "autoscaling" "utilizationTarget" "cpu" }} +--- +{{/* 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/test-unittest-values.yaml b/helm-chart/eoapi/test-unittest-values.yaml index cab1145a..75e202b8 100644 --- a/helm-chart/eoapi/test-unittest-values.yaml +++ b/helm-chart/eoapi/test-unittest-values.yaml @@ -19,7 +19,7 @@ raster: settings: resources: limits: - cpu: "512m" + cpu: "768m" memory: "4096Mi" requests: cpu: "256m" @@ -29,8 +29,8 @@ stac: settings: resources: limits: - cpu: "512m" - memory: "1024Mi" + cpu: "1280m" + memory: "1536Mi" requests: cpu: "512m" memory: "1024Mi" @@ -39,8 +39,8 @@ vector: settings: resources: limits: - cpu: "256m" - memory: "768Mi" + cpu: "768m" + memory: "1536Mi" requests: cpu: "256m" - memory: "768Mi" + memory: "1024Mi" diff --git a/helm-chart/eoapi/values.yaml b/helm-chart/eoapi/values.yaml index 2aa23f59..e2599f2c 100644 --- a/helm-chart/eoapi/values.yaml +++ b/helm-chart/eoapi/values.yaml @@ -89,6 +89,12 @@ ingress: raster: enabled: true + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 10 + utilizationTarget: + cpu: 50 image: name: ghcr.io/stac-utils/titiler-pgstac tag: uvicorn-0.4.1 @@ -131,6 +137,12 @@ raster: stac: enabled: true + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 10 + utilizationTarget: + cpu: 50 image: name: ghcr.io/stac-utils/stac-fastapi-pgstac tag: 2.4.9 @@ -160,6 +172,12 @@ stac: vector: enabled: true + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 10 + utilizationTarget: + cpu: 50 image: name: ghcr.io/developmentseed/tipg tag: uvicorn-0.2.0