Skip to content

Add flag to control default namespace creation#66

Merged
HiranAdikari merged 2 commits intowso2:mainfrom
HiranAdikari:fix/control-default-namespace-creation
Apr 21, 2026
Merged

Add flag to control default namespace creation#66
HiranAdikari merged 2 commits intowso2:mainfrom
HiranAdikari:fix/control-default-namespace-creation

Conversation

@HiranAdikari
Copy link
Copy Markdown
Contributor

Summary

  • Updates all existing tenant-space module calls to set
    create_default_namespace = false
  • Prevents unexpected namespace creation for brownfield tenants that were
    imported without a project-name namespace
  • One project (WSO2 Cloud) has a name that is not a valid Kubernetes
    namespace identifier — auto-creation would have caused terraform apply
    to fail without this opt-out

New tenants added going forward can omit the flag (defaults to true) and
will automatically get a default namespace matching the project name.

Depends on wso2/open-cloud-datacenter# which introduces the
create_default_namespace variable.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@HiranAdikari has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 25 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 25 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a4416c8-c733-4888-9cd4-6337709dc698

📥 Commits

Reviewing files that changed from the base of the PR and between 731b6c9 and 014834b.

📒 Files selected for processing (1)
  • modules/management/tenant-space/main.tf

Walkthrough

Added a new boolean configuration variable create_default_namespace (defaults to true) that controls whether the default namespace named after project_name is automatically prepended to the namespaces list. Updated namespace computation logic to conditionally include the default namespace based on this variable value.

Changes

Cohort / File(s) Summary
Namespace Configuration
modules/management/tenant-space/variables.tf
Added new boolean input variable create_default_namespace with default value true to control inclusion of the default project-name namespace.
Namespace Computation Logic
modules/management/tenant-space/main.tf
Modified local.namespaces calculation to conditionally prepend and deduplicate the default namespace only when create_default_namespace is enabled; when disabled, uses var.namespaces as-is.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete; it lacks multiple required sections from the template including Purpose/Goals, Approach, User stories, Release notes, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Related PRs, Migrations, Test environment, and Learning. Complete the PR description by filling in all required template sections, particularly Purpose/Goals, Approach, test coverage details, security verification, and any related documentation or migration steps.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—adding a flag to control default namespace creation—which aligns with the core modification across the codebase.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@modules/management/tenant-space/main.tf`:
- Line 5: The current expression for namespaces always falls back to
[var.project_name] when var.namespaces is null, ignoring
var.create_default_namespace; update the ternary so that when var.namespaces ==
null it returns [var.project_name] only if var.create_default_namespace is true,
otherwise return an empty list ([]). Specifically adjust the fallback branch of
the namespaces assignment to honor var.create_default_namespace instead of
unconditionally using var.project_name (refer to the namespaces expression,
var.namespaces, var.create_default_namespace, and var.project_name).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 080b7fe4-62f1-4293-b6f7-44dcc16663f3

📥 Commits

Reviewing files that changed from the base of the PR and between 72cb731 and 731b6c9.

📒 Files selected for processing (2)
  • modules/management/tenant-space/main.tf
  • modules/management/tenant-space/variables.tf

Comment thread modules/management/tenant-space/main.tf Outdated
@HiranAdikari HiranAdikari merged commit 71d351d into wso2:main Apr 21, 2026
3 of 4 checks passed
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.

2 participants