From 4cbc6c3972f6506c9614a8cef33370d9b5f5d338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Gourv=C3=A9nec?= Date: Mon, 11 Dec 2023 16:48:50 +0100 Subject: [PATCH] feat(hydra): add horizontal pod autoscaling --- resources/hydra/kustomization.yaml | 1 + .../hydra/resources/hydra-deployment.yaml | 5 +++- resources/hydra/resources/hydra-hpa.yaml | 26 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 resources/hydra/resources/hydra-hpa.yaml diff --git a/resources/hydra/kustomization.yaml b/resources/hydra/kustomization.yaml index 34b8a16..666262d 100644 --- a/resources/hydra/kustomization.yaml +++ b/resources/hydra/kustomization.yaml @@ -10,6 +10,7 @@ resources: - ./resources/hydra-migrate-job.yaml - ./resources/hydra-maester - ./resources/hydra-janitor-cronjob.yaml + - ./resources/hydra-hpa.yaml secretGenerator: - name: hydra-secret diff --git a/resources/hydra/resources/hydra-deployment.yaml b/resources/hydra/resources/hydra-deployment.yaml index bf15af4..f8b939c 100644 --- a/resources/hydra/resources/hydra-deployment.yaml +++ b/resources/hydra/resources/hydra-deployment.yaml @@ -55,6 +55,9 @@ spec: name: hydra-public - containerPort: 4445 name: hydra-admin - resources: {} + resources: + requests: + cpu: 100m + memory: 128Mi restartPolicy: Always diff --git a/resources/hydra/resources/hydra-hpa.yaml b/resources/hydra/resources/hydra-hpa.yaml new file mode 100644 index 0000000..17479d2 --- /dev/null +++ b/resources/hydra/resources/hydra-hpa.yaml @@ -0,0 +1,26 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hydra + labels: + io.kompose.service: hydra +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: hydra + minReplicas: 1 + maxReplicas: 3 + metrics: + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 80 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80