Lock ServerSideApply feature to true

This commit is contained in:
Wojciech Tyczyński
2022-09-27 11:13:00 +02:00
parent 27b7d3cd41
commit 57c95fbfa1
21 changed files with 32 additions and 347 deletions

View File

@@ -22,7 +22,6 @@ import (
"sort"
"time"
"k8s.io/apiserver/pkg/features"
rbacv1ac "k8s.io/client-go/applyconfigurations/rbac/v1"
"k8s.io/klog/v2"
@@ -33,7 +32,6 @@ import (
"k8s.io/apimachinery/pkg/labels"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
rbacinformers "k8s.io/client-go/informers/rbac/v1"
rbacclient "k8s.io/client-go/kubernetes/typed/rbac/v1"
rbaclisters "k8s.io/client-go/listers/rbac/v1"
@@ -125,16 +123,12 @@ func (c *ClusterRoleAggregationController) syncClusterRole(ctx context.Context,
return nil
}
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) {
err = c.applyClusterRoles(ctx, sharedClusterRole.Name, newPolicyRules)
if errors.IsUnsupportedMediaType(err) { // TODO: Remove this fallback at least one release after ServerSideApply GA
// When Server Side Apply is not enabled, fallback to Update. This is required when running
// 1.21 since api-server can be 1.20 during the upgrade/downgrade.
// Since Server Side Apply is enabled by default in Beta, this fallback only kicks in
// if the feature has been disabled using its feature flag.
err = c.updateClusterRoles(ctx, sharedClusterRole, newPolicyRules)
}
} else {
err = c.applyClusterRoles(ctx, sharedClusterRole.Name, newPolicyRules)
if errors.IsUnsupportedMediaType(err) { // TODO: Remove this fallback at least one release after ServerSideApply GA
// When Server Side Apply is not enabled, fallback to Update. This is required when running
// 1.21 since api-server can be 1.20 during the upgrade/downgrade.
// Since Server Side Apply is enabled by default in Beta, this fallback only kicks in
// if the feature has been disabled using its feature flag.
err = c.updateClusterRoles(ctx, sharedClusterRole, newPolicyRules)
}
return err