From 1663223e58b5b0622a323bfe70f91f48449a6d50 Mon Sep 17 00:00:00 2001 From: Shingo Omura Date: Wed, 10 Jul 2024 15:18:13 +0900 Subject: [PATCH] KEP-3619: should check supplementalGroupsPolicyInUse for oldNode in dropDisabledFields for node --- pkg/registry/core/node/strategy.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/registry/core/node/strategy.go b/pkg/registry/core/node/strategy.go index 2e442f2498c..a699f084511 100644 --- a/pkg/registry/core/node/strategy.go +++ b/pkg/registry/core/node/strategy.go @@ -107,7 +107,7 @@ func dropDisabledFields(node *api.Node, oldNode *api.Node) { node.Status.RuntimeHandlers = nil } - if !utilfeature.DefaultFeatureGate.Enabled(features.SupplementalGroupsPolicy) { + if !utilfeature.DefaultFeatureGate.Enabled(features.SupplementalGroupsPolicy) && !supplementalGroupsPolicyInUse(oldNode) { node.Status.Features = nil } } @@ -299,3 +299,11 @@ func fieldIsDeprecatedWarnings(obj runtime.Object) []string { } return warnings } + +// supplementalGroupsPolicyInUse returns true if the node.status has NodeFeature +func supplementalGroupsPolicyInUse(node *api.Node) bool { + if node == nil { + return false + } + return node.Status.Features != nil +}