Skip to content
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
21 changes: 21 additions & 0 deletions .chloggen/fg_native_sidecar_rm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove native sidecar feature gate

# One or more tracking issues related to the change
issues: [4451]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
The feature gate `operator.sidecarcontainers.native` has been removed.
It was introduced in v0.111.0, enabled by default since v0.132.0, and marked as stable in v0.139.0.
Native sidecars are now automatically enabled on Kubernetes v1.29+ without requiring a feature gate.
If you were explicitly enabling or disabling this feature gate with `--feature-gates=+operator.sidecarcontainers.native`,
you must remove that flag.
10 changes: 2 additions & 8 deletions internal/autodetect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/targetallocator"
"github.com/open-telemetry/opentelemetry-operator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/internal/rbac"
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
)

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

// CheckNativeSidecarSupport checks if native sidecars are available and enabled.
// This requires both the operator feature gate to be enabled AND
// Kubernetes version >= 1.29 (beta support).
// NativeSidecarSupport checks if native sidecars are available.
// This requires Kubernetes version >= 1.29 (when native sidecars became stable).
func (a *autoDetect) NativeSidecarSupport() (bool, error) {
if !featuregate.EnableNativeSidecarContainers.IsEnabled() {
return false, nil
}

currentVersion, err := a.k8sDetector.GetKubernetesVersion()
if err != nil {
return false, err
Expand Down
14 changes: 0 additions & 14 deletions pkg/featuregate/featuregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ const (
)

var (
// EnableNativeSidecarContainers is the feature gate that controls whether a
// sidecar should be injected as a native sidecar or the classic way.
// Native sidecar containers have been available since kubernetes v1.28 in
// alpha and v1.29 in beta.
// It needs to be enabled with +featureGate=SidecarContainers.
// See:
// https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-gates-for-alpha-or-beta-features
EnableNativeSidecarContainers = featuregate.GlobalRegistry().MustRegister(
"operator.sidecarcontainers.native",
featuregate.StageStable,
featuregate.WithRegisterDescription("controls whether the operator supports sidecar containers as init containers. Should only be enabled on k8s v1.29+"),
featuregate.WithRegisterFromVersion("v0.111.0"),
featuregate.WithRegisterToVersion("v0.140.0"),
)
// SetGolangFlags is the feature gate that enables automatically setting GOMEMLIMIT and GOMAXPROCS for the
// collector, bridge, and target allocator.
SetGolangFlags = featuregate.GlobalRegistry().MustRegister(
Expand Down
14 changes: 0 additions & 14 deletions pkg/sidecar/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,18 @@ import (

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

"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
"github.com/open-telemetry/opentelemetry-operator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/internal/naming"
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
)

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

func enableSidecarFeatureGate(t *testing.T) {
originalVal := featuregate.EnableNativeSidecarContainers.IsEnabled()
t.Logf("original is: %+v", originalVal)
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNativeSidecarContainers.ID(), true))
t.Cleanup(func() {
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNativeSidecarContainers.ID(), originalVal))
})
}

func TestAddNativeSidecar(t *testing.T) {
enableSidecarFeatureGate(t)
// prepare
pod := corev1.Pod{
Spec: corev1.PodSpec{
Expand Down Expand Up @@ -329,8 +317,6 @@ func TestRemoveNonExistingSidecar(t *testing.T) {
}

func TestExistsIn(t *testing.T) {
enableSidecarFeatureGate(t)

for _, tt := range []struct {
desc string
pod corev1.Pod
Expand Down
Loading