CSPL-4630: add feature gate infrastructure using k8s FeatureGate pattern#1848
CSPL-4630: add feature gate infrastructure using k8s FeatureGate pattern#1848kubabuczak wants to merge 4 commits intodevelopfrom
Conversation
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.
|
|
||
| ## Adding a New Feature Gate | ||
|
|
||
| Follow these four steps: |
There was a problem hiding this comment.
It looks like there are only steps 1-2 and then some examples or optional steps for new controllers. Can we update this to reflect that?
There was a problem hiding this comment.
Good catch. Fixed!
vivekr-splunk
left a comment
There was a problem hiding this comment.
A few follow-up doc issues after the feature-gate refactor.
|
|
||
| ```bash | ||
| # Build and apply the webhook-enabled configuration | ||
| kustomize build config/default-with-webhook | kubectl apply -f - |
There was a problem hiding this comment.
This example still renders placeholder values like WATCH_NAMESPACE_VALUE, SPLUNK_ENTERPRISE_IMAGE, and SPLUNK_GENERAL_TERMS_VALUE directly into the manifest. Unlike the config/default flow, there is not a make target here doing the sed substitutions first, so kustomize build config/default-with-webhook is not actually ready to apply as-is. Can we either document the required replacements here or switch the example to a supported path that produces a fully rendered manifest?
| ```bash | ||
| kubectl logs -n splunk-operator deployment/splunk-operator-controller-manager | grep -i webhook | ||
| # Look for: "Validation webhook enabled via ENABLE_VALIDATION_WEBHOOK=true" | ||
| # Look for: "Validation webhook enabled via feature gate" |
There was a problem hiding this comment.
The troubleshooting text here says to grep for "Validation webhook enabled via feature gate", but cmd/main.go now logs "Validation webhook enabled". Can we update one side or the other so users are not searching for a string that never appears?
Description
Add a feature gate registry using
k8s.io/component-base/featuregateso new controllers can be gated behind--feature-gates=<Gate>=true|falsewith Alpha/Beta/GA lifecycle. Migrate the validation webhook toggle from theENABLE_VALIDATION_WEBHOOKenv var to aValidationWebhookfeature gate with backwards-compatible env var support.Key Changes
pkg/config/withValidationWebhookgate (Alpha, off by default) and legacy env var bridgecmd/main.gofromflagtopflagand wire--feature-gatesCLI flagdocs/FeatureGates.mdwith 4-step checklist for adding new gatesdocs/ValidationWebhook.mdto reflect feature gate enablementTesting and Verification
flag→pflagmigration (1:1 rename)Related Issues
PR Checklist
test/testenv/,test/run-tests.sh,test/env.sh),docs/IntegrationTesting.mdhas been updated