Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark confmap.expandEnabled as stable #7323

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .chloggen/stableexpandEnabled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: confmap

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Mark `confmap.expandEnabled` as stable

# One or more tracking issues or pull requests related to the change
issues: [7323]
22 changes: 10 additions & 12 deletions confmap/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ var (
errTooManyRecursiveExpansions = errors.New("too many recursive expansions")
)

// TODO: Remove this if by v0.64.0 no complains from distros.
var expandEnabledGauge = featuregate.GlobalRegistry().MustRegister(
var _ = featuregate.GlobalRegistry().MustRegister(
"confmap.expandEnabled",
featuregate.StageBeta,
featuregate.StageStable,
featuregate.WithRegisterRemovalVersion("v0.75.0"),
featuregate.WithRegisterDescription("controls whether expanding embedded external config providers URIs"))

// Resolver resolves a configuration as a Conf.
Expand Down Expand Up @@ -165,17 +165,15 @@ func (mr *Resolver) Resolve(ctx context.Context) (*Conf, error) {
}
}

if expandEnabledGauge.IsEnabled() {
cfgMap := make(map[string]any)
for _, k := range retMap.AllKeys() {
val, err := mr.expandValueRecursively(ctx, retMap.Get(k))
if err != nil {
return nil, err
}
cfgMap[k] = val
cfgMap := make(map[string]any)
for _, k := range retMap.AllKeys() {
val, err := mr.expandValueRecursively(ctx, retMap.Get(k))
if err != nil {
return nil, err
}
retMap = NewFromStringMap(cfgMap)
cfgMap[k] = val
}
retMap = NewFromStringMap(cfgMap)

// Apply the converters in the given order.
for _, confConv := range mr.converters {
Expand Down