Skip to content

fix: make auto rbac create optional #585

Merged
kaixi-wang merged 2 commits into
release/v2.21.0from
kacey/optional-role-creation
Jun 30, 2026
Merged

fix: make auto rbac create optional #585
kaixi-wang merged 2 commits into
release/v2.21.0from
kacey/optional-role-creation

Conversation

@kaixi-wang

@kaixi-wang kaixi-wang commented Jun 22, 2026

Copy link
Copy Markdown
Member

Rationale

Allow configuring role/rolebinding to be handled independently for telemetry or at least allow metrics to still work
(CLASS ran into an issue: https://voxel51.slack.com/archives/C05BYM8P01M/p1782136883542679)

Review Priority

  • high
  • medium
  • low

Changes

Checklist

  • This PR maintains parity between Docker Compose and Helm

Testing

@kaixi-wang kaixi-wang self-assigned this Jun 22, 2026
@kaixi-wang kaixi-wang requested a review from a team as a code owner June 22, 2026 19:04
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a4e45b25-5dac-415d-b034-c8f36b12e0ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds support for a telemetry.rbac.create Helm boolean that controls whether the telemetry Role/RoleBinding is rendered. The README documents the new value, NOTES.txt emits a warning when it is disabled alongside active telemetry, and unit tests verify that the rolebinding templates are skipped and the sidecar is still injected under that configuration.

Changes

telemetry.rbac.create opt-out

Layer / File(s) Summary
NOTES warning and README documentation
helm/fiftyone-teams-app/README.md, helm/fiftyone-teams-app/templates/NOTES.txt
README adds telemetry.rbac.create to the Values table with RBAC rendering and 403/log-viewer impact notes. NOTES.txt adds a conditional warning block shown when telemetry.enabled=true and telemetry.rbac.create=false.
Unit tests for disabled RBAC with telemetry enabled
tests/unit/helm/telemetry-rolebinding_test.go, tests/unit/helm/telemetry-sidecar_test.go
TestRbacCreateDisabled asserts the rolebinding template render fails with "could not find template" when rbac.create=false. TestSidecarRenderedWithRbacCreateDisabled asserts the telemetry-sidecar container and shareProcessNamespace=true remain present. Comment on shareProcessNamespace is also expanded to cover metrics and log-capture paths.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • kevin-dimichel

🐇 A little flag called rbac.create,
Now skips the Role if set to false—how neat!
The sidecar hops on still, shareProcess and all,
A warning in NOTES if the perms should fall.
Tests confirm the path, both skip and render true—
🥕 Another safe hop through the Helm chart queue!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: making RBAC role creation optional via the new telemetry.rbac.create configuration option.
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.
Description check ✅ Passed The description matches the required template and provides a clear rationale and priority section, with only the Changes and Testing sections lightly filled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kacey/optional-role-creation

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

@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: 2

🧹 Nitpick comments (1)
tests/unit/helm/telemetry-sidecar_test.go (1)

144-146: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Make telemetry enablement explicit in this test setup.

To isolate the rbac.create behavior and avoid future default-value drift, set telemetry.enabled=true in this test’s SetValues.

Suggested update
 options := &helm.Options{SetValues: map[string]string{
+	"telemetry.enabled":     "true",
 	"telemetry.rbac.create": "false",
 }}
🤖 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 `@tests/unit/helm/telemetry-sidecar_test.go` around lines 144 - 146, In the
helm.Options SetValues map, add an explicit entry for "telemetry.enabled":
"true" alongside the existing "telemetry.rbac.create": "false" entry. This makes
the telemetry enablement explicit in the test setup and prevents issues from
future default-value changes, ensuring the test isolates the rbac.create
behavior specifically.
🤖 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 `@helm/fiftyone-teams-app/README.md`:
- Line 1089: In the README.md documentation for the telemetry.rbac.create
configuration value, replace the reference to serviceAccounts with the full Helm
key path telemetry.serviceAccounts. This ensures users refer to the correct
configuration path when following the documentation and prevents them from
attempting to set the configuration at the wrong level in their values file.

In `@tests/unit/helm/telemetry-rolebinding_test.go`:
- Around line 75-76: The current test assertion using s.ErrorContains with a
single generic error message does not independently verify that both the Role
and RoleBinding templates are skipped when telemetry.rbac.create=false. Instead
of making a single RenderTemplateE call and checking for a generic error, you
should render each template separately (Role and RoleBinding) within the test
and verify that each one individually returns an error containing "could not
find template". This ensures both templates are actually being gated by the
telemetry.rbac.create setting rather than just one of them being absent.

---

Nitpick comments:
In `@tests/unit/helm/telemetry-sidecar_test.go`:
- Around line 144-146: In the helm.Options SetValues map, add an explicit entry
for "telemetry.enabled": "true" alongside the existing "telemetry.rbac.create":
"false" entry. This makes the telemetry enablement explicit in the test setup
and prevents issues from future default-value changes, ensuring the test
isolates the rbac.create behavior specifically.
🪄 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: f20f534a-4220-4ec2-acd2-5236c08111bd

📥 Commits

Reviewing files that changed from the base of the PR and between 8c4b06d and fdb7cd4.

⛔ Files ignored due to path filters (4)
  • helm/fiftyone-teams-app/templates/telemetry-role.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-rolebinding.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/values.schema.json is excluded by !**/*.json
  • helm/fiftyone-teams-app/values.yaml is excluded by !**/*.yaml
📒 Files selected for processing (4)
  • helm/fiftyone-teams-app/README.md
  • helm/fiftyone-teams-app/templates/NOTES.txt
  • tests/unit/helm/telemetry-rolebinding_test.go
  • tests/unit/helm/telemetry-sidecar_test.go

Comment thread helm/fiftyone-teams-app/README.md
Comment on lines +75 to +76
_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.releaseName, s.templates)
s.ErrorContains(err, "could not find template")

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Tighten this assertion to verify each template is skipped independently.

