Skip to content
Merged
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
9 changes: 9 additions & 0 deletions helm/kagent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,12 @@ Engine labels
{{ include "kagent.labels" . }}
app.kubernetes.io/component: engine
{{- end }}

{{/*
Validate controller configuration
*/}}
{{- define "kagent.validateController" -}}
{{- if and (gt (.Values.controller.replicas | int) 1) (eq .Values.database.type "sqlite") -}}
{{- fail "ERROR: controller.replicas cannot be greater than 1 when database.type is 'sqlite' as the SQLite database is local to the pod. Please either set controller.replicas to 1 or change database.type to 'postgres'." }}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions helm/kagent/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- include "kagent.validateController" . -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
15 changes: 14 additions & 1 deletion helm/kagent/tests/controller-deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@ tests:
- hasDocuments:
count: 1

- it: should render controller deployment with custom replica count
- it: should fail when replicas > 1 and database type is sqlite
template: controller-deployment.yaml
set:
controller:
replicas: 3
database:
type: sqlite
asserts:
- failedTemplate:
errorMessage: "ERROR: controller.replicas cannot be greater than 1 when database.type is 'sqlite' as the SQLite database is local to the pod. Please either set controller.replicas to 1 or change database.type to 'postgres'."

- it: should render controller deployment with custom replica count if database type is postgres
template: controller-deployment.yaml
set:
controller:
replicas: 3
database:
type: postgres
asserts:
- equal:
path: spec.replicas
Expand Down
Loading