Skip to content

[INFRA-465] chore: add IS_SELF_MANAGED and AI usage env vars to plane-enterprise - #272

Closed
akshat5302 wants to merge 3 commits into
masterfrom
feat/add-ai-envs
Closed

[INFRA-465] chore: add IS_SELF_MANAGED and AI usage env vars to plane-enterprise#272
akshat5302 wants to merge 3 commits into
masterfrom
feat/add-ai-envs

Conversation

@akshat5302

@akshat5302 akshat5302 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

Add new environment variables to the plane-enterprise Helm chart to align with the commercial deployment configs:

  • IS_SELF_MANAGED — hardcoded to "0" in both app-vars (api) and pi-api-vars (pi-*) ConfigMaps. Cloud deployment is always 0; no values.yaml or questions.yml entry needed.
  • AI_USAGE_AGENT_MAX_TOKENS_BUDGET — added to app-vars (api) and pi-api-vars (pi-*); configurable via env.pi_envs.ai_usage_agent_max_tokens_budget, default: empty.
  • AI_USAGE_ENFORCEMENT_ENABLED — added to pi-api-vars (pi-* only); configurable via env.pi_envs.ai_usage_enforcement_enabled, default: true (renders as "1").
  • Bump chart version 3.0.03.0.1.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

  • Deploy chart and verify IS_SELF_MANAGED=0 is present in the api pod environment (kubectl exec <api-pod> -- env | grep IS_SELF_MANAGED)
  • Verify AI_USAGE_AGENT_MAX_TOKENS_BUDGET is present in both api and pi-api pod environments
  • Verify AI_USAGE_ENFORCEMENT_ENABLED=1 is present in pi-api pod but not in api pod
  • Set env.pi_envs.ai_usage_enforcement_enabled: false in values and confirm the env renders as "0"
  • Run helm lint — should pass with 0 failures

References

  • INFRA-465
  • Related: INFRA-464 (same vars added to Docker/AIO/Portainer/Coolify deployment configs)

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added configuration options for AI usage enforcement and maximum agent token budgets.
    • AI usage enforcement is enabled by default and can be adjusted during deployment.
    • Added support for applying these settings across application and AI services.
    • Added self-managed deployment identification to service configuration.
  • Chores

    • Updated the enterprise Helm chart release version to 3.0.1.

- IS_SELF_MANAGED hardcoded to "0" in app-vars and pi-api-vars ConfigMaps
- AI_USAGE_AGENT_MAX_TOKENS_BUDGET added to api and pi containers (default: empty)
- AI_USAGE_ENFORCEMENT_ENABLED added to pi containers only (default: 1)
- Bump chart version 3.0.0 → 3.0.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@akshat5302, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 52d1d35b-67b4-4d56-b3ae-a0219b2e3eab

📥 Commits

Reviewing files that changed from the base of the PR and between da96e4f and 2217593.

📒 Files selected for processing (2)
  • charts/plane-enterprise/templates/config-secrets/app-env.yaml
  • charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml

Walkthrough

The Plane Enterprise Helm chart is bumped to version 3.0.1 and gains configurable AI usage settings. These values are exposed through chart questions and defaults, then rendered into application and PI API ConfigMaps.

Changes

AI usage configuration

Layer / File(s) Summary
Configuration defaults and chart metadata
charts/plane-enterprise/Chart.yaml, charts/plane-enterprise/questions.yml, charts/plane-enterprise/values.yaml
The chart version is updated to 3.0.1, and PI configuration adds token budget and AI usage enforcement settings.
Environment variable rendering
charts/plane-enterprise/templates/config-secrets/app-env.yaml, charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml
ConfigMaps render the new AI usage values and IS_SELF_MANAGED settings, converting enforcement to "1" or "0".

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: sriramveeraghanta, pratapalakshmi, mguptahub

Poem

I’m a bunny with tokens to spare,
Toggling AI usage with care.
The chart hops ahead,
New values are spread,
And ConfigMaps bloom everywhere! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change by adding IS_SELF_MANAGED and AI usage environment variables to plane-enterprise.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-ai-envs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@makeplane

