Skip to content

Add --features flag for setting ACS feature flags#77

Merged
AlexVulaj merged 5 commits into
mainfrom
feature-flags
Mar 30, 2026
Merged

Add --features flag for setting ACS feature flags#77
AlexVulaj merged 5 commits into
mainfrom
feature-flags

Conversation

@AlexVulaj
Copy link
Copy Markdown
Contributor

@AlexVulaj AlexVulaj commented Mar 27, 2026

Summary

Adds a --features flag to roxie deploy that provides a convenient syntax for enabling/disabling ACS feature flags without needing to create override files.

Closes #34

Note - The --features flag currently only works with operator-based deployments (the default). It does not apply feature flags when using --helm mode. Since --helm is a hidden/experimental flag with different values structure, Helm support is deferred to a future PR if needed.

Usage

# Enable/disable feature flags
roxie deploy --features +ROX_LABEL_BASED_POLICY_SCOPING

# Multiple flags with different syntaxes
roxie deploy --features +ROX_FLAG1,-ROX_FLAG2,ROX_FLAG3=true

Feature flags apply to both Central and SecuredCluster components.

How it works

Feature flags provided with --features have the highest precedence and override values from --override files and --set expressions.

Feature flags merge with existing .spec.customize.envVars by name, not by replacing the entire array. This means:

  • --features +ROX_FOO will override ROX_FOO if it exists in an override file
  • Other env vars from override files are preserved

Testing

Manually tested the following cases:

  • Basic feature flag applies to both central and sensor
  • Feature flags override values from --override files
  • Smart merge preserves other env vars from override files
  • Multiple flags with different syntaxes (+, -, =true/false)

@AlexVulaj AlexVulaj force-pushed the feature-flags branch 2 times, most recently from 28f3bdb to 55eb5fe Compare March 27, 2026 20:13
Copy link
Copy Markdown
Collaborator

@mclasmeier mclasmeier left a comment

Choose a reason for hiding this comment

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

Very cool, thank you for picking this up.
I believe we can simplify in a few places, but no fundamental concerns.

Comment thread internal/deployer/feature_flags.go Outdated
Comment thread internal/deployer/feature_flags.go
Comment thread internal/deployer/feature_flags.go Outdated
Comment thread internal/deployer/feature_flags.go
- Use slices.Concat to unify loop in mergeEnvVars
- Sort envVars output alphabetically for deterministic results
- Add test case for alphabetical ordering
- Improve comment on mergeWithEnvVarSupport
- Refactor mergeWithEnvVarSupport to use k8s.io/apimachinery/unstructured
Copy link
Copy Markdown
Collaborator

@mclasmeier mclasmeier left a comment

Choose a reason for hiding this comment

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

I was thinking, maybe also check if --feature-flags has been used together with --helm and if that is the case just error out, telling the user that this is not supported?

Comment thread internal/deployer/deployer.go Outdated
Comment thread pr-reviews/77.md Outdated
@AlexVulaj
Copy link
Copy Markdown
Contributor Author

@mclasmeier I also added in a check to see if someone is trying to use --helm with --features and log an error. Great suggestions so far!

@AlexVulaj AlexVulaj merged commit 168e2da into main Mar 30, 2026
3 checks passed
@AlexVulaj AlexVulaj deleted the feature-flags branch March 30, 2026 18:21
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