mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update all k8s packages to 0.27.2
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
07b05616a0
commit
2551a0b05f
3
vendor/k8s.io/controller-manager/pkg/leadermigration/config/default.go
generated
vendored
3
vendor/k8s.io/controller-manager/pkg/leadermigration/config/default.go
generated
vendored
@ -19,8 +19,7 @@ package config
|
||||
import internal "k8s.io/controller-manager/config"
|
||||
|
||||
// DefaultLeaderMigrationConfiguration returns the default LeaderMigrationConfiguration
|
||||
//
|
||||
// that is valid for this release of Kubernetes.
|
||||
// that is valid for this release of Kubernetes.
|
||||
func DefaultLeaderMigrationConfiguration() *internal.LeaderMigrationConfiguration {
|
||||
return &internal.LeaderMigrationConfiguration{
|
||||
LeaderName: "cloud-provider-extraction-migration",
|
||||
|
28
vendor/k8s.io/controller-manager/pkg/leadermigration/feature.go
generated
vendored
28
vendor/k8s.io/controller-manager/pkg/leadermigration/feature.go
generated
vendored
@ -1,28 +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/apiserver/pkg/util/feature"
|
||||
"k8s.io/controller-manager/pkg/features"
|
||||
_ "k8s.io/controller-manager/pkg/features/register"
|
||||
)
|
||||
|
||||
// FeatureEnabled tells if leader migration is enabled through the feature gate.
|
||||
func FeatureEnabled() bool {
|
||||
return feature.DefaultMutableFeatureGate.Enabled(features.ControllerManagerLeaderMigration)
|
||||
}
|
35
vendor/k8s.io/controller-manager/pkg/leadermigration/filter.go
generated
vendored
35
vendor/k8s.io/controller-manager/pkg/leadermigration/filter.go
generated
vendored
@ -1,35 +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
|
||||
|
||||
// FilterResult indicates whether and how the controller manager should start the controller.
|
||||
type FilterResult int32
|
||||
|
||||
const (
|
||||
// ControllerUnowned indicates that the controller is owned by another controller manager
|
||||
// and thus should NOT be started by this controller manager.
|
||||
ControllerUnowned = iota
|
||||
// ControllerMigrated indicates that the controller manager should start this controller
|
||||
// with the migration lock.
|
||||
ControllerMigrated
|
||||
// ControllerNonMigrated indicates that the controller manager should start this controller
|
||||
// with the main lock.
|
||||
ControllerNonMigrated
|
||||
)
|
||||
|
||||
// FilterFunc takes a name of controller, returning a FilterResult indicating how to start controller.
|
||||
type FilterFunc func(controllerName string) FilterResult
|
62
vendor/k8s.io/controller-manager/pkg/leadermigration/migrator.go
generated
vendored
62
vendor/k8s.io/controller-manager/pkg/leadermigration/migrator.go
generated
vendored
@ -1,62 +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 (
|
||||
internal "k8s.io/controller-manager/config"
|
||||
)
|
||||
|
||||
// LeaderMigrator holds information required by the leader migration process.
|
||||
type LeaderMigrator struct {
|
||||
// MigrationReady is closed after the controller manager finishes preparing for the migration lock.
|
||||
// After this point, the leader migration process will proceed to acquire the migration lock.
|
||||
MigrationReady chan struct{}
|
||||
|
||||
// FilterFunc returns a FilterResult telling the controller manager what to do with the controller.
|
||||
FilterFunc FilterFunc
|
||||
}
|
||||
|
||||
// NewLeaderMigrator creates a LeaderMigrator with given config for the given component. component
|
||||
//
|
||||
// indicates which controller manager is requesting this leader migration, and it should be consistent
|
||||
// with the component field of ControllerLeaderConfiguration.
|
||||
func NewLeaderMigrator(config *internal.LeaderMigrationConfiguration, component string) *LeaderMigrator {
|
||||
migratedControllers := make(map[string]bool)
|
||||
for _, leader := range config.ControllerLeaders {
|
||||
migratedControllers[leader.Name] = leader.Component == component || leader.Component == "*"
|
||||
}
|
||||
return &LeaderMigrator{
|
||||
MigrationReady: make(chan struct{}),
|
||||
FilterFunc: func(controllerName string) FilterResult {
|
||||
shouldRun, ok := migratedControllers[controllerName]
|
||||
if ok {
|
||||
// The controller is included in the migration
|
||||
if shouldRun {
|
||||
// If the controller manager should run the controller,
|
||||
// start it in the migration lock.
|
||||
return ControllerMigrated
|
||||
}
|
||||
// Otherwise, the controller should be started by
|
||||
// some other controller manager.
|
||||
return ControllerUnowned
|
||||
}
|
||||
// The controller is not included in the migration,
|
||||
// and should be started in the main lock.
|
||||
return ControllerNonMigrated
|
||||
},
|
||||
}
|
||||
}
|
4
vendor/k8s.io/controller-manager/pkg/leadermigration/options/options.go
generated
vendored
4
vendor/k8s.io/controller-manager/pkg/leadermigration/options/options.go
generated
vendored
@ -21,7 +21,6 @@ import (
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
"k8s.io/controller-manager/config"
|
||||
"k8s.io/controller-manager/pkg/leadermigration"
|
||||
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
||||
)
|
||||
|
||||
@ -65,9 +64,6 @@ func (o *LeaderMigrationOptions) ApplyTo(cfg *config.GenericControllerManagerCon
|
||||
cfg.LeaderMigrationEnabled = false
|
||||
return nil
|
||||
}
|
||||
if o.Enabled && !leadermigration.FeatureEnabled() {
|
||||
return fmt.Errorf("Leader Migration is not enabled through feature gate")
|
||||
}
|
||||
cfg.LeaderMigrationEnabled = o.Enabled
|
||||
if !cfg.LeaderMigrationEnabled {
|
||||
return nil
|
||||
|
25
vendor/k8s.io/controller-manager/pkg/leadermigration/util.go
generated
vendored
25
vendor/k8s.io/controller-manager/pkg/leadermigration/util.go
generated
vendored
@ -1,25 +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 config "k8s.io/controller-manager/config"
|
||||
|
||||
// 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.
|
||||
func Enabled(genericConfig *config.GenericControllerManagerConfiguration) bool {
|
||||
return FeatureEnabled() && genericConfig.LeaderElection.LeaderElect && genericConfig.LeaderMigrationEnabled
|
||||
}
|
Reference in New Issue
Block a user