From 5499b02550e6df5d1fe965d1568919d5bd40c383 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Mon, 28 Mar 2022 08:59:16 -0400 Subject: [PATCH] Autoscaling capability to opensearch-dashboards helm chart (#232) * Added conifigurable ASG stratergy for opensource dahboard helm chart Signed-off-by: pgodithi * Added configurable ASG strategy for opensearch dahboard helm chart Signed-off-by: pgodithi * Resolving the conflict with 1.3 release Signed-off-by: pgodithi * Resolving the conflict with 1.3 release Signed-off-by: pgodithi * Fixed PR comments Signed-off-by: pgodithi * Fixed PR comments Signed-off-by: pgodithi * Fixed PR comments Signed-off-by: pgodithi * Reverting autoscaling to v1 api Signed-off-by: pgodithi * changes in chart.yaml and changelog files Signed-off-by: pgodithi * adding default autoscaling value to false in values.yaml Signed-off-by: pgodithi * Fix conflict issues Signed-off-by: pgodithi * Fix conflict issues remove extra spaces Signed-off-by: pgodithi * fixed wrong git URL Signed-off-by: pgodithi --- charts/opensearch-dashboards/CHANGELOG.md | 18 ++++++++++++++++-- charts/opensearch-dashboards/Chart.yaml | 2 +- charts/opensearch-dashboards/README.md | 1 + .../templates/autoscaler.yaml | 15 +++++++++++++++ charts/opensearch-dashboards/values.yaml | 5 +++-- 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 charts/opensearch-dashboards/templates/autoscaler.yaml diff --git a/charts/opensearch-dashboards/CHANGELOG.md b/charts/opensearch-dashboards/CHANGELOG.md index 4d40c01e..9516cae0 100644 --- a/charts/opensearch-dashboards/CHANGELOG.md +++ b/charts/opensearch-dashboards/CHANGELOG.md @@ -13,6 +13,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security --- +## [1.3.2] +### Added +- Added pod autoscaling capability. +- Added autoscaling configuration parameters in readme. +- Added autoscaling.yaml under templates. +### Changed +- Updated the chart version to 1.3.2 +- Changed values.yaml to reflect autoscaling changes. +### Deprecated +### Removed +### Fixed +### Security +--- ## [1.3.1] ### Added ### Changed @@ -154,7 +167,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security -[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.3.1...HEAD +[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.3.2...HEAD +[1.3.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.3.1...opensearch-1.3.2 [1.3.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.3.0...opensearch-1.3.1 [1.3.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.2.2...opensearch-1.3.0 [1.2.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.2.1...opensearch-1.2.2 @@ -168,4 +182,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [1.0.6]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.0.5...opensearch-1.0.6 [1.0.5]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.0.4...opensearch-1.0.5 [1.0.4]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.0.2...opensearch-1.0.4 -[1.0.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.0.1...opensearch-dashboards-1.0.2 +[1.0.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.0.1...opensearch-dashboards-1.0.2 \ No newline at end of file diff --git a/charts/opensearch-dashboards/Chart.yaml b/charts/opensearch-dashboards/Chart.yaml index 71617013..0c1ce391 100644 --- a/charts/opensearch-dashboards/Chart.yaml +++ b/charts/opensearch-dashboards/Chart.yaml @@ -15,7 +15,7 @@ type: application # 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: 1.3.1 +version: 1.3.2 # 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 diff --git a/charts/opensearch-dashboards/README.md b/charts/opensearch-dashboards/README.md index ae2273ae..0ae02073 100644 --- a/charts/opensearch-dashboards/README.md +++ b/charts/opensearch-dashboards/README.md @@ -74,3 +74,4 @@ | `tolerations` | Configurable [tolerations][] | `[]` | | `updateStrategy` | The [updateStrategy][] for the StatefulSet. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` | | `extraObjects` | Array of extra K8s manifests to deploy | list `[]` | +| `autoscaling` | Prerequisite: Install/Configure metrics server, to install use `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`, See https://github.com/kubernetes-sigs/metrics-server. Configurable pod autoscaling stratergy to scale based on `targetCPUUtilizationPercentage`, configure `minReplicas` and `maxReplicas` for desired scaling | false | \ No newline at end of file diff --git a/charts/opensearch-dashboards/templates/autoscaler.yaml b/charts/opensearch-dashboards/templates/autoscaler.yaml new file mode 100644 index 00000000..be628442 --- /dev/null +++ b/charts/opensearch-dashboards/templates/autoscaler.yaml @@ -0,0 +1,15 @@ +{{- if .Values.autoscaling.enabled -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "opensearch-dashboards.fullname" . }}-hpa + labels: {{- include "opensearch-dashboards.labels" . | nindent 4 }} +spec: + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "opensearch-dashboards.fullname" . }} + targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} \ No newline at end of file diff --git a/charts/opensearch-dashboards/values.yaml b/charts/opensearch-dashboards/values.yaml index 754299b3..25475b6f 100644 --- a/charts/opensearch-dashboards/values.yaml +++ b/charts/opensearch-dashboards/values.yaml @@ -145,11 +145,12 @@ resources: memory: "512M" autoscaling: + # This requires metrics server to be installed, to install use kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml + # See https://github.com/kubernetes-sigs/metrics-server enabled: false minReplicas: 1 - maxReplicas: 100 + maxReplicas: 10 targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 updateStrategy: type: "Recreate"