Skip to content

Commit 4cbac0f

Browse files
authored
Remove the operator.collector.targetallocatorcr feature flag (#4449)
1 parent 9e8242a commit 4cbac0f

File tree

5 files changed

+19
-45
lines changed

5 files changed

+19
-45
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: target allocator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Remove the operator.collector.targetallocatorcr feature flag
9+
10+
# One or more tracking issues related to the change
11+
issues: [2422]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: This behavior has been enabled by default since version 0.127.0.
17+

internal/controllers/common.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
2525
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/opampbridge"
2626
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator"
27-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
2827
)
2928

3029
func isNamespaceScoped(obj client.Object) bool {
@@ -49,27 +48,6 @@ func BuildCollector(params manifests.Params) ([]client.Object, error) {
4948
}
5049
resources = append(resources, objs...)
5150
}
52-
// If we're not building a TargetAllocator CRD, then we need to separately invoke its builder
53-
// to directly build the manifests. This is what used to happen before the TargetAllocator CRD
54-
// was introduced.
55-
if !featuregate.CollectorUsesTargetAllocatorCR.IsEnabled() {
56-
if params.TargetAllocator != nil {
57-
taParams := targetallocator.Params{
58-
Client: params.Client,
59-
Scheme: params.Scheme,
60-
Recorder: params.Recorder,
61-
Log: params.Log,
62-
Config: params.Config,
63-
Collector: &params.OtelCol,
64-
TargetAllocator: *params.TargetAllocator,
65-
}
66-
taResources, err := BuildTargetAllocator(taParams)
67-
if err != nil {
68-
return nil, err
69-
}
70-
resources = append(resources, taResources...)
71-
}
72-
}
7351
return resources, nil
7452
}
7553

internal/controllers/opentelemetrycollector_controller.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/open-telemetry/opentelemetry-operator/internal/version"
4444
"github.com/open-telemetry/opentelemetry-operator/pkg/collector/upgrade"
4545
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
46-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
4746
)
4847

4948
const resourceOwnerKey = ".metadata.owner"
@@ -97,10 +96,6 @@ func (r *OpenTelemetryCollectorReconciler) findOtelOwnedObjects(ctx context.Cont
9796
switch objectType.(type) {
9897
case *corev1.ConfigMap:
9998
for _, object := range objs {
100-
if !featuregate.CollectorUsesTargetAllocatorCR.IsEnabled() && object.GetLabels()["app.kubernetes.io/component"] != "opentelemetry-collector" {
101-
// we only apply this to collector ConfigMaps
102-
continue
103-
}
10499
configMap := object.(*corev1.ConfigMap)
105100
collectorConfigMaps = append(collectorConfigMaps, configMap)
106101
}
@@ -367,6 +362,7 @@ func (r *OpenTelemetryCollectorReconciler) GetOwnedResourceTypes() []client.Obje
367362
&networkingv1.NetworkPolicy{},
368363
&autoscalingv2.HorizontalPodAutoscaler{},
369364
&policyV1.PodDisruptionBudget{},
365+
&v1alpha1.TargetAllocator{},
370366
}
371367

372368
if r.config.CreateRBACPermissions == rbac.Available {
@@ -383,10 +379,6 @@ func (r *OpenTelemetryCollectorReconciler) GetOwnedResourceTypes() []client.Obje
383379
ownedResources = append(ownedResources, &routev1.Route{})
384380
}
385381

386-
if featuregate.CollectorUsesTargetAllocatorCR.IsEnabled() {
387-
ownedResources = append(ownedResources, &v1alpha1.TargetAllocator{})
388-
}
389-
390382
return ownedResources
391383
}
392384

internal/manifests/collector/collector.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
1313
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/rbac"
1414
"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
15-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
1615
)
1716

1817
const (
@@ -45,12 +44,9 @@ func Build(params manifests.Params) ([]client.Object, error) {
4544
manifests.Factory(ExtensionService),
4645
manifests.Factory(Ingress),
4746
manifests.Factory(NetworkPolicy),
47+
manifests.Factory(TargetAllocator),
4848
}...)
4949

50-
if featuregate.CollectorUsesTargetAllocatorCR.IsEnabled() {
51-
manifestFactories = append(manifestFactories, manifests.Factory(TargetAllocator))
52-
}
53-
5450
if params.OtelCol.Spec.Observability.Metrics.EnableMetrics {
5551
if params.OtelCol.Spec.Mode == v1beta1.ModeSidecar {
5652
manifestFactories = append(manifestFactories, manifests.Factory(PodMonitor))

pkg/featuregate/featuregate.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ const (
1414
)
1515

1616
var (
17-
// CollectorUsesTargetAllocatorCR is the feature gate that enables the OpenTelemetryCollector reconciler to generate
18-
// TargetAllocator CRs instead of generating the manifests for its resources directly.
19-
CollectorUsesTargetAllocatorCR = featuregate.GlobalRegistry().MustRegister(
20-
"operator.collector.targetallocatorcr",
21-
featuregate.StageStable,
22-
featuregate.WithRegisterDescription("causes collector reconciliation to create a target allocator CR instead of creating resources directly"),
23-
featuregate.WithRegisterFromVersion("v0.112.0"),
24-
featuregate.WithRegisterToVersion("v0.138.0"),
25-
)
2617
// EnableNativeSidecarContainers is the feature gate that controls whether a
2718
// sidecar should be injected as a native sidecar or the classic way.
2819
// Native sidecar containers have been available since kubernetes v1.28 in

0 commit comments

Comments
 (0)