From 5e4be980a7bd7130b16d38299e63f000934ebbfe Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Thu, 16 Apr 2026 02:37:32 -0400 Subject: [PATCH] fix(helm): default discord.enabled to true when botToken is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 0.7.7-beta.1 chart added a discord.enabled guard but existing deployments upgrading from 0.7.6 don't have this field set, causing the [discord] section and discord-bot-token secret to be omitted entirely — resulting in CrashLoopBackOff. Change the guard from requiring enabled to be truthy to only skipping when enabled is explicitly "false", preserving backwards compatibility. Fixes #383 --- charts/openab/templates/NOTES.txt | 9 +++++---- charts/openab/templates/configmap.yaml | 2 +- charts/openab/templates/deployment.yaml | 2 +- charts/openab/templates/secret.yaml | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/charts/openab/templates/NOTES.txt b/charts/openab/templates/NOTES.txt index f03ee067..81f98a7c 100644 --- a/charts/openab/templates/NOTES.txt +++ b/charts/openab/templates/NOTES.txt @@ -6,13 +6,14 @@ Agents deployed: {{- range $name, $cfg := .Values.agents }} {{- if ne (include "openab.agentEnabled" $cfg) "false" }} • {{ $name }} ({{ $cfg.command }}) -{{- if not (or (and ($cfg.discord).enabled ($cfg.discord).botToken) (and ($cfg.slack).enabled ($cfg.slack).botToken)) }} - ⚠️ No bot token provided. Create the secret manually: +{{- if not (or (and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken) (and ($cfg.slack).enabled ($cfg.slack).botToken)) }} + ⚠️ No bot token provided. Set one via Helm values or create the secret manually: kubectl create secret generic {{ include "openab.agentFullname" (dict "ctx" $ "agent" $name) }} \ - --from-literal=discord-bot-token="YOUR_DISCORD_TOKEN" + --from-literal=discord-bot-token="YOUR_TOKEN" # for Discord + # --from-literal=slack-bot-token="YOUR_TOKEN" # for Slack {{- end }} -{{- if and ($cfg.discord).enabled ($cfg.discord).botToken }} +{{- if and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }} Discord: ✅ configured {{- end }} {{- if and ($cfg.slack).enabled ($cfg.slack).botToken }} diff --git a/charts/openab/templates/configmap.yaml b/charts/openab/templates/configmap.yaml index d90c3c5c..fe230ab4 100644 --- a/charts/openab/templates/configmap.yaml +++ b/charts/openab/templates/configmap.yaml @@ -10,7 +10,7 @@ metadata: {{- include "openab.labels" $d | nindent 4 }} data: config.toml: | - {{- if and ($cfg.discord).enabled ($cfg.discord).botToken }} + {{- if and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }} [discord] bot_token = "${DISCORD_BOT_TOKEN}" {{- range $cfg.discord.allowedChannels }} diff --git a/charts/openab/templates/deployment.yaml b/charts/openab/templates/deployment.yaml index 2f895b26..2352ba57 100644 --- a/charts/openab/templates/deployment.yaml +++ b/charts/openab/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} env: - {{- if and ($cfg.discord).enabled ($cfg.discord).botToken }} + {{- if and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }} - name: DISCORD_BOT_TOKEN valueFrom: secretKeyRef: diff --git a/charts/openab/templates/secret.yaml b/charts/openab/templates/secret.yaml index d6907fd4..7af14ae8 100644 --- a/charts/openab/templates/secret.yaml +++ b/charts/openab/templates/secret.yaml @@ -1,6 +1,6 @@ {{- range $name, $cfg := .Values.agents }} {{- if ne (include "openab.agentEnabled" $cfg) "false" }} -{{- $hasDiscord := and ($cfg.discord).enabled ($cfg.discord).botToken }} +{{- $hasDiscord := and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }} {{- $hasSlack := and ($cfg.slack).enabled (or ($cfg.slack).botToken ($cfg.slack).appToken) }} {{- $hasStt := and ($cfg.stt).enabled ($cfg.stt).apiKey }} {{- if or $hasDiscord $hasSlack $hasStt }}