makeplane Bot commented Jul 30, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml`:
- Line 162: Update the AI_USAGE_ENFORCEMENT_ENABLED template expression to
distinguish an explicitly configured false value from an unset value. Use hasKey
to select the configured env.pi_envs.ai_usage_enforcement_enabled value, and
apply the chart default only when that key is absent, while preserving the
existing ternary conversion and quoting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 38bc90cc-90e5-4cb0-be3c-e4c4639369de

📥 Commits

Reviewing files that changed from the base of the PR and between bfd3047 and da96e4f.

📒 Files selected for processing (5)
  • charts/plane-enterprise/Chart.yaml
  • charts/plane-enterprise/questions.yml
  • charts/plane-enterprise/templates/config-secrets/app-env.yaml
  • charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml
  • charts/plane-enterprise/values.yaml


IS_SELF_MANAGED: "0"
AI_USAGE_AGENT_MAX_TOKENS_BUDGET: {{ .Values.env.pi_envs.ai_usage_agent_max_tokens_budget | default "" | quote }}
AI_USAGE_ENFORCEMENT_ENABLED: {{ .Values.env.pi_envs.ai_usage_enforcement_enabled | default true | ternary "1" "0" | quote }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

helm template test charts/plane-enterprise \
  --set services.pi.enabled=true \
  --set env.pi_envs.ai_usage_enforcement_enabled=false |
  rg 'AI_USAGE_ENFORCEMENT_ENABLED'
# Expected: AI_USAGE_ENFORCEMENT_ENABLED: "0"

Repository: makeplane/helm-charts

Length of output: 197


🏁 Script executed:

#!/bin/bash
set -eu

printf 'Files matching config-secrets/pi-api-env.yaml:\n'
fd -a 'pi-api-env.yaml' . || true

printf '\nRelevant lines in file:\n'
if [ -f charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml ]; then
  nl -ba charts/plane-enterprise/templates/config-secrets/pi-api-api-env.yaml 2>/dev/null || true
  nl -ba charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml | sed -n '150,170p'
fi

printf '\nSearch for ai_usage_enforcement_enabled in repo:\n'
rg -n "ai_usage_enforcement_enabled|AI_USAGE_ENFORCEMENT_ENABLED" .

Repository: makeplane/helm-charts

Length of output: 781


🌐 Web query:

Helm func default treats false as nil documentation

💡 Result:

The Helm default function, which is provided by the Sprig library, treats the boolean value false as "empty" [1][2]. Consequently, if you use default with a boolean value, it will replace an explicit false with the provided default value [3][4]. According to the official documentation, the definition of "empty" for the default function depends on the data type [1][5]: - Numeric: 0 - String: "" - Lists: [] - Dicts: {} - Boolean: false - Nil (null) Because false is classified as empty, {{ default true .Values.enabled }} will return true even if .Values.enabled is explicitly set to false [3][4]. To work around this behavior when you need to distinguish between a missing value and an explicit false, you can use one of the following approaches [6][4]: 1. Use the hasKey function to check if the value was explicitly provided in the values file [6][4]: {{- if hasKey.Values "enabled" }} enabled: {{.Values.enabled }} {{- else }} enabled: true {{- end }} 2. Use the kindIs function to check the type of the value [6]: {{- if kindIs "bool".Values.enabled }} enabled: {{.Values.enabled }} {{- else }} enabled: true {{- end }} 3. Use the ternary function in combination with hasKey [4]: enabled: {{ hasKey.Values "enabled" | ternary.Values.enabled true }}

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

echo "Relevant rendering line:"
awk 'NR>=150 && NR<=170 { printf "%6d%s\n", NR, $0 }' charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml

echo
echo "Values default:"
awk 'NR>=676 && NR<=684 { printf "%6d%s\n", NR, $0 }' charts/plane-enterprise/values.yaml

Repository: makeplane/helm-charts

Length of output: 2229


🌐 Web query:

Helm sprig default false bool is empty ternary default true ternary

💡 Result:

The ternary function in Helm (provided by the Sprig library) is used to select between two values based on a boolean condition [1][2]. Its syntax is ternary "value_if_true" "value_if_false" condition [3][4]. Regarding your specific scenario where you want to default a boolean to true but correctly handle an explicit false value, the default function is often unsuitable because it treats false as "empty" (falsy) and will incorrectly replace it with your default value [5][6][7]. To handle this, you can use a combination of hasKey and ternary to check if the value was explicitly set [8][7]. Recommended pattern: {{ hasKey.Values "yourKey" | ternary.Values.yourKey true }} In this example: 1. hasKey .Values "yourKey" checks if the key exists in your values (even if it is false) [8][7]. 2. If it exists, ternary returns the actual value (.Values.yourKey, which may be true or false) [7]. 3. If it does not exist, ternary returns the second argument, which is your desired default (true) [7]. This approach avoids the "falsy" trap of the default function, which interprets false as a missing value [6][7].

Citations:


Preserve -f for this boolean flag.

default treats false as empty, so --set env.pi_envs.ai_usage_enforcement_enabled=false renders AI_USAGE_ENFORCEMENT_ENABLED: "1". Use a hasKey + ternary fallback so chart defaults apply only when the value is unset.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml` at line
162, Update the AI_USAGE_ENFORCEMENT_ENABLED template expression to distinguish
an explicitly configured false value from an unset value. Use hasKey to select
the configured env.pi_envs.ai_usage_enforcement_enabled value, and apply the
chart default only when that key is absent, while preserving the existing
ternary conversion and quoting.

@akshat5302

Copy link
Copy Markdown
Member Author

Superseded by #276 which combines this with #271.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants