Skip to content

fix(operator): Resolve boolean CR fields as env values - #320

Open
casey-coreweave wants to merge 1 commit into
mainfrom
cabernathy/cr_bool_passthrough
Open

fix(operator): Resolve boolean CR fields as env values#320
casey-coreweave wants to merge 1 commit into
mainfrom
cabernathy/cr_bool_passthrough

Conversation

@casey-coreweave

@casey-coreweave casey-coreweave commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This change casts boolean types correctly for passed through CR env fields. This allows the typing on the CR to correctly validate fields.

Boolean fields such as spec.wandb.bucketProxy are silently omitted, causing the API and filemeta workloads to miss their bucket-proxy configuration.
This change renders boolean values as lowercase true/false, while preserving existing string and secret-selector behavior and rejecting unsupported structured values.

Summary by CodeRabbit

  • New Features

    • Environment variables can now resolve both string and boolean values from custom resources.
    • Boolean values are formatted consistently as lowercase text when passed to workloads.
    • Bucket-proxy configuration values now propagate correctly to related API environment variables.
  • Bug Fixes

    • Structured or missing custom-resource fields are rejected instead of being treated as environment values.

@casey-coreweave
casey-coreweave requested a review from a team as a code owner August 7, 2026 18:21
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Custom-resource environment resolution now accepts string and boolean fields. Boolean values become lowercase environment-variable strings. Tests cover valid values, rejected fields, direct resolution, and manifest-based bucket-proxy propagation.

Changes

Custom-resource environment resolution

Layer / File(s) Summary
Environment value resolver
internal/controller/reconciler/reconcile_v2.go
resolveCRFieldEnvValue accepts string and boolean fields. It formats booleans as lowercase strings and rejects other value types.
Environment wiring and validation
internal/controller/reconciler/pods.go, internal/controller/reconciler/oidc_env_test.go
Pod environment resolution uses the updated helper. Tests cover literal values, rejected fields, boolean values, and manifest-based bucket-proxy variables.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: danielpanzella

🚥 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 and concisely describes the main change: resolving boolean custom-resource fields as environment values.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cabernathy/cr_bool_passthrough

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.

@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.

🧹 Nitpick comments (1)
internal/controller/reconciler/oidc_env_test.go (1)

62-95: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Use Ginkgo/Gomega for the new test cases.

Convert these Test... functions and subtests into the repository Ginkgo/Gomega suite. Keep coverage for both true and false values.

As per coding guidelines, “Use Ginkgo/Gomega for tests; test suites are configured through suite_test.go files and envtest.”

Also applies to: 138-165, 167-203

🤖 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 `@internal/controller/reconciler/oidc_env_test.go` around lines 62 - 95,
Convert TestResolveCRFieldEnvValue and the additionally referenced test
functions into the repository’s Ginkgo/Gomega suite, replacing testing.T
subtests, Fatalf, and Fatal calls with the suite’s Describe/It structure and
Gomega assertions. Preserve all existing coverage, including both true and false
bucketProxy values, and use the established suite setup from the relevant
suite_test.go/envtest configuration.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@internal/controller/reconciler/oidc_env_test.go`:
- Around line 62-95: Convert TestResolveCRFieldEnvValue and the additionally
referenced test functions into the repository’s Ginkgo/Gomega suite, replacing
testing.T subtests, Fatalf, and Fatal calls with the suite’s Describe/It
structure and Gomega assertions. Preserve all existing coverage, including both
true and false bucketProxy values, and use the established suite setup from the
relevant suite_test.go/envtest configuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bccfe637-a709-422d-a526-257f8b2907f7

📥 Commits

Reviewing files that changed from the base of the PR and between eb3abfe and 8b16b9d.

📒 Files selected for processing (3)
  • internal/controller/reconciler/oidc_env_test.go
  • internal/controller/reconciler/pods.go
  • internal/controller/reconciler/reconcile_v2.go

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.

1 participant