Skip to content

CSPL-4630: add feature gate infrastructure using k8s FeatureGate pattern#1848

Merged
kubabuczak merged 5 commits intodevelopfrom
CSPL-4630-feature-gate-infrastructure
Apr 17, 2026
Merged

CSPL-4630: add feature gate infrastructure using k8s FeatureGate pattern#1848
kubabuczak merged 5 commits intodevelopfrom
CSPL-4630-feature-gate-infrastructure

Conversation

@kubabuczak
Copy link
Copy Markdown
Collaborator

Description

Add a feature gate registry using k8s.io/component-base/featuregate so new controllers can be gated behind --feature-gates=<Gate>=true|false with Alpha/Beta/GA lifecycle. Migrate the validation webhook toggle from the ENABLE_VALIDATION_WEBHOOK env var to a ValidationWebhook feature gate with backwards-compatible env var support.

Key Changes

  • Feature gate registry in pkg/config/ with ValidationWebhook gate (Alpha, off by default) and legacy env var bridge
  • Migrate cmd/main.go from flag to pflag and wire --feature-gates CLI flag
  • Update webhook kustomize overlays to use container args instead of env var
  • Add docs/FeatureGates.md with 4-step checklist for adding new gates
  • Update docs/ValidationWebhook.md to reflect feature gate enablement

Testing and Verification

  • Unit tests cover gate registration, default-off behavior, and all three legacy env var paths (set to "true", unset, set to "false")
  • Existing flags behave identically after the flagpflag migration (1:1 rename)

Related Issues

PR Checklist

  • Code changes adhere to the project's coding standards
  • Relevant unit and integration tests are included
  • Documentation has been updated accordingly
  • If test framework files were changed (test/testenv/, test/run-tests.sh, test/env.sh), docs/IntegrationTesting.md has been updated
  • All tests pass locally
  • The PR description follows the project's guidelines

Introduce a feature gate registry backed by k8s.io/component-base/featuregate
so new capabilities can be gated behind --feature-gates=<Gate>=true|false with
Alpha/Beta/GA lifecycle. Migrate the validation webhook toggle from the
ENABLE_VALIDATION_WEBHOOK env var to a ValidationWebhook feature gate with
backwards-compatible env var support.
Remove non-existent Helm values snippet from FeatureGates.md, add
CLI-over-env-var precedence note to ValidationWebhook.md, and log
effective gate states instead of just known feature names.
Use os.LookupEnv instead of checking for exact "true" so the
deprecation warning fires whenever the env var is set.
Comment thread docs/FeatureGates.md Outdated
@vivekr-splunk vivekr-splunk self-requested a review April 17, 2026 00:18
Copy link
Copy Markdown
Collaborator

@vivekr-splunk vivekr-splunk left a comment

Choose a reason for hiding this comment

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

A few follow-up doc issues after the feature-gate refactor.

Comment thread docs/ValidationWebhook.md Outdated
Comment thread docs/ValidationWebhook.md Outdated
…nce deployment instructions in ValidationWebhook.md
@kubabuczak kubabuczak merged commit 1450ec4 into develop Apr 17, 2026
51 checks passed
@kubabuczak kubabuczak deleted the CSPL-4630-feature-gate-infrastructure branch April 17, 2026 14:51
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants