mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
allow enabling Leader Migration without config flag.
This commit is contained in:
parent
bade96ed78
commit
6ba7b3d26b
@ -73,7 +73,8 @@ func (o *LeaderMigrationOptions) ApplyTo(cfg *config.GenericControllerManagerCon
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if o.ControllerMigrationConfig == "" {
|
if o.ControllerMigrationConfig == "" {
|
||||||
return fmt.Errorf("--leader-migration-config is required")
|
cfg.LeaderMigration = *migrationconfig.DefaultLeaderMigrationConfiguration()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
leaderMigrationConfig, err := migrationconfig.ReadLeaderMigrationConfiguration(o.ControllerMigrationConfig)
|
leaderMigrationConfig, err := migrationconfig.ReadLeaderMigrationConfiguration(o.ControllerMigrationConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
"k8s.io/controller-manager/config"
|
"k8s.io/controller-manager/config"
|
||||||
"k8s.io/controller-manager/pkg/features"
|
"k8s.io/controller-manager/pkg/features"
|
||||||
|
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLeaderMigrationOptions(t *testing.T) {
|
func TestLeaderMigrationOptions(t *testing.T) {
|
||||||
@ -53,11 +54,12 @@ func TestLeaderMigrationOptions(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enabled, but missing configuration file",
|
name: "enabled, with default configuration",
|
||||||
flags: []string{"--enable-leader-migration"},
|
flags: []string{"--enable-leader-migration"},
|
||||||
enableFeatureGate: true,
|
enableFeatureGate: true,
|
||||||
expectEnabled: true,
|
expectEnabled: true,
|
||||||
expectErr: true,
|
expectErr: false,
|
||||||
|
expectConfig: migrationconfig.DefaultLeaderMigrationConfiguration(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enabled, with custom configuration file",
|
name: "enabled, with custom configuration file",
|
||||||
|
Loading…
Reference in New Issue
Block a user