Skip to content

Commit 32606d9

Browse files
authored
Remove native sidecar featuregate (#4491)
Signed-off-by: Benedikt Bongartz <[email protected]>
1 parent cc80039 commit 32606d9

File tree

4 files changed

+23
-36
lines changed

4 files changed

+23
-36
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Remove native sidecar feature gate
9+
10+
# One or more tracking issues related to the change
11+
issues: [4451]
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: |
17+
The feature gate `operator.sidecarcontainers.native` has been removed.
18+
It was introduced in v0.111.0, enabled by default since v0.132.0, and marked as stable in v0.139.0.
19+
Native sidecars are now automatically enabled on Kubernetes v1.29+ without requiring a feature gate.
20+
If you were explicitly enabling or disabling this feature gate with `--feature-gates=+operator.sidecarcontainers.native`,
21+
you must remove that flag.

internal/autodetect/main.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/targetallocator"
2727
"github.com/open-telemetry/opentelemetry-operator/internal/config"
2828
"github.com/open-telemetry/opentelemetry-operator/internal/rbac"
29-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
3029
)
3130

3231
var _ AutoDetect = (*autoDetect)(nil)
@@ -266,14 +265,9 @@ func (a *autoDetect) FIPSEnabled(_ context.Context) bool {
266265
return fips.IsFipsEnabled()
267266
}
268267

269-
// CheckNativeSidecarSupport checks if native sidecars are available and enabled.
270-
// This requires both the operator feature gate to be enabled AND
271-
// Kubernetes version >= 1.29 (beta support).
268+
// NativeSidecarSupport checks if native sidecars are available.
269+
// This requires Kubernetes version >= 1.29 (when native sidecars became stable).
272270
func (a *autoDetect) NativeSidecarSupport() (bool, error) {
273-
if !featuregate.EnableNativeSidecarContainers.IsEnabled() {
274-
return false, nil
275-
}
276-
277271
currentVersion, err := a.k8sDetector.GetKubernetesVersion()
278272
if err != nil {
279273
return false, err

pkg/featuregate/featuregate.go

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

1616
var (
17-
// EnableNativeSidecarContainers is the feature gate that controls whether a
18-
// sidecar should be injected as a native sidecar or the classic way.
19-
// Native sidecar containers have been available since kubernetes v1.28 in
20-
// alpha and v1.29 in beta.
21-
// It needs to be enabled with +featureGate=SidecarContainers.
22-
// See:
23-
// https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-gates-for-alpha-or-beta-features
24-
EnableNativeSidecarContainers = featuregate.GlobalRegistry().MustRegister(
25-
"operator.sidecarcontainers.native",
26-
featuregate.StageStable,
27-
featuregate.WithRegisterDescription("controls whether the operator supports sidecar containers as init containers. Should only be enabled on k8s v1.29+"),
28-
featuregate.WithRegisterFromVersion("v0.111.0"),
29-
featuregate.WithRegisterToVersion("v0.140.0"),
30-
)
3117
// SetGolangFlags is the feature gate that enables automatically setting GOMEMLIMIT and GOMAXPROCS for the
3218
// collector, bridge, and target allocator.
3319
SetGolangFlags = featuregate.GlobalRegistry().MustRegister(

pkg/sidecar/pod_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,18 @@ import (
88

99
"github.com/stretchr/testify/assert"
1010
"github.com/stretchr/testify/require"
11-
colfeaturegate "go.opentelemetry.io/collector/featuregate"
1211
corev1 "k8s.io/api/core/v1"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1413
logf "sigs.k8s.io/controller-runtime/pkg/log"
1514

1615
"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
1716
"github.com/open-telemetry/opentelemetry-operator/internal/config"
1817
"github.com/open-telemetry/opentelemetry-operator/internal/naming"
19-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
2018
)
2119

2220
var logger = logf.Log.WithName("unit-tests")
2321

24-
func enableSidecarFeatureGate(t *testing.T) {
25-
originalVal := featuregate.EnableNativeSidecarContainers.IsEnabled()
26-
t.Logf("original is: %+v", originalVal)
27-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNativeSidecarContainers.ID(), true))
28-
t.Cleanup(func() {
29-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNativeSidecarContainers.ID(), originalVal))
30-
})
31-
}
32-
3322
func TestAddNativeSidecar(t *testing.T) {
34-
enableSidecarFeatureGate(t)
3523
// prepare
3624
pod := corev1.Pod{
3725
Spec: corev1.PodSpec{
@@ -329,8 +317,6 @@ func TestRemoveNonExistingSidecar(t *testing.T) {
329317
}
330318

331319
func TestExistsIn(t *testing.T) {
332-
enableSidecarFeatureGate(t)
333-
334320
for _, tt := range []struct {
335321
desc string
336322
pod corev1.Pod

0 commit comments

Comments
 (0)