mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Rename ReconcilerAction -> Action
This commit is contained in:
parent
06a975e5ad
commit
6f5d40e5de
@ -573,14 +573,14 @@ func explicitTaskFilter(t *podtask.T) bool {
|
|||||||
// invoke the given ReconcilerAction funcs in sequence, aborting the sequence if reconciliation
|
// invoke the given ReconcilerAction funcs in sequence, aborting the sequence if reconciliation
|
||||||
// is cancelled. if any other errors occur the composite reconciler will attempt to complete the
|
// is cancelled. if any other errors occur the composite reconciler will attempt to complete the
|
||||||
// sequence, reporting only the last generated error.
|
// sequence, reporting only the last generated error.
|
||||||
func (k *framework) makeCompositeReconciler(actions ...taskreconciler.ReconcilerAction) taskreconciler.ReconcilerAction {
|
func (k *framework) makeCompositeReconciler(actions ...taskreconciler.Action) taskreconciler.Action {
|
||||||
if x := len(actions); x == 0 {
|
if x := len(actions); x == 0 {
|
||||||
// programming error
|
// programming error
|
||||||
panic("no actions specified for composite reconciler")
|
panic("no actions specified for composite reconciler")
|
||||||
} else if x == 1 {
|
} else if x == 1 {
|
||||||
return actions[0]
|
return actions[0]
|
||||||
}
|
}
|
||||||
chained := func(d bindings.SchedulerDriver, c <-chan struct{}, a, b taskreconciler.ReconcilerAction) <-chan error {
|
chained := func(d bindings.SchedulerDriver, c <-chan struct{}, a, b taskreconciler.Action) <-chan error {
|
||||||
ech := a(d, c)
|
ech := a(d, c)
|
||||||
ch := make(chan error, 1)
|
ch := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
@ -615,17 +615,17 @@ func (k *framework) makeCompositeReconciler(actions ...taskreconciler.Reconciler
|
|||||||
for i := 2; i < len(actions); i++ {
|
for i := 2; i < len(actions); i++ {
|
||||||
i := i
|
i := i
|
||||||
next := func(d bindings.SchedulerDriver, c <-chan struct{}) <-chan error {
|
next := func(d bindings.SchedulerDriver, c <-chan struct{}) <-chan error {
|
||||||
return chained(d, c, taskreconciler.ReconcilerAction(result), actions[i])
|
return chained(d, c, taskreconciler.Action(result), actions[i])
|
||||||
}
|
}
|
||||||
result = next
|
result = next
|
||||||
}
|
}
|
||||||
return taskreconciler.ReconcilerAction(result)
|
return taskreconciler.Action(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconciler action factory, performs explicit task reconciliation for non-terminal
|
// reconciler action factory, performs explicit task reconciliation for non-terminal
|
||||||
// tasks listed in the scheduler's internal taskRegistry.
|
// tasks listed in the scheduler's internal taskRegistry.
|
||||||
func (k *framework) makeTaskRegistryReconciler() taskreconciler.ReconcilerAction {
|
func (k *framework) makeTaskRegistryReconciler() taskreconciler.Action {
|
||||||
return taskreconciler.ReconcilerAction(func(drv bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error {
|
return taskreconciler.Action(func(drv bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error {
|
||||||
taskToSlave := make(map[string]string)
|
taskToSlave := make(map[string]string)
|
||||||
for _, t := range k.sched.Tasks().List(explicitTaskFilter) {
|
for _, t := range k.sched.Tasks().List(explicitTaskFilter) {
|
||||||
if t.Spec.SlaveID != "" {
|
if t.Spec.SlaveID != "" {
|
||||||
@ -638,8 +638,8 @@ func (k *framework) makeTaskRegistryReconciler() taskreconciler.ReconcilerAction
|
|||||||
|
|
||||||
// reconciler action factory, performs explicit task reconciliation for non-terminal
|
// reconciler action factory, performs explicit task reconciliation for non-terminal
|
||||||
// tasks identified by annotations in the Kubernetes pod registry.
|
// tasks identified by annotations in the Kubernetes pod registry.
|
||||||
func (k *framework) makePodRegistryReconciler() taskreconciler.ReconcilerAction {
|
func (k *framework) makePodRegistryReconciler() taskreconciler.Action {
|
||||||
return taskreconciler.ReconcilerAction(func(drv bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error {
|
return taskreconciler.Action(func(drv bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error {
|
||||||
podList, err := k.client.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
podList, err := k.client.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return proc.ErrorChanf("failed to reconcile pod registry: %v", err)
|
return proc.ErrorChanf("failed to reconcile pod registry: %v", err)
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/metrics"
|
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ReconcilerAction func(driver bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error
|
type Action func(driver bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error
|
||||||
|
|
||||||
type TasksReconciler interface {
|
type TasksReconciler interface {
|
||||||
RequestExplicit()
|
RequestExplicit()
|
||||||
@ -37,14 +37,14 @@ type TasksReconciler interface {
|
|||||||
|
|
||||||
type tasksReconciler struct {
|
type tasksReconciler struct {
|
||||||
proc.Doer
|
proc.Doer
|
||||||
Action ReconcilerAction
|
Action Action
|
||||||
explicit chan struct{} // send an empty struct to trigger explicit reconciliation
|
explicit chan struct{} // send an empty struct to trigger explicit reconciliation
|
||||||
implicit chan struct{} // send an empty struct to trigger implicit reconciliation
|
implicit chan struct{} // send an empty struct to trigger implicit reconciliation
|
||||||
cooldown time.Duration
|
cooldown time.Duration
|
||||||
explicitReconciliationAbortTimeout time.Duration
|
explicitReconciliationAbortTimeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(doer proc.Doer, action ReconcilerAction,
|
func New(doer proc.Doer, action Action,
|
||||||
cooldown, explicitReconciliationAbortTimeout time.Duration, done <-chan struct{}) TasksReconciler {
|
cooldown, explicitReconciliationAbortTimeout time.Duration, done <-chan struct{}) TasksReconciler {
|
||||||
return &tasksReconciler{
|
return &tasksReconciler{
|
||||||
Doer: doer,
|
Doer: doer,
|
||||||
|
Loading…
Reference in New Issue
Block a user