The current check can pass if only one of the Role/RoleBinding templates is absent; it doesn’t prove both are gated by telemetry.rbac.create=false.

Suggested test hardening
 func (s *telemetryRoleBindingTemplateTest) TestRbacCreateDisabled() {
 	options := &helm.Options{SetValues: map[string]string{
 		"telemetry.enabled":     "true",
 		"telemetry.rbac.create": "false",
 	}}
 
-	_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.releaseName, s.templates)
-	s.ErrorContains(err, "could not find template")
+	for _, tmpl := range s.templates {
+		_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.releaseName, []string{tmpl})
+		s.ErrorContains(err, "could not find template", "%s should be skipped", tmpl)
+	}
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.releaseName, s.templates)
s.ErrorContains(err, "could not find template")
for _, tmpl := range s.templates {
_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.releaseName, []string{tmpl})
s.ErrorContains(err, "could not find template", "%s should be skipped", tmpl)
}
🤖 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 `@tests/unit/helm/telemetry-rolebinding_test.go` around lines 75 - 76, The
current test assertion using s.ErrorContains with a single generic error message
does not independently verify that both the Role and RoleBinding templates are
skipped when telemetry.rbac.create=false. Instead of making a single
RenderTemplateE call and checking for a generic error, you should render each
template separately (Role and RoleBinding) within the test and verify that each
one individually returns an error containing "could not find template". This
ensures both templates are actually being gated by the telemetry.rbac.create
setting rather than just one of them being absent.

@kaixi-wang kaixi-wang changed the base branch from main to release/v2.21.0 June 30, 2026 20:25
@kaixi-wang kaixi-wang force-pushed the kacey/optional-role-creation branch from 7beaf00 to 8233a66 Compare June 30, 2026 20:28
@kaixi-wang kaixi-wang merged commit cdc0e75 into release/v2.21.0 Jun 30, 2026
10 checks passed
@kaixi-wang kaixi-wang deleted the kacey/optional-role-creation branch June 30, 2026 21:17
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