Skip to content

Commit

Permalink
feat(server/deploy): add autoscaling with helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
alambare committed Jun 8, 2024
1 parent d85198a commit 23959f8
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 6 deletions.
6 changes: 3 additions & 3 deletions charts/eodag-server/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.4.0
digest: sha256:b371e6f7f1449fa3abdcb97a04b0bbb2b5d36a4facb8e79041ac36a455b02bb0
generated: "2023-06-19T12:39:44.271254606+02:00"
version: 2.19.3
digest: sha256:de997835d9ce9a9deefc2d70d8c62b11aa1d1a76ece9e86a83736ab9f930bf4d
generated: "2024-06-03T18:43:30.71045378+02:00"
2 changes: 1 addition & 1 deletion charts/eodag-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
repository: oci://registry-1.docker.io/bitnamicharts
tags:
- bitnami-common
version: 2.x
version: 2.x.x
description: EODAG (Earth Observation Data Access Gateway) is a tool for searching,
aggregating results and downloading remote sensed images offering a unified API
for data access regardless of the data provider.
Expand Down
7 changes: 5 additions & 2 deletions charts/eodag-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ The command removes all the Kubernetes components associated with the chart and
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` |
| `global.storageClass` | Global StorageClass for Persistent Volume(s) | `""` |


### Common parameters

| Name | Description | Value |
Expand All @@ -60,7 +59,6 @@ The command removes all the Kubernetes components associated with the chart and
| `clusterDomain` | Kubernetes cluster domain name | `cluster.local` |
| `extraDeploy` | Array of extra objects to deploy with the release | `[]` |


### EODAG Server parameters

| Name | Description | Value |
Expand Down Expand Up @@ -179,6 +177,11 @@ The command removes all the Kubernetes components associated with the chart and
| `serviceAccount.name` | The name of the ServiceAccount to use. | `""` |
| `serviceAccount.annotations` | Additional custom annotations for the ServiceAccount | `{}` |
| `serviceAccount.automountServiceAccountToken` | Automount service account token for the server service account | `true` |
| `autoscaling.enabled` | Enable autoscaling | `false` |
| `autoscaling.minReplicas` | Minimum number of replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of replicas | `10` |
| `autoscaling.targetCPU` | Target CPU utilization percentage | `""` |
| `autoscaling.targetMemory` | Target Memory utilization percentage | `""` |


```console
Expand Down
48 changes: 48 additions & 0 deletions charts/eodag-server/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "common.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- if .Values.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPU }}
{{- end }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/eodag-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -690,3 +690,17 @@ serviceAccount:
## @param serviceAccount.automountServiceAccountToken Automount service account token for the server service account
##
automountServiceAccountToken: true

## Autoscaling configuration
## @param autoscaling.enabled Enable autoscaling
## @param autoscaling.minReplicas Minimum number of replicas
## @param autoscaling.maxReplicas Maximum number of replicas
## @param autoscaling.targetCPU Target CPU utilization percentage
## @param autoscaling.targetMemory Target Memory utilization percentage
##
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
targetCPU: ""
targetMemory: ""

0 comments on commit 23959f8

Please sign in to comment.