Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- |
Expand Down
17 changes: 10 additions & 7 deletions deploy/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{{- $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" . }}
{{- end }}
selector:
matchLabels:
Expand Down Expand Up @@ -182,7 +185,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
Expand Down
4 changes: 3 additions & 1 deletion deploy/helm/templates/persistentVolume.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 3 additions & 1 deletion deploy/helm/templates/persistentVolumeClaim.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 5 additions & 6 deletions deploy/helm/tests/__snapshot__/defaults_snapshot_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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:
Expand Down Expand Up @@ -125,7 +125,6 @@
securityContext: {}
serviceAccountName: RELEASE-NAME-appsmith
volumes: null
updateStrategy: null
volumeClaimTemplates:
- metadata:
name: data
Expand All @@ -143,7 +142,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:
Expand Down Expand Up @@ -182,7 +181,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:
Expand All @@ -203,7 +202,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:
Expand Down
64 changes: 64 additions & 0 deletions deploy/helm/tests/persistence_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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 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
asserts:
- hasDocuments:
count: 0
33 changes: 33 additions & 0 deletions deploy/helm/tests/workload_type_test.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down