From d5e81a443cbc20fcad836431fe4946a93cee79b1 Mon Sep 17 00:00:00 2001 From: Wyatt Walter Date: Tue, 18 Nov 2025 17:05:32 -0600 Subject: [PATCH 1/5] feat: allow specifying deployment in helm chart without autoscaling --- deploy/helm/README.md | 6 +++ deploy/helm/templates/deployment.yaml | 18 ++++--- deploy/helm/templates/persistentVolume.yaml | 4 +- .../helm/templates/persistentVolumeClaim.yaml | 4 +- deploy/helm/tests/persistence_test.yaml | 52 +++++++++++++++++++ deploy/helm/tests/workload_type_test.yaml | 33 ++++++++++++ deploy/helm/values.yaml | 12 +++++ 7 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 deploy/helm/tests/persistence_test.yaml create mode 100644 deploy/helm/tests/workload_type_test.yaml diff --git a/deploy/helm/README.md b/deploy/helm/README.md index 8929dc22ba4..d1b6109784a 100644 --- a/deploy/helm/README.md +++ b/deploy/helm/README.md @@ -96,6 +96,12 @@ The command uninstalls the release and removes all Kubernetes resources associat | `tolerations` | Tolerations for pod assignment | `[]` | | `affinity` | Affinity fod pod assignment | `{}` | +#### Workload kind + +- `workload.kind`: Selects the workload resource to create. Allowed values: `Deployment`, `StatefulSet` (case-insensitive; default: `StatefulSet`). +- Note: When `autoscaling.enabled` is `true`, `workload.kind` is ignored and a `Deployment` is used. +- When using `Deployment` without autoscaling, control the number of replicas with `replicas`. + ### Appsmith service account parameters | Name | Description | Value | | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | diff --git a/deploy/helm/templates/deployment.yaml b/deploy/helm/templates/deployment.yaml index acbaa5e6e6d..02c496d06de 100644 --- a/deploy/helm/templates/deployment.yaml +++ b/deploy/helm/templates/deployment.yaml @@ -1,26 +1,30 @@ {{- $updateStrategy := .Values.updateStrategy | default dict }} {{- $postgresuser := .Values.postgresql.auth.username }} {{- $postgrespass := .Values.postgresql.auth.password }} -{{- $postgrespass := .Values.postgresql.auth.password }} {{- $releaseName := include "appsmith.fullname" . -}} +{{- $workloadKind := upper (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} apiVersion: apps/v1 -kind: {{ if not .Values.autoscaling.enabled }}StatefulSet{{- else }}Deployment{{- end }} +kind: {{ if $useDeployment }}Deployment{{- else }}StatefulSet{{- end }} metadata: name: {{ include "appsmith.fullname" . }} namespace: {{ include "appsmith.namespace" . }} labels: {{- include "appsmith.labels" . | nindent 4 }} spec: + {{- if $useDeployment }} {{- if not .Values.autoscaling.enabled }} - replicas: 1 - serviceName: {{ include "appsmith.fullname" . }} - updateStrategy: - {{- else }} + replicas: {{ .Values.replicas | default 1 }} + {{- end }} strategy: type: {{ .Values.strategyType | default "RollingUpdate" }} rollingUpdate: maxSurge: {{ dig "maxSurge" 1 $updateStrategy }} maxUnavailable: {{ dig "maxUnavailable" "0" $updateStrategy }} + {{- else }} + replicas: 1 + serviceName: {{ include "appsmith.fullname" . }} + updateStrategy: {{- end }} selector: matchLabels: @@ -182,7 +186,7 @@ spec: {{- if not .Values.persistence.enabled }} - name: data emptyDir: {} - {{- else if and (not .Values.autoscaling.enabled) (.Values.persistence.enabled) }} + {{- else if and (not $useDeployment) (.Values.persistence.enabled) }} volumeClaimTemplates: - metadata: name: data diff --git a/deploy/helm/templates/persistentVolume.yaml b/deploy/helm/templates/persistentVolume.yaml index c9655bed227..179e8c9db24 100644 --- a/deploy/helm/templates/persistentVolume.yaml +++ b/deploy/helm/templates/persistentVolume.yaml @@ -1,4 +1,6 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) ( .Values.autoscaling.enabled) }} +{{- $workloadKind := upper (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) $useDeployment }} apiVersion: v1 kind: PersistentVolume metadata: diff --git a/deploy/helm/templates/persistentVolumeClaim.yaml b/deploy/helm/templates/persistentVolumeClaim.yaml index 21a774f3fbe..db8f4d5948b 100644 --- a/deploy/helm/templates/persistentVolumeClaim.yaml +++ b/deploy/helm/templates/persistentVolumeClaim.yaml @@ -1,4 +1,6 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) ( .Values.autoscaling.enabled) }} +{{- $workloadKind := upper (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) $useDeployment }} kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/deploy/helm/tests/persistence_test.yaml b/deploy/helm/tests/persistence_test.yaml new file mode 100644 index 00000000000..dfff6927f2c --- /dev/null +++ b/deploy/helm/tests/persistence_test.yaml @@ -0,0 +1,52 @@ +templates: + - persistentVolume.yaml + - persistentVolumeClaim.yaml +tests: + # Test PersistentVolume creation + - name: PV and PVC should be created when persistence enabled, no existing claim, and autoscaling enabled + set: + persistence: + enabled: true + existingClaim: + enabled: false + autoscaling: + enabled: true + asserts: + - isKind: + of: PersistentVolumeClaim + template: persistentVolumeClaim.yaml + - isKind: + of: PersistentVolume + template: persistentVolume.yaml + + - name: PVC should NOT be created when persistence is disabled + set: + persistence: + enabled: false + existingClaim: + enabled: false + autoscaling: + enabled: true + asserts: + - hasDocuments: + count: 0 + + - name: PV and PVC should not be created when using existing claim + set: + persistence: + enabled: true + existingClaim: + enabled: true + autoscaling: + enabled: true + asserts: + - hasDocuments: + count: 0 + + - name: PV and PVC should not be created when autoscaling is disabled + set: + autoscaling: + enabled: false + asserts: + - hasDocuments: + count: 0 diff --git a/deploy/helm/tests/workload_type_test.yaml b/deploy/helm/tests/workload_type_test.yaml new file mode 100644 index 00000000000..3cb869b581a --- /dev/null +++ b/deploy/helm/tests/workload_type_test.yaml @@ -0,0 +1,33 @@ +templates: + - deployment.yaml +tests: + - name: workload type should be StatefulSet when not set + asserts: + - equal: + path: kind + value: StatefulSet + - name: workload type should be Deployment when set + set: + workload: + kind: Deployment + asserts: + - equal: + path: kind + value: Deployment + - name: replica count should be used when set + set: + workload: + kind: Deployment + replicas: 99 + asserts: + - equal: + path: spec.replicas + value: 99 + - name: workload type should be Deployment when autoscaling is enabled + set: + autoscaling: + enabled: true + asserts: + - equal: + path: kind + value: Deployment diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml index e26e24eb4a4..45485d2c57f 100644 --- a/deploy/helm/values.yaml +++ b/deploy/helm/values.yaml @@ -271,6 +271,18 @@ resources: cpu: 500m memory: 3000Mi +## @param workload.kind Select workload resource type: Deployment or StatefulSet +## When set to Deployment, the chart creates a Deployment instead of a StatefulSet. +## Note: This value is ignored when autoscaling.enabled is true (Deployment is used). +## +workload: + kind: StatefulSet + +## @param replicas Number of replicas when autoscaling is disabled +## Only used when workload.kind is Deployment and autoscaling.enabled is false +## +replicas: 1 + autoscaling: enabled: false minReplicas: 2 From 83c18ad6e31c34b41f96e1fa5fb0fdc33ddf03be Mon Sep 17 00:00:00 2001 From: Wyatt Walter Date: Tue, 18 Nov 2025 17:08:19 -0600 Subject: [PATCH 2/5] bump helm chart version --- deploy/helm/Chart.yaml | 2 +- .../__snapshot__/defaults_snapshot_test.yaml.snap | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml index 04d7136d985..ac4a693ec2e 100644 --- a/deploy/helm/Chart.yaml +++ b/deploy/helm/Chart.yaml @@ -11,7 +11,7 @@ sources: - https://github.com/appsmithorg/appsmith home: https://www.appsmith.com/ icon: https://assets.appsmith.com/appsmith-icon.png -version: 3.6.5 +version: 3.6.6 dependencies: - condition: redis.enabled name: redis diff --git a/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap b/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap index d114faf2138..eec77c1c023 100644 --- a/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap @@ -25,7 +25,7 @@ app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: appsmith - appsmith.sh/chart: appsmith-3.6.5 + appsmith.sh/chart: appsmith-3.6.6 name: RELEASE-NAME-appsmith namespace: NAMESPACE 3: | @@ -36,7 +36,7 @@ app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: appsmith - appsmith.sh/chart: appsmith-3.6.5 + appsmith.sh/chart: appsmith-3.6.6 name: RELEASE-NAME-appsmith namespace: NAMESPACE spec: @@ -143,7 +143,7 @@ app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: appsmith - appsmith.sh/chart: appsmith-3.6.5 + appsmith.sh/chart: appsmith-3.6.6 name: RELEASE-NAME-appsmith-headless namespace: NAMESPACE spec: @@ -182,7 +182,7 @@ app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: appsmith - appsmith.sh/chart: appsmith-3.6.5 + appsmith.sh/chart: appsmith-3.6.6 name: RELEASE-NAME-appsmith namespace: NAMESPACE spec: @@ -203,7 +203,7 @@ app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: appsmith - appsmith.sh/chart: appsmith-3.6.5 + appsmith.sh/chart: appsmith-3.6.6 name: RELEASE-NAME-appsmith namespace: NAMESPACE secrets: From 32b8b83c234c1c744056dfe985851fb3f0b52116 Mon Sep 17 00:00:00 2001 From: Wyatt Walter Date: Tue, 18 Nov 2025 21:28:05 -0600 Subject: [PATCH 3/5] address comments from code rabbit --- deploy/helm/templates/deployment.yaml | 1 - deploy/helm/tests/persistence_test.yaml | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/deploy/helm/templates/deployment.yaml b/deploy/helm/templates/deployment.yaml index 02c496d06de..2ea26e7b822 100644 --- a/deploy/helm/templates/deployment.yaml +++ b/deploy/helm/templates/deployment.yaml @@ -24,7 +24,6 @@ spec: {{- else }} replicas: 1 serviceName: {{ include "appsmith.fullname" . }} - updateStrategy: {{- end }} selector: matchLabels: diff --git a/deploy/helm/tests/persistence_test.yaml b/deploy/helm/tests/persistence_test.yaml index dfff6927f2c..8d5b5785643 100644 --- a/deploy/helm/tests/persistence_test.yaml +++ b/deploy/helm/tests/persistence_test.yaml @@ -43,7 +43,19 @@ tests: - hasDocuments: count: 0 - - name: PV and PVC should not be created when autoscaling is disabled + - name: PV and PVC should be created when setting workload kind to Deployment + set: + workload: + kind: Deployment + asserts: + - isKind: + of: PersistentVolumeClaim + template: persistentVolumeClaim.yaml + - isKind: + of: PersistentVolume + template: persistentVolume.yaml + + - name: PV and PVC should not be created when autoscaling is disabled and workload kind not set set: autoscaling: enabled: false From 35fba39e7724faf3710ea1717dcbec0a5b91553e Mon Sep 17 00:00:00 2001 From: Wyatt Walter Date: Tue, 18 Nov 2025 21:42:23 -0600 Subject: [PATCH 4/5] update snapshot --- deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap | 1 - 1 file changed, 1 deletion(-) diff --git a/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap b/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap index eec77c1c023..1316a3b5c25 100644 --- a/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap @@ -125,7 +125,6 @@ securityContext: {} serviceAccountName: RELEASE-NAME-appsmith volumes: null - updateStrategy: null volumeClaimTemplates: - metadata: name: data From c43d4b507cc634d6d327af71ad2a91002aad9c32 Mon Sep 17 00:00:00 2001 From: tomerqodo Date: Thu, 4 Dec 2025 22:28:01 +0200 Subject: [PATCH 5/5] Apply changes for benchmark PR --- deploy/helm/templates/deployment.yaml | 7 ++----- deploy/helm/templates/persistentVolume.yaml | 4 ++-- deploy/helm/templates/persistentVolumeClaim.yaml | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/deploy/helm/templates/deployment.yaml b/deploy/helm/templates/deployment.yaml index 2ea26e7b822..4584d1d7a25 100644 --- a/deploy/helm/templates/deployment.yaml +++ b/deploy/helm/templates/deployment.yaml @@ -2,8 +2,8 @@ {{- $postgresuser := .Values.postgresql.auth.username }} {{- $postgrespass := .Values.postgresql.auth.password }} {{- $releaseName := include "appsmith.fullname" . -}} -{{- $workloadKind := upper (toString .Values.workload.kind) -}} -{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} +{{- $workloadKind := lower (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "deployment") .Values.autoscaling.enabled }} apiVersion: apps/v1 kind: {{ if $useDeployment }}Deployment{{- else }}StatefulSet{{- end }} metadata: @@ -13,16 +13,13 @@ metadata: {{- include "appsmith.labels" . | nindent 4 }} spec: {{- if $useDeployment }} - {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicas | default 1 }} - {{- end }} strategy: type: {{ .Values.strategyType | default "RollingUpdate" }} rollingUpdate: maxSurge: {{ dig "maxSurge" 1 $updateStrategy }} maxUnavailable: {{ dig "maxUnavailable" "0" $updateStrategy }} {{- else }} - replicas: 1 serviceName: {{ include "appsmith.fullname" . }} {{- end }} selector: diff --git a/deploy/helm/templates/persistentVolume.yaml b/deploy/helm/templates/persistentVolume.yaml index 179e8c9db24..c230c71b384 100644 --- a/deploy/helm/templates/persistentVolume.yaml +++ b/deploy/helm/templates/persistentVolume.yaml @@ -1,5 +1,5 @@ -{{- $workloadKind := upper (toString .Values.workload.kind) -}} -{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} +{{- $workloadKind := lower (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "deployment") .Values.autoscaling.enabled }} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) $useDeployment }} apiVersion: v1 kind: PersistentVolume diff --git a/deploy/helm/templates/persistentVolumeClaim.yaml b/deploy/helm/templates/persistentVolumeClaim.yaml index db8f4d5948b..efab1b8a623 100644 --- a/deploy/helm/templates/persistentVolumeClaim.yaml +++ b/deploy/helm/templates/persistentVolumeClaim.yaml @@ -1,5 +1,5 @@ -{{- $workloadKind := upper (toString .Values.workload.kind) -}} -{{- $useDeployment := or (eq $workloadKind "DEPLOYMENT") .Values.autoscaling.enabled }} +{{- $workloadKind := lower (toString .Values.workload.kind) -}} +{{- $useDeployment := or (eq $workloadKind "deployment") .Values.autoscaling.enabled }} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim.enabled) $useDeployment }} kind: PersistentVolumeClaim apiVersion: v1