From b7beaf97783ee352fc38b4cd86e47b5f3cae037d Mon Sep 17 00:00:00 2001 From: Ray Marceau Date: Thu, 27 Jul 2023 04:13:09 -0700 Subject: [PATCH] feat: migrate autoscaling api version to v2 (#105) * #104 migrate autoscaling api version from deprecated * make autoscaling api version configurable bump chart version breaking change for older versions of kubernetes * update readme with new autoscaling.apiVersion value --- charts/chatwoot/Chart.yaml | 2 +- charts/chatwoot/README.md | 13 +++++++------ charts/chatwoot/templates/web-hpa.yaml | 3 ++- charts/chatwoot/templates/worker-hpa.yaml | 2 +- charts/chatwoot/values.yaml | 5 +++++ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/charts/chatwoot/Chart.yaml b/charts/chatwoot/Chart.yaml index 2a032c1..f63fcec 100644 --- a/charts/chatwoot/Chart.yaml +++ b/charts/chatwoot/Chart.yaml @@ -31,7 +31,7 @@ sources: - http://www.chatwoot.com # This is the chart version. -version: 1.0.21 +version: 1.1.0 # This is the application version. appVersion: "v2.18.0" diff --git a/charts/chatwoot/README.md b/charts/chatwoot/README.md index 48a8ced..3a48f32 100644 --- a/charts/chatwoot/README.md +++ b/charts/chatwoot/README.md @@ -52,7 +52,7 @@ The command removes all the Kubernetes components associated with the chart and | `image.tag` | Chatwoot image tag (immutable tags are recommended) | `v2.18.0` | | `image.pullPolicy` | Chatwoot image pull policy | `IfNotPresent` | - + ### Chatwoot Environment Variables | Name | Type | Default Value | @@ -79,7 +79,7 @@ The command removes all the Kubernetes components associated with the chart and | `env.SMTP_PORT` | SMTP port | `"587"` | | `env.SMTP_USERNAME` | SMTP username | `""` | | `env.USE_INBOX_AVATAR_FOR_BOT` | Bot customizations | `"true"` | - + ### Email setup for conversation continuity (Incoming emails) | Name | Type | Default Value | @@ -123,7 +123,7 @@ The command removes all the Kubernetes components associated with the chart and | `env.LOG_LEVEL` | string | `"info"` | | `env.LOG_SIZE` | string | `"500"` | -### Third party credentials +### Third party credentials | Name | Type | Default Value | | ----------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------- | @@ -155,6 +155,7 @@ The command removes all the Kubernetes components associated with the chart and | `worker.hpa.minpods` | Minimum number of pods for Chatwoot worker | `2` | | `worker.hpa.maxpods` | Maximum number of pods for Chatwoot worker | `10` | | `worker.replicaCount` | No of worker pods if hpa is not enabled | `1` | +| `autoscaling.apiVersion` | Autoscaling API version | `autoscaling/v2` | ### Other Parameters @@ -301,7 +302,7 @@ helm upgrade chatwoot chatwoot/chatwoot --version="0.9.0" --namespace ug3 -f val 5. Update and install new version of charts. ``` helm repo update -#reset web.replicaCount and worker.replicaCount to your previous values +#reset web.replicaCount and worker.replicaCount to your previous values helm install chatwoot chatwoot/chatwoot -f #-n chatwoot ``` @@ -334,7 +335,7 @@ RAILS_ENV=production bundle exec rails c ::Redis::Alfred.delete(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING) ``` -10. Load the Chatwoot web url, log in using the old credentials and verify the contents. Voila! Thats it!! +10. Load the Chatwoot web url, log in using the old credentials and verify the contents. Voila! Thats it!! ### To 0.9.x @@ -351,7 +352,7 @@ Move from Kubernetes ConfigMap to Kubernetes Secrets for environment variables. ### To 0.6.x -Existing labels were causing issues with `helm upgrade`. `0.6.x` introduces breaking changes related to selector +Existing labels were causing issues with `helm upgrade`. `0.6.x` introduces breaking changes related to selector labels used for deployments. Please delete your helm release and recreate it. Deleting your helm release will not delete your persistent volumes used for Redis, and Postgres and as such your data should be safe. diff --git a/charts/chatwoot/templates/web-hpa.yaml b/charts/chatwoot/templates/web-hpa.yaml index 35c418a..618a10b 100644 --- a/charts/chatwoot/templates/web-hpa.yaml +++ b/charts/chatwoot/templates/web-hpa.yaml @@ -1,5 +1,6 @@ {{- if .Values.web.hpa.enabled -}} -apiVersion: autoscaling/v2beta2 +apiVersion: {{ .Values.autoscaling.apiVersion }} + kind: HorizontalPodAutoscaler metadata: name: {{ template "chatwoot.fullname" . }}-web diff --git a/charts/chatwoot/templates/worker-hpa.yaml b/charts/chatwoot/templates/worker-hpa.yaml index 4bbde16..1b3e065 100644 --- a/charts/chatwoot/templates/worker-hpa.yaml +++ b/charts/chatwoot/templates/worker-hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.worker.hpa.enabled -}} -apiVersion: autoscaling/v2beta2 +apiVersion: {{ .Values.autoscaling.apiVersion }} kind: HorizontalPodAutoscaler metadata: name: {{ template "chatwoot.fullname" . }}-worker diff --git a/charts/chatwoot/values.yaml b/charts/chatwoot/values.yaml index 759e830..7702e04 100644 --- a/charts/chatwoot/values.yaml +++ b/charts/chatwoot/values.yaml @@ -7,6 +7,11 @@ image: tag: v2.18.0 pullPolicy: IfNotPresent +# Set to autoscaling/v2beta2 for older versions of kubernetes that do not have autoscaling/v2 API (pre v1.26) +# See https://kubernetes.io/docs/reference/using-api/deprecation-guide/#horizontalpodautoscaler-v126 +autoscaling: + apiVersion: autoscaling/v2 + web: hpa: # set this to true to enable horizontal pod autoscaling