updating sidecar feature to node conformance

This commit is contained in:
Maria Romano Silva
2025-10-27 23:43:43 +00:00
parent f9952b77bd
commit a277269159
7 changed files with 10 additions and 14 deletions

View File

@@ -30,6 +30,7 @@ import (
"k8s.io/kubernetes/pkg/apis/core/helper"
apivalidation "k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/test/e2e/framework"
)
// ContainerType signifies container type
@@ -746,7 +747,7 @@ func dropDisabledFields(
}
}
if !utilfeature.DefaultFeatureGate.Enabled(features.SidecarContainers) && !restartableInitContainersInUse(oldPodSpec) {
if !utilfeature.DefaultFeatureGate.Enabled(framework.WithNodeConformance()) && !restartableInitContainersInUse(oldPodSpec) {
// Drop the RestartPolicy field of init containers.
for i := range podSpec.InitContainers {
podSpec.InitContainers[i].RestartPolicy = nil

View File

@@ -27,7 +27,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
apipod "k8s.io/kubernetes/pkg/api/v1/pod"
"k8s.io/kubernetes/pkg/features"
framework "k8s.io/kubernetes/test/e2e/framework"
"k8s.io/utils/clock"
"k8s.io/utils/ptr"
)
@@ -187,7 +187,7 @@ func getFinishedTime(p *v1.Pod) time.Time {
func getFinishTimeFromContainers(p *v1.Pod) *time.Time {
finishTime := latestFinishTime(nil, p.Status.ContainerStatuses, nil)
if utilfeature.DefaultFeatureGate.Enabled(features.SidecarContainers) {
if utilfeature.DefaultFeatureGate.Enabled(framework.WithNodeConformance()) {
// We need to check InitContainerStatuses here also,
// because with the sidecar (restartable init) containers,
// sidecar containers will always finish later than regular containers.

View File

@@ -258,7 +258,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() {
})
})
var _ = SIGDescribe(feature.SidecarContainers, framework.WithFeatureGate(features.SidecarContainers), "Restartable Init Container Lifecycle Hook", func() {
var _ = SIGDescribe(framework.WithNodeConformance(), framework.WithFeatureGate(features.SidecarContainers), "Restartable Init Container Lifecycle Hook", func() {
f := framework.NewDefaultFramework("restartable-init-container-lifecycle-hook")
// FIXME: This test is being run in the privileged mode because of https://github.com/kubernetes/kubernetes/issues/133091
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged

View File

@@ -411,10 +411,6 @@ var (
// and the networking.k8s.io/v1alpha1 API.
ServiceCIDRs = framework.WithFeature(framework.ValidFeatures.Add("ServiceCIDRs"))
// Owner: sig-node
// Sidecar KEP-753
SidecarContainers = framework.WithFeature(framework.ValidFeatures.Add("SidecarContainers"))
// TODO: document the feature (owning SIG, when to use this feature for a test)
StackdriverAcceleratorMonitoring = framework.WithFeature(framework.ValidFeatures.Add("StackdriverAcceleratorMonitoring"))

View File

@@ -29,7 +29,6 @@ import (
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
admissionapi "k8s.io/pod-security-admission/api"
"k8s.io/kubernetes/test/e2e/feature"
"k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
imageutils "k8s.io/kubernetes/test/utils/image"
@@ -2121,7 +2120,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
})
})
var _ = SIGDescribe(feature.SidecarContainers, "Containers Lifecycle", func() {
var _ = SIGDescribe(framework.WithNodeConformance(), "Containers Lifecycle", func() {
f := framework.NewDefaultFramework("containers-lifecycle-test")
addAfterEachForCleaningUpPods(f)
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@@ -6016,7 +6015,7 @@ fi`},
})
var _ = SIGDescribe(feature.SidecarContainers, framework.WithSerial(), "Containers Lifecycle", func() {
var _ = SIGDescribe(framework.WithNodeConformance(), framework.WithSerial(), "Containers Lifecycle", func() {
f := framework.NewDefaultFramework("containers-lifecycle-test-serial")
addAfterEachForCleaningUpPods(f)
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged

View File

@@ -692,7 +692,7 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
}
})
f.It("Can schedule a pod with a restartable init container", feature.SidecarContainers, func(ctx context.Context) {
f.It("Can schedule a pod with a restartable init container", framework.WithNodeConformance(), func(ctx context.Context) {
podRECMD := "devs=$(ls /tmp/ | egrep '^Dev-[0-9]+$') && echo stub devices: $devs && sleep %s"
sleepOneSecond := "1s"
rl := v1.ResourceList{v1.ResourceName(SampleDeviceResourceName): *resource.NewQuantity(1, resource.DecimalSI)}

View File

@@ -1113,7 +1113,7 @@ var _ = SIGDescribe("POD Resources API", framework.WithSerial(), feature.PodReso
podresourcesGetAllocatableResourcesTests(ctx, cli, sd, onlineCPUs, reservedSystemCPUs)
})
framework.It("should return the expected responses", feature.SidecarContainers, func(ctx context.Context) {
framework.It("should return the expected responses", framework.WithNodeConformance(), func(ctx context.Context) {
onlineCPUs, err := getOnlineCPUs()
framework.ExpectNoError(err, "getOnlineCPUs() failed err: %v", err)
@@ -1259,7 +1259,7 @@ var _ = SIGDescribe("POD Resources API", framework.WithSerial(), feature.PodReso
podresourcesGetTests(ctx, f, cli, false)
})
framework.It("should return the expected responses", feature.SidecarContainers, func(ctx context.Context) {
framework.It("should return the expected responses", framework.WithNodeConformance(), func(ctx context.Context) {
onlineCPUs, err := getOnlineCPUs()
framework.ExpectNoError(err, "getOnlineCPUs() failed err: %v", err)