Skip to content

Commit

Permalink
ensure PodReplaceHandler and KruiseRestartHandler is good to register
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdsteelRail committed Jul 16, 2024
1 parent 6a4f0d0 commit 0f88a43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controllers/operationjob/opscontrol/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var actionRegistry map[string]ActionHandler
var lifecycleAdapterRegistry map[string]podopslifecycle.LifecycleAdapter

// RegisterAction will register an operationJob action with handler and lifecycleAdapter
// NOTE: if the operation can be done without protection of podOpsLifecycle, just register lifecycleAdapter with 'nil'
// Note: if lifecycleAdapter = nil, this operation will be done directly, ignoring podOpsLifecycle
func RegisterAction(action string, handler ActionHandler, lifecycleAdapter podopslifecycle.LifecycleAdapter) {
if actionRegistry == nil {
actionRegistry = make(map[string]ActionHandler)
Expand Down
2 changes: 2 additions & 0 deletions pkg/controllers/operationjob/replace/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
. "kusionstack.io/operating/pkg/controllers/operationjob/opscontrol"
)

var _ ActionHandler = &PodReplaceHandler{}

type PodReplaceHandler struct {
PodControl podcontrol.Interface
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/controllers/operationjob/restart/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
"kusionstack.io/operating/pkg/utils/inject"
)

var _ ActionHandler = &KruiseRestartHandler{}

type KruiseRestartHandler struct{}

func (p *KruiseRestartHandler) OperateTarget(ctx context.Context, c client.Client, operationJob *appsv1alpha1.OperationJob, recorder record.EventRecorder, candidate *OpsCandidate) error {
Expand Down

0 comments on commit 0f88a43

Please sign in to comment.