Merge pull request #128124 from PiotrProkop/topology-manager-options-stable

topologymanager: Promote support for improved multi-numa alignment in Topology Manager to GA
This commit is contained in:
Kubernetes Prow Robot 2024-10-28 23:56:53 +00:00 committed by GitHub
commit 961344ddb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 9 deletions

View File

@ -726,6 +726,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
TopologyManagerPolicyOptions: { TopologyManagerPolicyOptions: {
{Version: version.MustParse("1.26"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.26"), Default: false, PreRelease: featuregate.Alpha},
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA},
}, },
TranslateStreamCloseWebsocketRequests: { TranslateStreamCloseWebsocketRequests: {

View File

@ -34,10 +34,11 @@ const (
var ( var (
alphaOptions = sets.New[string]() alphaOptions = sets.New[string]()
betaOptions = sets.New[string]( betaOptions = sets.New[string](
PreferClosestNUMANodes,
MaxAllowableNUMANodes, MaxAllowableNUMANodes,
) )
stableOptions = sets.New[string]() stableOptions = sets.New[string](
PreferClosestNUMANodes,
)
) )
func CheckPolicyOptionAvailable(option string) error { func CheckPolicyOptionAvailable(option string) error {

View File

@ -47,9 +47,7 @@ func TestNewTopologyManagerOptions(t *testing.T) {
expectedOptions PolicyOptions expectedOptions PolicyOptions
}{ }{
{ {
description: "return TopologyManagerOptions with PreferClosestNUMA set to true", description: "return TopologyManagerOptions with PreferClosestNUMA set to true",
featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions,
featureGateEnable: true,
expectedOptions: PolicyOptions{ expectedOptions: PolicyOptions{
PreferClosestNUMA: true, PreferClosestNUMA: true,
MaxAllowableNUMANodes: 8, MaxAllowableNUMANodes: 8,
@ -74,8 +72,7 @@ func TestNewTopologyManagerOptions(t *testing.T) {
description: "fail to set option when TopologyManagerPolicyBetaOptions feature gate is not set", description: "fail to set option when TopologyManagerPolicyBetaOptions feature gate is not set",
featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions, featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions,
policyOptions: map[string]string{ policyOptions: map[string]string{
PreferClosestNUMANodes: "true", MaxAllowableNUMANodes: "8",
MaxAllowableNUMANodes: "8",
}, },
expectedErr: fmt.Errorf("Topology Manager Policy Beta-level Options not enabled,"), expectedErr: fmt.Errorf("Topology Manager Policy Beta-level Options not enabled,"),
}, },
@ -87,7 +84,6 @@ func TestNewTopologyManagerOptions(t *testing.T) {
}, },
{ {
description: "fail to parse options with error PreferClosestNUMANodes", description: "fail to parse options with error PreferClosestNUMANodes",
featureGate: pkgfeatures.TopologyManagerPolicyAlphaOptions,
featureGateEnable: true, featureGateEnable: true,
policyOptions: map[string]string{ policyOptions: map[string]string{
PreferClosestNUMANodes: "not a boolean", PreferClosestNUMANodes: "not a boolean",
@ -177,6 +173,10 @@ func TestPolicyDefaultsAvailable(t *testing.T) {
option: PreferClosestNUMANodes, option: PreferClosestNUMANodes,
expectedAvailable: true, expectedAvailable: true,
}, },
{
option: MaxAllowableNUMANodes,
expectedAvailable: true,
},
} }
for _, testCase := range testCases { for _, testCase := range testCases {
t.Run(testCase.option, func(t *testing.T) { t.Run(testCase.option, func(t *testing.T) {
@ -206,7 +206,7 @@ func TestPolicyOptionsAvailable(t *testing.T) {
{ {
option: PreferClosestNUMANodes, option: PreferClosestNUMANodes,
featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions, featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions,
featureGateEnable: true, featureGateEnable: false,
expectedAvailable: true, expectedAvailable: true,
}, },
{ {
@ -215,10 +215,40 @@ func TestPolicyOptionsAvailable(t *testing.T) {
featureGateEnable: false, featureGateEnable: false,
expectedAvailable: true, expectedAvailable: true,
}, },
{
option: fancyAlphaOption,
featureGate: pkgfeatures.TopologyManagerPolicyAlphaOptions,
featureGateEnable: true,
expectedAvailable: true,
},
{
option: fancyAlphaOption,
featureGate: pkgfeatures.TopologyManagerPolicyAlphaOptions,
featureGateEnable: false,
expectedAvailable: false,
},
{
option: fancyBetaOption,
featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions,
featureGateEnable: true,
expectedAvailable: true,
},
{
option: fancyBetaOption,
featureGate: pkgfeatures.TopologyManagerPolicyBetaOptions,
featureGateEnable: false,
expectedAvailable: false,
},
} }
betaOptions.Insert(fancyBetaOption)
alphaOptions.Insert(fancyAlphaOption)
for _, testCase := range testCases { for _, testCase := range testCases {
t.Run(testCase.option, func(t *testing.T) { t.Run(testCase.option, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, testCase.featureGate, testCase.featureGateEnable) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, testCase.featureGate, testCase.featureGateEnable)
defer func() {
// reset feature flag
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, testCase.featureGate, !testCase.featureGateEnable)
}()
err := CheckPolicyOptionAvailable(testCase.option) err := CheckPolicyOptionAvailable(testCase.option)
isEnabled := (err == nil) isEnabled := (err == nil)
if isEnabled != testCase.expectedAvailable { if isEnabled != testCase.expectedAvailable {

View File

@ -1302,6 +1302,10 @@
lockToDefault: false lockToDefault: false
preRelease: Beta preRelease: Beta
version: "1.28" version: "1.28"
- default: true
lockToDefault: false
preRelease: GA
version: "1.32"
- name: TranslateStreamCloseWebsocketRequests - name: TranslateStreamCloseWebsocketRequests
versionedSpecs: versionedSpecs:
- default: false - default: false