node: podresources: getallocatable: move to GA

lock the feature gate to GA, and remove the now-redundant code.

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani
2023-05-01 16:28:42 +02:00
parent 0da0b7a85d
commit 01c3a51a78
5 changed files with 7 additions and 38 deletions

View File

@@ -435,9 +435,10 @@ const (
// Enable POD resources API with Get method
KubeletPodResourcesGet featuregate.Feature = "KubeletPodResourcesGet"
// owner: @fromanirh
// owner: @ffromani
// alpha: v1.21
// beta: v1.23
// GA: v1.28
// Enable POD resources API to return allocatable resources
KubeletPodResourcesGetAllocatable featuregate.Feature = "KubeletPodResourcesGetAllocatable"
@@ -972,7 +973,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
KubeletPodResourcesGet: {Default: false, PreRelease: featuregate.Alpha},
KubeletPodResourcesGetAllocatable: {Default: true, PreRelease: featuregate.Beta},
KubeletPodResourcesGetAllocatable: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.28, remove in 1.30
KubeletTracing: {Default: true, PreRelease: featuregate.Beta},

View File

@@ -90,11 +90,6 @@ func (p *v1PodResourcesServer) GetAllocatableResources(ctx context.Context, req
metrics.PodResourcesEndpointRequestsTotalCount.WithLabelValues("v1").Inc()
metrics.PodResourcesEndpointRequestsGetAllocatableCount.WithLabelValues("v1").Inc()
if !utilfeature.DefaultFeatureGate.Enabled(kubefeatures.KubeletPodResourcesGetAllocatable) {
metrics.PodResourcesEndpointErrorsGetAllocatableCount.WithLabelValues("v1").Inc()
return nil, fmt.Errorf("PodResources API GetAllocatableResources disabled")
}
response := &v1.AllocatableResourcesResponse{
Devices: p.devicesProvider.GetAllocatableDevices(),
CpuIds: p.cpusProvider.GetAllocatableCPUs(),

View File

@@ -251,8 +251,6 @@ func TestListPodResourcesV1(t *testing.T) {
}
func TestAllocatableResources(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.KubeletPodResourcesGetAllocatable, true)()
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()

View File

@@ -777,12 +777,10 @@ func Register(collectors ...metrics.StableCollector) {
legacyregistry.MustRegister(RestartedPodTotal)
legacyregistry.MustRegister(ManagedEphemeralContainers)
legacyregistry.MustRegister(PodResourcesEndpointRequestsTotalCount)
if utilfeature.DefaultFeatureGate.Enabled(features.KubeletPodResourcesGetAllocatable) {
legacyregistry.MustRegister(PodResourcesEndpointRequestsListCount)
legacyregistry.MustRegister(PodResourcesEndpointRequestsGetAllocatableCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsListCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsGetAllocatableCount)
}
legacyregistry.MustRegister(PodResourcesEndpointRequestsListCount)
legacyregistry.MustRegister(PodResourcesEndpointRequestsGetAllocatableCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsListCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsGetAllocatableCount)
if utilfeature.DefaultFeatureGate.Enabled(features.KubeletPodResourcesGet) {
legacyregistry.MustRegister(PodResourcesEndpointRequestsGetCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsGetCount)