Skip to content

Commit 7a8a4c2

Browse files
authored
Merge pull request kubernetes#129933 from serathius/deprecate-namespace-index
Disable StorageNamespaceIndex feature gate when BtreeWatchCache enabled and deprecate it
2 parents e0b1737 + b1ad53c commit 7a8a4c2

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

pkg/features/kube_features.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ const (
664664
// owner: @ahutsunshine
665665
//
666666
// Allows namespace indexer for namespace scope resources in apiserver cache to accelerate list operations.
667+
// Superseded by BtreeWatchCache.
667668
StorageNamespaceIndex featuregate.Feature = "StorageNamespaceIndex"
668669

669670
// owner: @nilekhc

pkg/features/versioned_kube_features.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
678678

679679
StorageNamespaceIndex: {
680680
{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta},
681+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Deprecated},
681682
},
682683

683684
ServiceAccountNodeAudienceRestriction: {

pkg/registry/core/pod/strategy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
utilnet "k8s.io/apimachinery/pkg/util/net"
4141
utilvalidation "k8s.io/apimachinery/pkg/util/validation"
4242
"k8s.io/apimachinery/pkg/util/validation/field"
43+
apiserverfeatures "k8s.io/apiserver/pkg/features"
4344
"k8s.io/apiserver/pkg/registry/generic"
4445
"k8s.io/apiserver/pkg/storage"
4546
"k8s.io/apiserver/pkg/storage/names"
@@ -379,7 +380,7 @@ func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
379380
// MatchPod returns a generic matcher for a given label and field selector.
380381
func MatchPod(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
381382
var indexFields = []string{"spec.nodeName"}
382-
if utilfeature.DefaultFeatureGate.Enabled(features.StorageNamespaceIndex) {
383+
if utilfeature.DefaultFeatureGate.Enabled(features.StorageNamespaceIndex) && !utilfeature.DefaultFeatureGate.Enabled(apiserverfeatures.BtreeWatchCache) {
383384
indexFields = append(indexFields, "metadata.namespace")
384385
}
385386
return storage.SelectionPredicate{
@@ -418,7 +419,7 @@ func Indexers() *cache.Indexers {
418419
var indexers = cache.Indexers{
419420
storage.FieldIndex("spec.nodeName"): NodeNameIndexFunc,
420421
}
421-
if utilfeature.DefaultFeatureGate.Enabled(features.StorageNamespaceIndex) {
422+
if utilfeature.DefaultFeatureGate.Enabled(features.StorageNamespaceIndex) && !utilfeature.DefaultFeatureGate.Enabled(apiserverfeatures.BtreeWatchCache) {
422423
indexers[storage.FieldIndex("metadata.namespace")] = NamespaceIndexFunc
423424
}
424425
return &indexers

test/featuregates_linter/test_data/versioned_feature_list.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,10 @@
13021302
lockToDefault: false
13031303
preRelease: Beta
13041304
version: "1.30"
1305+
- default: true
1306+
lockToDefault: false
1307+
preRelease: Deprecated
1308+
version: "1.33"
13051309
- name: StorageVersionAPI
13061310
versionedSpecs:
13071311
- default: false

0 commit comments

Comments
 (0)