Skip to content

Commit f1c634f

Browse files
authored
Merge pull request kubernetes#130463 from sanposhiho/ga-mlk
feat: graduate MatchLabelKeysInPodAffinity to GA
2 parents 73f54b6 + 10c6a42 commit f1c634f

File tree

15 files changed

+38
-24
lines changed

15 files changed

+38
-24
lines changed

api/openapi-spec/swagger.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/api__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/apis__apps__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/apis__batch__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/pod/util_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,10 @@ func Test_dropDisabledMatchLabelKeysFieldInPodAffinity(t *testing.T) {
22712271

22722272
for _, test := range tests {
22732273
t.Run(test.name, func(t *testing.T) {
2274-
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodAffinity, test.enabled)
2274+
if !test.enabled {
2275+
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.32"))
2276+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodAffinity, false)
2277+
}
22752278

22762279
dropDisabledFields(test.podSpec, nil, test.oldPodSpec, nil)
22772280
if diff := cmp.Diff(test.wantPodSpec, test.podSpec); diff != "" {

pkg/apis/core/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,6 @@ type PodAffinityTerm struct {
32683268
// pod labels will be ignored. The default value is empty.
32693269
// The same key is forbidden to exist in both matchLabelKeys and labelSelector.
32703270
// Also, matchLabelKeys cannot be set when labelSelector isn't set.
3271-
// This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
32723271
//
32733272
// +listType=atomic
32743273
// +optional
@@ -3281,7 +3280,6 @@ type PodAffinityTerm struct {
32813280
// pod labels will be ignored. The default value is empty.
32823281
// The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
32833282
// Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
3284-
// This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
32853283
//
32863284
// +listType=atomic
32873285
// +optional

pkg/features/versioned_kube_features.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
510510
MatchLabelKeysInPodAffinity: {
511511
{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha},
512512
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta},
513+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
513514
},
514515

515516
MatchLabelKeysInPodTopologySpread: {

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/registry/core/pod/strategy_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"k8s.io/apimachinery/pkg/labels"
3737
"k8s.io/apimachinery/pkg/runtime"
3838
"k8s.io/apimachinery/pkg/types"
39+
"k8s.io/apimachinery/pkg/util/version"
3940
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
4041
utilfeature "k8s.io/apiserver/pkg/util/feature"
4142
"k8s.io/apiserver/pkg/warning"
@@ -1781,7 +1782,10 @@ func Test_mutatePodAffinity(t *testing.T) {
17811782

17821783
for _, tc := range tests {
17831784
t.Run(tc.name, func(t *testing.T) {
1784-
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodAffinity, tc.featureGateEnabled)
1785+
if !tc.featureGateEnabled {
1786+
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.32"))
1787+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodAffinity, false)
1788+
}
17851789

17861790
pod := tc.pod
17871791
mutatePodAffinity(pod)

staging/src/k8s.io/api/core/v1/generated.proto

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)