mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
remove FeatureEnabled in controller-manager/pkg/leadermigration/feature.go
This commit is contained in:
parent
eadb0a29c5
commit
a0c139f8d3
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2021 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package leadermigration
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "k8s.io/controller-manager/pkg/features/register"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FeatureEnabled tells if leader migration is enabled through the feature gate.
|
|
||||||
func FeatureEnabled() bool {
|
|
||||||
return true
|
|
||||||
}
|
|
@ -21,7 +21,6 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"k8s.io/controller-manager/config"
|
"k8s.io/controller-manager/config"
|
||||||
"k8s.io/controller-manager/pkg/leadermigration"
|
|
||||||
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -65,9 +64,6 @@ func (o *LeaderMigrationOptions) ApplyTo(cfg *config.GenericControllerManagerCon
|
|||||||
cfg.LeaderMigrationEnabled = false
|
cfg.LeaderMigrationEnabled = false
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if o.Enabled && !leadermigration.FeatureEnabled() {
|
|
||||||
return fmt.Errorf("Leader Migration is not enabled through feature gate")
|
|
||||||
}
|
|
||||||
cfg.LeaderMigrationEnabled = o.Enabled
|
cfg.LeaderMigrationEnabled = o.Enabled
|
||||||
if !cfg.LeaderMigrationEnabled {
|
if !cfg.LeaderMigrationEnabled {
|
||||||
return nil
|
return nil
|
||||||
|
@ -21,5 +21,5 @@ import config "k8s.io/controller-manager/config"
|
|||||||
// Enabled checks whether Leader Migration should be enabled, given the GenericControllerManagerConfiguration.
|
// Enabled checks whether Leader Migration should be enabled, given the GenericControllerManagerConfiguration.
|
||||||
// It considers the feature gate first, and will always return false if the feature gate is not enabled.
|
// It considers the feature gate first, and will always return false if the feature gate is not enabled.
|
||||||
func Enabled(genericConfig *config.GenericControllerManagerConfiguration) bool {
|
func Enabled(genericConfig *config.GenericControllerManagerConfiguration) bool {
|
||||||
return FeatureEnabled() && genericConfig.LeaderElection.LeaderElect && genericConfig.LeaderMigrationEnabled
|
return genericConfig.LeaderElection.LeaderElect && genericConfig.LeaderMigrationEnabled
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user