Skip to content

Commit

Permalink
support and autoscaling additions
Browse files Browse the repository at this point in the history
  • Loading branch information
ranchodeluxe committed Aug 27, 2024
1 parent a092153 commit cde90f5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
helm-chart/config.yaml
config_ingress.yaml
config_ingress.yaml
helm-chart/eoapi/charts/*.tgz
6 changes: 3 additions & 3 deletions helm-chart/eoapi-support/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ prometheus-adapter:
name:
matches: ""
as: "nginx_ingress_controller_requests_rate_vector_eoapi"
metricsQuery: round(sum(rate(<<.Series>>{service=~"vector.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)
metricsQuery: round(sum(rate(<<.Series>>{service="vector",path=~"/vector.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)
- seriesQuery: '{__name__=~"^nginx_ingress_controller_requests$",namespace!=""}'
seriesFilters: []
resources:
template: <<.Resource>>
name:
matches: ""
as: "nginx_ingress_controller_requests_rate_raster_eoapi"
metricsQuery: round(sum(rate(<<.Series>>{service=~"raster.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)
metricsQuery: round(sum(rate(<<.Series>>{service="raster",path=~"/raster.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)
- seriesQuery: '{__name__=~"^nginx_ingress_controller_requests$",namespace!=""}'
seriesFilters: []
resources:
template: <<.Resource>>
name:
matches: ""
as: "nginx_ingress_controller_requests_rate_stac_eoapi"
metricsQuery: round(sum(rate(<<.Series>>{service=~"stac.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)
metricsQuery: round(sum(rate(<<.Series>>{service="stac",path=~"/stac.*",<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>), 0.001)

prometheus:
# alertmanager is an optional prometheus chart dependency that we opt-out from
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ dependencies:
- name: eoapi-support
version: 0.1.4
repository: https://devseed.com/eoapi-k8s/
condition: autoscalingCondition
condition: autoscaling.enabled
9 changes: 0 additions & 9 deletions helm-chart/eoapi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,3 @@ that you cannot have db.enabled and (postgrescluster.enabled or pgstacBootstrap.
{{- end -}}

{{- end -}}


{{- define "check_autoscaling_enabled" -}}
{{- $enabled := false -}}
{{- if or .Values.raster.autoscaling.enabled .Values.vector.autoscaling.enabled .Values.stac.autoscaling.enabled -}}
{{- $enabled = true -}}
{{- end -}}
{{- $enabled -}}
{{- end -}}
2 changes: 2 additions & 0 deletions helm-chart/eoapi/templates/services/ingress-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ metadata:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/enable-cors: "true"
# enable-access-log is required for nginx to dump metrics about path rewrites for prometheus to scrape
nginx.ingress.kubernetes.io/enable-access-log: "true"
{{- if (and (.Values.ingress.tls.enabled) (.Values.ingress.tls.certManager)) }}
cert-manager.io/issuer: {{ .Values.ingress.tls.certManagerIssuer }}
{{- end }}
Expand Down
41 changes: 27 additions & 14 deletions helm-chart/eoapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,12 @@ pgstacBootstrap:
######################
# API SERVICES
######################
# check if ANY of the services below enabled autoscaling and conditionally install the eoapi-support helm chart
autoscalingCondition: {{ include "check_autoscaling_enabled" . }}
# a flag that is only used in the eoapi chart dependencies condition block
# to install the eoapi-support chart that includes the additional observability
# since we cannot use any syntax that such as
# (or .Values.raster.autoscaling.enabled .Values.vector.autoscaling.enabled .Values.stac.autoscaling.enabled)
autoscaling:
enabled: false

raster:
enabled: true
Expand All @@ -180,16 +184,20 @@ raster:
minReplicas: 1
maxReplicas: 10
# `type`: "cpu" || "requestRate" || "both"
type: "requestRate"
type: "both"
behaviour:
scaleDown:
stabilizationWindowSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0
targets:
# matches `type` value above unless `type: "both"` is selected
cpu: 85
requestRate: 10000
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 <requestRate>/1000 then scale
# you can watch the actual/target in real time using `kubectl get hpa/<name>`
requestRate: 10000m
image:
name: ghcr.io/stac-utils/titiler-pgstac
tag: uvicorn-1.2.0
Expand Down Expand Up @@ -236,16 +244,20 @@ stac:
minReplicas: 1
maxReplicas: 10
# `type`: "cpu" || "requestRate" || "both"
type: "requestRate"
type: "both"
behaviour:
scaleDown:
stabilizationWindowSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0
targets:
# matches `type` value above unless `type: "both"` is selected
cpu: 85
requestRate: 15000
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 <requestRate>/1000 then scale
# you can watch the actual/target in real time using `kubectl get hpa/<name>`
requestRate: 60000m
image:
name: ghcr.io/stac-utils/stac-fastapi-pgstac
tag: 2.4.9
Expand Down Expand Up @@ -279,16 +291,20 @@ vector:
minReplicas: 1
maxReplicas: 10
# `type`: "cpu" || "requestRate" || "both"
type: "requestRate"
type: "both"
behaviour:
scaleDown:
stabilizationWindowSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0
targets:
# matches `type` value above unless `type: "both"` is selected
cpu: 85
requestRate: 15000
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 <requestRate>/1000 then scale
# you can watch the actual/target in real time using `kubectl get hpa/<name>`
requestRate: 60000m
image:
name: ghcr.io/developmentseed/tipg
tag: uvicorn-0.6.1
Expand Down Expand Up @@ -322,6 +338,3 @@ vector:

docServer:
enabled: true



0 comments on commit cde90f5

Please sign in to comment.