Independent feature gates for service config, log sinks, and auth providers - #984
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Independent feature gates for service config, log sinks, and auth providers
Problem
Log sinks and auth providers route registration was nested inside the
if serviceConfigEnabledblock, making--service-config-enabledamaster gate. An operator who wanted log sinks or auth providers
accessible without exposing the service-config management UI had no
way to do it — enabling service config was a prerequisite for the other
two.
Solution
Decouple all three features into fully independent gates. Each has its
own flag, env var, handler field, and route registration block. No
feature requires another to be enabled.
Changes
Config (
pkg/config/types.go,pkg/config/flags.go)Two new
*boolfields onYAMLConfigurationService:LogSinksEnabled--log-sinks-enabledLOG_SINKS_ENABLEDtrueAuthProvidersEnabled--auth-providers-enabledAUTH_PROVIDERS_ENABLEDtrueServiceConfigEnabledremains a plainbool(defaultfalse,unchanged). The new fields are
*boolso nil means "default to true"— existing deployments that only set
SERVICE_CONFIG_ENABLED=truegetall three enabled without any config changes.
Flag help text updated to say "Independent of --service-config-enabled"
instead of "Only takes effect when --service-config-enabled is also true".
Handlers (
cmd/api/handlers/handlers.go,features.go)HandlersApigainedLogSinksEnabled boolandAuthProvidersEnabled boolfields.WithLogSinksEnabled(bool)andWithAuthProvidersEnabled(bool)options.
FeaturesResponsenow reports each flag independently:LogSinks: h.LogSinksEnabled,AuthProviders: h.AuthProvidersEnabled— no
&& h.ServiceConfigEnabledcondition.Route registration (
cmd/api/main.go)restartLimiter/restartRateLimitdefinition moved out of theservice-config
ifblock to the top level, so all three applyendpoints can share it regardless of which features are enabled.
ifblocks:if flagParams.Service.ServiceConfigEnabled { ... }— service-config routes only.if logSinksEnabled { ... }— log-sinks routes only.if authProvidersEnabled { ... }— auth-providers routes only.without conditioning on
ServiceConfigEnabled.Defaults and backwards compatibility
SERVICE_CONFIG_ENABLED=true(no other flags)SERVICE_CONFIG_ENABLED=false(no other flags)--service-config-enabled=false --log-sinks-enabled=false--service-config-enabled=false --auth-providers-enabled=falseThe key change: an operator can now run with
--service-config-enabled=falseand still manage log sinks and authproviders from the UI — the service-config section is simply hidden.
Validation
Files
Modified (5 files):
pkg/config/types.go—LogSinksEnabled *bool,AuthProvidersEnabled *boolfieldspkg/config/flags.go—--log-sinks-enabled,--auth-providers-enabledflagscmd/api/handlers/handlers.go—LogSinksEnabled,AuthProvidersEnabledfields + optionscmd/api/handlers/features.go— independent feature reportingcmd/api/handlers/features_test.go— updated test to set all three flagscmd/api/main.go— independentifblocks, movedrestartLimiterto top level