From d6f1a5350b05e3b12ead16bf2b258d1b0a21f2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20B=C5=82aszczyk?= Date: Thu, 28 Mar 2024 13:30:16 +0100 Subject: [PATCH] feat: add behavior to hpa spec (#670) --- hacks/values/hydra.yaml | 3 +++ hacks/values/keto.yaml | 3 +++ hacks/values/kratos.yaml | 3 +++ hacks/values/oathkeeper.yaml | 3 +++ helm/charts/hydra/README.md | 3 ++- helm/charts/hydra/templates/hpa.yaml | 3 +++ helm/charts/hydra/values.yaml | 3 +++ helm/charts/keto/README.md | 3 ++- helm/charts/keto/templates/hpa.yaml | 3 +++ helm/charts/keto/values.yaml | 3 +++ helm/charts/kratos/README.md | 1 + helm/charts/kratos/templates/hpa.yaml | 3 +++ helm/charts/kratos/values.yaml | 3 +++ helm/charts/oathkeeper/README.md | 3 ++- helm/charts/oathkeeper/templates/hpa-controller.yaml | 3 +++ helm/charts/oathkeeper/values.yaml | 3 +++ 16 files changed, 43 insertions(+), 3 deletions(-) diff --git a/hacks/values/hydra.yaml b/hacks/values/hydra.yaml index 291f2f5fb2..fc217cc8e5 100644 --- a/hacks/values/hydra.yaml +++ b/hacks/values/hydra.yaml @@ -63,6 +63,9 @@ deployment: targetMemory: type: Utilization averageUtilization: 80 + behavior: + scaleUp: + stabilizationWindowSeconds: 60 strategy: type: RollingUpdate rollingUpdate: diff --git a/hacks/values/keto.yaml b/hacks/values/keto.yaml index 12eb71e600..dc2dc954ba 100644 --- a/hacks/values/keto.yaml +++ b/hacks/values/keto.yaml @@ -27,6 +27,9 @@ deployment: targetMemory: type: Utilization averageUtilization: 80 + behavior: + scaleDown: + stabilizationWindowSeconds: 42 extraLabels: ory.sh/test: keto podMetadata: diff --git a/hacks/values/kratos.yaml b/hacks/values/kratos.yaml index 4ed551c19e..d1280de1ec 100644 --- a/hacks/values/kratos.yaml +++ b/hacks/values/kratos.yaml @@ -10,6 +10,9 @@ autoscaling: targetMemory: type: Utilization averageUtilization: 80 + behavior: + scaleDown: + selectPolicy: Disabled kratos: automigration: diff --git a/hacks/values/oathkeeper.yaml b/hacks/values/oathkeeper.yaml index 3cfb10e95e..a8089c08a2 100644 --- a/hacks/values/oathkeeper.yaml +++ b/hacks/values/oathkeeper.yaml @@ -59,6 +59,9 @@ deployment: targetMemory: type: Utilization averageUtilization: 80 + behavior: + scaleDown: + stabilizationWindowSeconds: 60 strategy: type: RollingUpdate rollingUpdate: diff --git a/helm/charts/hydra/README.md b/helm/charts/hydra/README.md index 443aea8947..49693bf9b1 100644 --- a/helm/charts/hydra/README.md +++ b/helm/charts/hydra/README.md @@ -54,7 +54,8 @@ A Helm chart for deploying ORY Hydra in Kubernetes | deployment.automigration | object | `{"extraEnv":[]}` | Parameters for the automigration initContainer | | deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected - name: FOO value: BAR | | deployment.automountServiceAccountToken | bool | `true` | | -| deployment.autoscaling | object | `{"enabled":false,"maxReplicas":3,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Configure HPA | +| deployment.autoscaling | object | `{"behavior":{},"enabled":false,"maxReplicas":3,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Configure HPA | +| deployment.autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior | | deployment.customLivenessProbe | object | `{}` | Configure a custom livenessProbe. This overwrites the default object | | deployment.customReadinessProbe | object | `{}` | Configure a custom readinessProbe. This overwrites the default object | | deployment.customStartupProbe | object | `{}` | Configure a custom startupProbe. This overwrites the default object | diff --git a/helm/charts/hydra/templates/hpa.yaml b/helm/charts/hydra/templates/hpa.yaml index 1d4ed92a1d..5c4f5df1b3 100644 --- a/helm/charts/hydra/templates/hpa.yaml +++ b/helm/charts/hydra/templates/hpa.yaml @@ -9,6 +9,9 @@ metadata: labels: {{- include "hydra.labels" . | nindent 4 }} spec: + {{- with .Values.deployment.autoscaling.behavior }} + behavior: {{- toYaml . | nindent 4 }} + {{- end }} scaleTargetRef: apiVersion: apps/v1 kind: Deployment diff --git a/helm/charts/hydra/values.yaml b/helm/charts/hydra/values.yaml index 8a8f24013d..00ef606c09 100644 --- a/helm/charts/hydra/values.yaml +++ b/helm/charts/hydra/values.yaml @@ -325,6 +325,9 @@ deployment: targetMemory: {} # type: Utilization # averageUtilization: 80 + # -- Set custom behavior + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior + behavior: {} # -- Default probe timers livenessProbe: diff --git a/helm/charts/keto/README.md b/helm/charts/keto/README.md index cbdc7b7ff5..53b39d32c2 100644 --- a/helm/charts/keto/README.md +++ b/helm/charts/keto/README.md @@ -27,7 +27,8 @@ Access Control Policies as a Server | deployment.automigration | object | `{"extraEnv":[]}` | Parameters for the automigration initContainer | | deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected - name: FOO value: BAR | | deployment.automountServiceAccountToken | bool | `true` | | -| deployment.autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Autoscaling for keto deployment | +| deployment.autoscaling | object | `{"behavior":{},"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Autoscaling for keto deployment | +| deployment.autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior | | deployment.customLivenessProbe | object | `{}` | Configure a custom livenessProbe. This overwrites the default object | | deployment.customReadinessProbe | object | `{}` | Configure a custom readinessProbe. This overwrites the default object | | deployment.customStartupProbe | object | `{}` | Configure a custom startupProbe. This overwrites the default object | diff --git a/helm/charts/keto/templates/hpa.yaml b/helm/charts/keto/templates/hpa.yaml index c2d1795562..acf1a59f5a 100644 --- a/helm/charts/keto/templates/hpa.yaml +++ b/helm/charts/keto/templates/hpa.yaml @@ -11,6 +11,9 @@ metadata: labels: {{- include "keto.labels" . | nindent 4 }} spec: + {{- with $autoscaling.behavior }} + behavior: {{- toYaml . | nindent 4 }} + {{- end }} scaleTargetRef: apiVersion: apps/v1 kind: Deployment diff --git a/helm/charts/keto/values.yaml b/helm/charts/keto/values.yaml index ddf853c0cf..26c6df3317 100644 --- a/helm/charts/keto/values.yaml +++ b/helm/charts/keto/values.yaml @@ -330,6 +330,9 @@ deployment: targetMemory: {} # type: Utilization # averageUtilization: 80 + # -- Set custom behavior + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior + behavior: {} nodeSelector: {} diff --git a/helm/charts/kratos/README.md b/helm/charts/kratos/README.md index 8434235cbf..132f53a9dd 100644 --- a/helm/charts/kratos/README.md +++ b/helm/charts/kratos/README.md @@ -8,6 +8,7 @@ A ORY Kratos Helm chart for Kubernetes | Key | Type | Default | Description | |-----|------|---------|-------------| +| autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior | | autoscaling.enabled | bool | `false` | | | autoscaling.maxReplicas | int | `3` | | | autoscaling.minReplicas | int | `1` | | diff --git a/helm/charts/kratos/templates/hpa.yaml b/helm/charts/kratos/templates/hpa.yaml index 699b8d6466..aa8df05619 100644 --- a/helm/charts/kratos/templates/hpa.yaml +++ b/helm/charts/kratos/templates/hpa.yaml @@ -6,6 +6,9 @@ metadata: labels: {{- include "kratos.labels" . | nindent 4 }} spec: + {{- with .Values.autoscaling.behavior }} + behavior: {{- toYaml . | nindent 4 }} + {{- end }} scaleTargetRef: apiVersion: apps/v1 kind: Deployment diff --git a/helm/charts/kratos/values.yaml b/helm/charts/kratos/values.yaml index 9d39f1b655..0f6347cc23 100644 --- a/helm/charts/kratos/values.yaml +++ b/helm/charts/kratos/values.yaml @@ -512,6 +512,9 @@ autoscaling: targetMemory: {} # type: Utilization # averageUtilization: 80 + # -- Set custom behavior + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior + behavior: {} ## -- Values for initialization job job: diff --git a/helm/charts/oathkeeper/README.md b/helm/charts/oathkeeper/README.md index 41c9bd9c84..96f6de62a6 100644 --- a/helm/charts/oathkeeper/README.md +++ b/helm/charts/oathkeeper/README.md @@ -32,7 +32,8 @@ A Helm chart for deploying ORY Oathkeeper in Kubernetes | demo | bool | `false` | If enabled, a demo deployment with exemplary access rules and JSON Web Key Secrets will be generated. | | deployment.annotations | object | `{}` | | | deployment.automountServiceAccountToken | bool | `false` | | -| deployment.autoscaling | object | `{"enabled":false,"maxReplicas":5,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Configure horizontal pod autoscaler for deployment | +| deployment.autoscaling | object | `{"behavior":{},"enabled":false,"maxReplicas":5,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Configure horizontal pod autoscaler for deployment | +| deployment.autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior | | deployment.customLivenessProbe | object | `{}` | Configure a custom livenessProbe. This overwrites the default object | | deployment.customReadinessProbe | object | `{}` | Configure a custom readinessProbe. This overwrites the default object | | deployment.customStartupProbe | object | `{}` | Configure a custom startupProbe. This overwrites the default object | diff --git a/helm/charts/oathkeeper/templates/hpa-controller.yaml b/helm/charts/oathkeeper/templates/hpa-controller.yaml index 62780d8f42..b80f4a2ae1 100644 --- a/helm/charts/oathkeeper/templates/hpa-controller.yaml +++ b/helm/charts/oathkeeper/templates/hpa-controller.yaml @@ -9,6 +9,9 @@ metadata: labels: {{- include "oathkeeper.labels" . | nindent 4 }} spec: + {{- with .Values.deployment.autoscaling.behavior }} + behavior: {{- toYaml . | nindent 4 }} + {{- end }} scaleTargetRef: apiVersion: apps/v1 kind: Deployment diff --git a/helm/charts/oathkeeper/values.yaml b/helm/charts/oathkeeper/values.yaml index 693311797a..7d309f31cd 100644 --- a/helm/charts/oathkeeper/values.yaml +++ b/helm/charts/oathkeeper/values.yaml @@ -370,6 +370,9 @@ deployment: targetMemory: {} # type: Utilization # averageUtilization: 80 + # -- Set custom behavior + # https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior + behavior: {} # -- Configure node affinity affinity: {}