diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index af333af5e66..6c2d342e736 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -43,6 +43,10 @@ import ( e2etestingmanifests "k8s.io/kubernetes/test/e2e/testing-manifests" testfixtures "k8s.io/kubernetes/test/fixtures" + // define and freeze constants + _ "k8s.io/kubernetes/test/e2e/feature" + _ "k8s.io/kubernetes/test/e2e/nodefeature" + // test sources _ "k8s.io/kubernetes/test/e2e/apimachinery" _ "k8s.io/kubernetes/test/e2e/apps" diff --git a/test/e2e/feature/feature.go b/test/e2e/feature/feature.go new file mode 100644 index 00000000000..09ebab6b14f --- /dev/null +++ b/test/e2e/feature/feature.go @@ -0,0 +1,132 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package feature contains pre-defined features used by test/e2e and/or +// test/e2e_node. +package feature + +import ( + "k8s.io/kubernetes/test/e2e/framework" +) + +var ( + APIServerIdentity = framework.WithFeature(framework.ValidFeatures.Add("APIServerIdentity")) + AppArmor = framework.WithFeature(framework.ValidFeatures.Add("AppArmor")) + BootstrapTokens = framework.WithFeature(framework.ValidFeatures.Add("BootstrapTokens")) + BoundServiceAccountTokenVolume = framework.WithFeature(framework.ValidFeatures.Add("BoundServiceAccountTokenVolume")) + CloudProvider = framework.WithFeature(framework.ValidFeatures.Add("CloudProvider")) + ClusterAutoscalerScalability1 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability1")) + ClusterAutoscalerScalability2 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability2")) + ClusterAutoscalerScalability3 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability3")) + ClusterAutoscalerScalability4 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability4")) + ClusterAutoscalerScalability5 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability5")) + ClusterAutoscalerScalability6 = framework.WithFeature(framework.ValidFeatures.Add("ClusterAutoscalerScalability6")) + ClusterDowngrade = framework.WithFeature(framework.ValidFeatures.Add("ClusterDowngrade")) + ClusterSizeAutoscalingGpu = framework.WithFeature(framework.ValidFeatures.Add("ClusterSizeAutoscalingGpu")) + ClusterSizeAutoscalingScaleDown = framework.WithFeature(framework.ValidFeatures.Add("ClusterSizeAutoscalingScaleDown")) + ClusterSizeAutoscalingScaleUp = framework.WithFeature(framework.ValidFeatures.Add("ClusterSizeAutoscalingScaleUp")) + ClusterUpgrade = framework.WithFeature(framework.ValidFeatures.Add("ClusterUpgrade")) + ComprehensiveNamespaceDraining = framework.WithFeature(framework.ValidFeatures.Add("ComprehensiveNamespaceDraining")) + CPUManager = framework.WithFeature(framework.ValidFeatures.Add("CPUManager")) + CustomMetricsAutoscaling = framework.WithFeature(framework.ValidFeatures.Add("CustomMetricsAutoscaling")) + DeviceManager = framework.WithFeature(framework.ValidFeatures.Add("DeviceManager")) + DevicePluginProbe = framework.WithFeature(framework.ValidFeatures.Add("DevicePluginProbe")) + Downgrade = framework.WithFeature(framework.ValidFeatures.Add("Downgrade")) + DynamicResourceAllocation = framework.WithFeature(framework.ValidFeatures.Add("DynamicResourceAllocation")) + EphemeralStorage = framework.WithFeature(framework.ValidFeatures.Add("EphemeralStorage")) + Example = framework.WithFeature(framework.ValidFeatures.Add("Example")) + ExperimentalResourceUsageTracking = framework.WithFeature(framework.ValidFeatures.Add("ExperimentalResourceUsageTracking")) + Flexvolumes = framework.WithFeature(framework.ValidFeatures.Add("Flexvolumes")) + GKENodePool = framework.WithFeature(framework.ValidFeatures.Add("GKENodePool")) + GPUClusterDowngrade = framework.WithFeature(framework.ValidFeatures.Add("GPUClusterDowngrade")) + GPUClusterUpgrade = framework.WithFeature(framework.ValidFeatures.Add("GPUClusterUpgrade")) + GPUDevicePlugin = framework.WithFeature(framework.ValidFeatures.Add("GPUDevicePlugin")) + GPUMasterUpgrade = framework.WithFeature(framework.ValidFeatures.Add("GPUMasterUpgrade")) + GPUUpgrade = framework.WithFeature(framework.ValidFeatures.Add("GPUUpgrade")) + HAMaster = framework.WithFeature(framework.ValidFeatures.Add("HAMaster")) + HPA = framework.WithFeature(framework.ValidFeatures.Add("HPA")) + HugePages = framework.WithFeature(framework.ValidFeatures.Add("HugePages")) + Ingress = framework.WithFeature(framework.ValidFeatures.Add("Ingress")) + IngressScale = framework.WithFeature(framework.ValidFeatures.Add("IngressScale")) + InPlacePodVerticalScaling = framework.WithFeature(framework.ValidFeatures.Add("InPlacePodVerticalScaling")) + IPv6DualStack = framework.WithFeature(framework.ValidFeatures.Add("IPv6DualStack")) + Kind = framework.WithFeature(framework.ValidFeatures.Add("Kind")) + KubeletCredentialProviders = framework.WithFeature(framework.ValidFeatures.Add("KubeletCredentialProviders")) + KubeletSecurity = framework.WithFeature(framework.ValidFeatures.Add("KubeletSecurity")) + KubeProxyDaemonSetDowngrade = framework.WithFeature(framework.ValidFeatures.Add("KubeProxyDaemonSetDowngrade")) + KubeProxyDaemonSetUpgrade = framework.WithFeature(framework.ValidFeatures.Add("KubeProxyDaemonSetUpgrade")) + KubeProxyDaemonSetMigration = framework.WithFeature(framework.ValidFeatures.Add("KubeProxyDaemonSetMigration")) + LabelSelector = framework.WithFeature(framework.ValidFeatures.Add("LabelSelector")) + LocalStorageCapacityIsolation = framework.WithFeature(framework.ValidFeatures.Add("LocalStorageCapacityIsolation")) + LocalStorageCapacityIsolationQuota = framework.WithFeature(framework.ValidFeatures.Add("LocalStorageCapacityIsolationQuota")) + MasterUpgrade = framework.WithFeature(framework.ValidFeatures.Add("MasterUpgrade")) + MemoryManager = framework.WithFeature(framework.ValidFeatures.Add("MemoryManager")) + NEG = framework.WithFeature(framework.ValidFeatures.Add("NEG")) + NetworkingDNS = framework.WithFeature(framework.ValidFeatures.Add("Networking-DNS")) + NetworkingIPv4 = framework.WithFeature(framework.ValidFeatures.Add("Networking-IPv4")) + NetworkingIPv6 = framework.WithFeature(framework.ValidFeatures.Add("Networking-IPv6")) + NetworkingPerformance = framework.WithFeature(framework.ValidFeatures.Add("Networking-Performance")) + NetworkPolicy = framework.WithFeature(framework.ValidFeatures.Add("NetworkPolicy")) + NodeAuthenticator = framework.WithFeature(framework.ValidFeatures.Add("NodeAuthenticator")) + NodeAuthorizer = framework.WithFeature(framework.ValidFeatures.Add("NodeAuthorizer")) + NodeOutOfServiceVolumeDetach = framework.WithFeature(framework.ValidFeatures.Add("NodeOutOfServiceVolumeDetach")) + NoSNAT = framework.WithFeature(framework.ValidFeatures.Add("NoSNAT")) + PerformanceDNS = framework.WithFeature(framework.ValidFeatures.Add("PerformanceDNS")) + PodGarbageCollector = framework.WithFeature(framework.ValidFeatures.Add("PodGarbageCollector")) + PodPriority = framework.WithFeature(framework.ValidFeatures.Add("PodPriority")) + PodReadyToStartContainersCondition = framework.WithFeature(framework.ValidFeatures.Add("PodReadyToStartContainersCondition")) + PodResources = framework.WithFeature(framework.ValidFeatures.Add("PodResources")) + ProbeTerminationGracePeriod = framework.WithFeature(framework.ValidFeatures.Add("ProbeTerminationGracePeriod")) + Reboot = framework.WithFeature(framework.ValidFeatures.Add("Reboot")) + ReclaimPolicy = framework.WithFeature(framework.ValidFeatures.Add("ReclaimPolicy")) + RecoverVolumeExpansionFailure = framework.WithFeature(framework.ValidFeatures.Add("RecoverVolumeExpansionFailure")) + Recreate = framework.WithFeature(framework.ValidFeatures.Add("Recreate")) + RegularResourceUsageTracking = framework.WithFeature(framework.ValidFeatures.Add("RegularResourceUsageTracking")) + ScopeSelectors = framework.WithFeature(framework.ValidFeatures.Add("ScopeSelectors")) + SCTPConnectivity = framework.WithFeature(framework.ValidFeatures.Add("SCTPConnectivity")) + SeccompDefault = framework.WithFeature(framework.ValidFeatures.Add("SeccompDefault")) + SELinux = framework.WithFeature(framework.ValidFeatures.Add("SELinux")) + SELinuxMountReadWriteOncePod = framework.WithFeature(framework.ValidFeatures.Add("SELinuxMountReadWriteOncePod")) + StackdriverAcceleratorMonitoring = framework.WithFeature(framework.ValidFeatures.Add("StackdriverAcceleratorMonitoring")) + StackdriverCustomMetrics = framework.WithFeature(framework.ValidFeatures.Add("StackdriverCustomMetrics")) + StackdriverExternalMetrics = framework.WithFeature(framework.ValidFeatures.Add("StackdriverExternalMetrics")) + StackdriverMetadataAgent = framework.WithFeature(framework.ValidFeatures.Add("StackdriverMetadataAgent")) + StackdriverMonitoring = framework.WithFeature(framework.ValidFeatures.Add("StackdriverMonitoring")) + StandaloneMode = framework.WithFeature(framework.ValidFeatures.Add("StandaloneMode")) + StatefulSet = framework.WithFeature(framework.ValidFeatures.Add("StatefulSet")) + StatefulSetStartOrdinal = framework.WithFeature(framework.ValidFeatures.Add("StatefulSetStartOrdinal")) + StatefulUpgrade = framework.WithFeature(framework.ValidFeatures.Add("StatefulUpgrade")) + StorageProvider = framework.WithFeature(framework.ValidFeatures.Add("StorageProvider")) + StorageVersionAPI = framework.WithFeature(framework.ValidFeatures.Add("StorageVersionAPI")) + TopologyHints = framework.WithFeature(framework.ValidFeatures.Add("Topology Hints")) + UDP = framework.WithFeature(framework.ValidFeatures.Add("UDP")) + Upgrade = framework.WithFeature(framework.ValidFeatures.Add("Upgrade")) + UserNamespacesStatelessPodsSupport = framework.WithFeature(framework.ValidFeatures.Add("UserNamespacesStatelessPodsSupport")) + ValidatingAdmissionPolicy = framework.WithFeature(framework.ValidFeatures.Add("ValidatingAdmissionPolicy")) + Volumes = framework.WithFeature(framework.ValidFeatures.Add("Volumes")) + VolumeSnapshotDataSource = framework.WithFeature(framework.ValidFeatures.Add("VolumeSnapshotDataSource")) + VolumeSourceXFS = framework.WithFeature(framework.ValidFeatures.Add("VolumeSourceXFS")) + Vsphere = framework.WithFeature(framework.ValidFeatures.Add("vsphere")) + WatchList = framework.WithFeature(framework.ValidFeatures.Add("WatchList")) + Windows = framework.WithFeature(framework.ValidFeatures.Add("Windows")) + WindowsHostProcessContainers = framework.WithFeature(framework.ValidFeatures.Add("WindowsHostProcessContainers")) + WindowsHyperVContainers = framework.WithFeature(framework.ValidFeatures.Add("WindowsHyperVContainers")) +) + +func init() { + // This prevents adding additional ad-hoc features in tests. + framework.ValidFeatures.Freeze() +} diff --git a/test/e2e/nodefeature/nodefeature.go b/test/e2e/nodefeature/nodefeature.go new file mode 100644 index 00000000000..ed0b3f091b3 --- /dev/null +++ b/test/e2e/nodefeature/nodefeature.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package feature contains pre-defined node features used by test/e2e and/or +// test/e2e_node. +package nodefeature + +import ( + "k8s.io/kubernetes/test/e2e/framework" +) + +var ( + AppArmor = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("AppArmor")) + CheckpointContainer = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("CheckpointContainer")) + CriticalPod = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("CriticalPod")) + DeviceManager = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("DeviceManager")) + DevicePluginProbe = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("DevicePluginProbe")) + DownwardAPIHugePages = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("DownwardAPIHugePages")) + DynamicResourceAllocation = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("DynamicResourceAllocation")) + Eviction = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("Eviction")) + FSGroup = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("FSGroup")) + GarbageCollect = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("GarbageCollect")) + GracefulNodeShutdown = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("GracefulNodeShutdown")) + GracefulNodeShutdownBasedOnPodPriority = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("GracefulNodeShutdownBasedOnPodPriority")) + HostAccess = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("HostAccess")) + ImageID = framework.WithNodeFeature(framework.ValidNodeFeatures.Add(" ImageID")) + LSCIQuotaMonitoring = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("LSCIQuotaMonitoring")) + NodeAllocatable = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("NodeAllocatable")) + NodeProblemDetector = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("NodeProblemDetector")) + OOMScoreAdj = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("OOMScoreAdj")) + PodDisruptionConditions = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("PodDisruptionConditions")) + PodResources = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("PodResources")) + ResourceMetrics = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("ResourceMetrics")) + RuntimeHandler = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("RuntimeHandler")) + SystemNodeCriticalPod = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("SystemNodeCriticalPod")) + TopologyManager = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("TopologyManager")) +) + +func init() { + // This prevents adding additional ad-hoc features in tests. + framework.ValidNodeFeatures.Freeze() +} diff --git a/test/e2e_node/.import-restrictions b/test/e2e_node/.import-restrictions index a4fbc3e2e2d..8eb0fdbaa49 100644 --- a/test/e2e_node/.import-restrictions +++ b/test/e2e_node/.import-restrictions @@ -4,9 +4,11 @@ rules: allowedPrefixes: - k8s.io/kubernetes/test/e2e/common - k8s.io/kubernetes/test/e2e/dra/test-driver/app + - k8s.io/kubernetes/test/e2e/feature - k8s.io/kubernetes/test/e2e/framework - k8s.io/kubernetes/test/e2e/storage/utils - k8s.io/kubernetes/test/e2e/network/common + - k8s.io/kubernetes/test/e2e/nodefeature - k8s.io/kubernetes/test/e2e/perftype - k8s.io/kubernetes/test/e2e/testing-manifests - k8s.io/kubernetes/test/e2e_node diff --git a/test/e2e_node/e2e_node_suite_test.go b/test/e2e_node/e2e_node_suite_test.go index 5d7f54af18d..95ae7d670e5 100644 --- a/test/e2e_node/e2e_node_suite_test.go +++ b/test/e2e_node/e2e_node_suite_test.go @@ -53,6 +53,10 @@ import ( e2enodetestingmanifests "k8s.io/kubernetes/test/e2e_node/testing-manifests" system "k8s.io/system-validators/validators" + // define and freeze constants + _ "k8s.io/kubernetes/test/e2e/feature" + _ "k8s.io/kubernetes/test/e2e/nodefeature" + // reconfigure framework _ "k8s.io/kubernetes/test/e2e/framework/debug/init" _ "k8s.io/kubernetes/test/e2e/framework/metrics/init"