summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorzhengxinwei <zhengxinwei@huawei.com>2024-01-04 15:27:04 +0800
committerzhengxinwei-f <zhengxinwei@huawei.com>2024-01-16 09:35:44 +0800
commitb1c1c6a8e5442fff2b4d932060648e009f639df1 (patch)
tree575f35f9559894e995060f15b029ff73f2d23282 /pkg
parentnotify the task manager of the task status (diff)
downloadkubeedge-b1c1c6a8e5442fff2b4d932060648e009f639df1.tar.gz
Implement task manager to complete cloud edge task execution
Signed-off-by: zhengxinwei-f <zhengxinwei@huawei.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/apis/componentconfig/cloudcore/v1alpha1/default.go12
-rw-r--r--pkg/apis/componentconfig/cloudcore/v1alpha1/types.go36
-rw-r--r--pkg/apis/fsm/v1alpha1/backup_task.go15
-rw-r--r--pkg/apis/fsm/v1alpha1/fsm.go4
-rw-r--r--pkg/apis/fsm/v1alpha1/rollback_task.go15
-rw-r--r--pkg/apis/fsm/v1alpha1/upgrade_task.go44
-rw-r--r--pkg/apis/operations/v1alpha1/type.go73
-rw-r--r--pkg/apis/operations/v1alpha1/zz_generated.deepcopy.go32
-rw-r--r--pkg/util/fsm/backup_task.go20
-rw-r--r--pkg/util/fsm/fsm.go67
-rw-r--r--pkg/util/fsm/rollback_task.go20
-rw-r--r--pkg/util/fsm/upgrade_task.go29
12 files changed, 182 insertions, 185 deletions
diff --git a/pkg/apis/componentconfig/cloudcore/v1alpha1/default.go b/pkg/apis/componentconfig/cloudcore/v1alpha1/default.go
index 66128ec49..fc1dde0db 100644
--- a/pkg/apis/componentconfig/cloudcore/v1alpha1/default.go
+++ b/pkg/apis/componentconfig/cloudcore/v1alpha1/default.go
@@ -98,14 +98,14 @@ func NewDefaultCloudCoreConfig() *CloudCoreConfig {
UpdateDeviceStatusWorkers: constants.DefaultUpdateDeviceStatusWorkers,
},
},
- NodeUpgradeJobController: &NodeUpgradeJobController{
+ TaskManager: &TaskManager{
Enable: false,
- Buffer: &NodeUpgradeJobControllerBuffer{
- UpdateNodeUpgradeJobStatus: constants.DefaultNodeUpgradeJobStatusBuffer,
- NodeUpgradeJobEvent: constants.DefaultNodeUpgradeJobEventBuffer,
+ Buffer: &TaskManagerBuffer{
+ TaskStatus: constants.DefaultNodeUpgradeJobStatusBuffer,
+ TaskEvent: constants.DefaultNodeUpgradeJobEventBuffer,
},
- Load: &NodeUpgradeJobControllerLoad{
- NodeUpgradeJobWorkers: constants.DefaultNodeUpgradeJobWorkers,
+ Load: &TaskManagerLoad{
+ TaskWorkers: constants.DefaultNodeUpgradeJobWorkers,
},
},
ImagePrePullController: &ImagePrePullController{
diff --git a/pkg/apis/componentconfig/cloudcore/v1alpha1/types.go b/pkg/apis/componentconfig/cloudcore/v1alpha1/types.go
index 955960fe0..02cc77795 100644
--- a/pkg/apis/componentconfig/cloudcore/v1alpha1/types.go
+++ b/pkg/apis/componentconfig/cloudcore/v1alpha1/types.go
@@ -88,10 +88,10 @@ type Modules struct {
EdgeController *EdgeController `json:"edgeController,omitempty"`
// DeviceController indicates DeviceController module config
DeviceController *DeviceController `json:"deviceController,omitempty"`
- // NodeUpgradeJobController indicates NodeUpgradeJobController module config
- NodeUpgradeJobController *NodeUpgradeJobController `json:"nodeUpgradeJobController,omitempty"`
// ImagePrePullController indicates ImagePrePullController module config
ImagePrePullController *ImagePrePullController `json:"imagePrePullController,omitempty"`
+ // TaskManager indicates TaskManager module config
+ TaskManager *TaskManager `json:"taskManager,omitempty"`
// SyncController indicates SyncController module config
SyncController *SyncController `json:"syncController,omitempty"`
// DynamicController indicates DynamicController module config
@@ -381,33 +381,33 @@ type DeviceControllerLoad struct {
UpdateDeviceStatusWorkers int32 `json:"updateDeviceStatusWorkers,omitempty"`
}
-// NodeUpgradeJobController indicates the operations controller
-type NodeUpgradeJobController struct {
- // Enable indicates whether NodeUpgradeJobController is enabled,
- // if set to false (for debugging etc.), skip checking other NodeUpgradeJobController configs.
+// TaskManager indicates the operations controller
+type TaskManager struct {
+ // Enable indicates whether TaskManager is enabled,
+ // if set to false (for debugging etc.), skip checking other TaskManager configs.
// default false
Enable bool `json:"enable"`
// Buffer indicates Operation Controller buffer
- Buffer *NodeUpgradeJobControllerBuffer `json:"buffer,omitempty"`
+ Buffer *TaskManagerBuffer `json:"buffer,omitempty"`
// Load indicates Operation Controller Load
- Load *NodeUpgradeJobControllerLoad `json:"load,omitempty"`
+ Load *TaskManagerLoad `json:"load,omitempty"`
}
-// NodeUpgradeJobControllerBuffer indicates NodeUpgradeJobController buffer
-type NodeUpgradeJobControllerBuffer struct {
- // UpdateNodeUpgradeJobStatus indicates the buffer of update NodeUpgradeJob status
+// TaskManagerBuffer indicates TaskManager buffer
+type TaskManagerBuffer struct {
+ // TaskStatus indicates the buffer of update NodeUpgradeJob status
// default 1024
- UpdateNodeUpgradeJobStatus int32 `json:"updateNodeUpgradeJobStatus,omitempty"`
- // NodeUpgradeJobEvent indicates the buffer of NodeUpgradeJob event
+ TaskStatus int32 `json:"taskStatus,omitempty"`
+ // TaskEvent indicates the buffer of NodeUpgradeJob event
// default 1
- NodeUpgradeJobEvent int32 `json:"nodeUpgradeJobEvent,omitempty"`
+ TaskEvent int32 `json:"taskEvent,omitempty"`
}
-// NodeUpgradeJobControllerLoad indicates the NodeUpgradeJobController load
-type NodeUpgradeJobControllerLoad struct {
- // NodeUpgradeJobWorkers indicates the load of update NodeUpgradeJob workers
+// TaskManagerLoad indicates the TaskManager load
+type TaskManagerLoad struct {
+ // TaskWorkers indicates the load of update NodeUpgradeJob workers
// default 1
- NodeUpgradeJobWorkers int32 `json:"nodeUpgradeJobWorkers,omitempty"`
+ TaskWorkers int32 `json:"taskWorkers,omitempty"`
}
// ImagePrePullController indicates the operations controller
diff --git a/pkg/apis/fsm/v1alpha1/backup_task.go b/pkg/apis/fsm/v1alpha1/backup_task.go
new file mode 100644
index 000000000..9e386bb2f
--- /dev/null
+++ b/pkg/apis/fsm/v1alpha1/backup_task.go
@@ -0,0 +1,15 @@
+package v1alpha1
+
+const (
+ BackingUpState State = "BackingUp"
+)
+
+var BackupRule = map[string]State{
+ "/Init/Success": TaskChecking,
+
+ "Checking/Check/Success": BackingUpState,
+ "Checking/Check/Failure": TaskFailed,
+
+ "BackingUp/Backup/Success": TaskSuccessful,
+ "BackingUp/Backup/Failure": TaskFailed,
+}
diff --git a/pkg/apis/fsm/v1alpha1/fsm.go b/pkg/apis/fsm/v1alpha1/fsm.go
index 93338567b..a122e8890 100644
--- a/pkg/apis/fsm/v1alpha1/fsm.go
+++ b/pkg/apis/fsm/v1alpha1/fsm.go
@@ -20,6 +20,6 @@ const (
)
const (
- ActionInit Action = "Init"
- ActionCheck Action = "Check"
+ ActionSuccess Action = "Success"
+ ActionFailure Action = "Failure"
)
diff --git a/pkg/apis/fsm/v1alpha1/rollback_task.go b/pkg/apis/fsm/v1alpha1/rollback_task.go
new file mode 100644
index 000000000..9443e6ce0
--- /dev/null
+++ b/pkg/apis/fsm/v1alpha1/rollback_task.go
@@ -0,0 +1,15 @@
+package v1alpha1
+
+const (
+ RollingBackState State = "RollingBack"
+)
+
+var RollbackRule = map[string]State{
+ "/Init/Success": TaskChecking,
+
+ "Checking/Check/Success": RollingBackState,
+ "Checking/Check/Failure": TaskFailed,
+
+ "RollingBack/Rollback/Failure": TaskFailed,
+ "RollingBack/Rollback/Success": TaskFailed,
+}
diff --git a/pkg/apis/fsm/v1alpha1/upgrade_task.go b/pkg/apis/fsm/v1alpha1/upgrade_task.go
new file mode 100644
index 000000000..24b5ff3ff
--- /dev/null
+++ b/pkg/apis/fsm/v1alpha1/upgrade_task.go
@@ -0,0 +1,44 @@
+package v1alpha1
+
+const (
+ UpgradingState State = "Upgrading"
+)
+
+// CurrentState/Event/Action: NextState
+var UpgradeRule = map[string]State{
+ "Init/Init/Success": TaskChecking,
+ "Init/Init/Failure": TaskFailed,
+ "Init/TimeOut/Failure": TaskFailed,
+ "Init/Upgrade/Success": TaskSuccessful,
+
+ "Checking/Check/Success": BackingUpState,
+ "Checking/Check/Failure": TaskFailed,
+ "Checking/TimeOut/Failure": TaskFailed,
+
+ "BackingUp/Backup/Success": UpgradingState,
+ "BackingUp/Backup/Failure": TaskFailed,
+ "BackingUp/TimeOut/Failure": TaskFailed,
+
+ "Upgrading/Upgrade/Success": TaskSuccessful,
+ "Upgrading/Upgrade/Failure": RollingBackState,
+ "Upgrading/TimeOut/Failure": RollingBackState,
+
+ "RollingBack/Rollback/Failure": TaskFailed,
+ "RollingBack/TimeOut/Failure": TaskFailed,
+ "RollingBack/Rollback/Success": TaskFailed,
+
+ "Upgrading/Rollback/Failure": TaskFailed,
+ "Upgrading/Rollback/Success": TaskFailed,
+
+ //TODO delete in version 1.18
+ "Init/Rollback/Failure": TaskFailed,
+ "Init/Rollback/Success": TaskFailed,
+}
+
+var UpdateStageSequence = map[State]State{
+ "": TaskChecking,
+ TaskInit: TaskChecking,
+ TaskChecking: BackingUpState,
+ BackingUpState: UpgradingState,
+ UpgradingState: RollingBackState,
+}
diff --git a/pkg/apis/operations/v1alpha1/type.go b/pkg/apis/operations/v1alpha1/type.go
index 1b45d5860..5f2b4396c 100644
--- a/pkg/apis/operations/v1alpha1/type.go
+++ b/pkg/apis/operations/v1alpha1/type.go
@@ -18,6 +18,8 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
)
// +genclient
@@ -58,10 +60,6 @@ type NodeUpgradeJobList struct {
type NodeUpgradeJobSpec struct {
// +Required: Version is the EdgeCore version to upgrade.
Version string `json:"version,omitempty"`
- // UpgradeTool is a request to decide use which upgrade tool. If it is empty,
- // the upgrade job simply use default upgrade tool keadm to do upgrade operation.
- // +optional
- UpgradeTool string `json:"upgradeTool,omitempty"`
// TimeoutSeconds limits the duration of the node upgrade job.
// Default to 300.
// If set to 0, we'll use the default value 300.
@@ -91,29 +89,14 @@ type NodeUpgradeJobSpec struct {
// The default Concurrency value is 1.
// +optional
Concurrency int32 `json:"concurrency,omitempty"`
-}
-
-// UpgradeResult describe the result status of upgrade operation on edge nodes.
-// +kubebuilder:validation:Enum=upgrade_success;upgrade_failed_rollback_success;upgrade_failed_rollback_failed
-type UpgradeResult string
-
-// upgrade operation status
-const (
- UpgradeSuccess UpgradeResult = "upgrade_success"
- UpgradeFailedRollbackSuccess UpgradeResult = "upgrade_failed_rollback_success"
- UpgradeFailedRollbackFailed UpgradeResult = "upgrade_failed_rollback_failed"
-)
-// UpgradeState describe the UpgradeState of upgrade operation on edge nodes.
-// +kubebuilder:validation:Enum=upgrading;completed
-type UpgradeState string
+ // CheckItems specifies the items need to be checked before the task is executed.
+ // The default CheckItems value is nil.
+ // +optional
+ CheckItems []string `json:"checkItems,omitempty"`
-// Valid values of UpgradeState
-const (
- InitialValue UpgradeState = ""
- Upgrading UpgradeState = "upgrading"
- Completed UpgradeState = "completed"
-)
+ FailureTolerate string `json:"failureTolerate,omitempty"`
+}
// NodeUpgradeJobStatus stores the status of NodeUpgradeJob.
// contains multiple edge nodes upgrade status.
@@ -121,37 +104,27 @@ const (
type NodeUpgradeJobStatus struct {
// State represents for the state phase of the NodeUpgradeJob.
// There are three possible state values: "", upgrading and completed.
- State UpgradeState `json:"state,omitempty"`
+ State api.State `json:"state,omitempty"`
+ CurrentVersion string `json:"currentVersion,omitempty"`
+ HistoricVersion string `json:"historicVersion,omitempty"`
+ Event string `json:"event,omitempty"`
+ Action api.Action `json:"action,omitempty"`
+ Reason string `json:"reason,omitempty"`
+ Time string `json:"time,omitempty"`
// Status contains upgrade Status for each edge node.
- Status []UpgradeStatus `json:"status,omitempty"`
+ Status []TaskStatus `json:"nodeStatus,omitempty"`
}
-// UpgradeStatus stores the status of Upgrade for each edge node.
+// TaskStatus stores the status of Upgrade for each edge node.
// +kubebuilder:validation:Type=object
-type UpgradeStatus struct {
+type TaskStatus struct {
// NodeName is the name of edge node.
NodeName string `json:"nodeName,omitempty"`
// State represents for the upgrade state phase of the edge node.
// There are three possible state values: "", upgrading and completed.
- State UpgradeState `json:"state,omitempty"`
- // History is the last upgrade result of the edge node.
- History History `json:"history,omitempty"`
-}
-
-// History stores the information about upgrade history record.
-// +kubebuilder:validation:Type=object
-type History struct {
- // HistoryID is to uniquely identify an Upgrade Operation.
- HistoryID string `json:"historyID,omitempty"`
- // FromVersion is the version which the edge node is upgraded from.
- FromVersion string `json:"fromVersion,omitempty"`
- // ToVersion is the version which the edge node is upgraded to.
- ToVersion string `json:"toVersion,omitempty"`
- // Result represents the result of upgrade.
- Result UpgradeResult `json:"result,omitempty"`
- // Reason is the error reason of Upgrade failure.
- // If the upgrade is successful, this reason is an empty string.
- Reason string `json:"reason,omitempty"`
- // UpgradeTime is the time of this Upgrade.
- UpgradeTime string `json:"upgradeTime,omitempty"`
+ State api.State `json:"state,omitempty"`
+ Event string `json:"event,omitempty"`
+ Action api.Action `json:"action,omitempty"`
+ Time string `json:"time,omitempty"`
+ Reason string `json:"reason,omitempty"`
}
diff --git a/pkg/apis/operations/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/operations/v1alpha1/zz_generated.deepcopy.go
index 8b38fd4ec..4e5dc3a44 100644
--- a/pkg/apis/operations/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/operations/v1alpha1/zz_generated.deepcopy.go
@@ -27,22 +27,6 @@ import (
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *History) DeepCopyInto(out *History) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new History.
-func (in *History) DeepCopy() *History {
- if in == nil {
- return nil
- }
- out := new(History)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImagePrePullJob) DeepCopyInto(out *ImagePrePullJob) {
*out = *in
out.TypeMeta = in.TypeMeta
@@ -300,6 +284,11 @@ func (in *NodeUpgradeJobSpec) DeepCopyInto(out *NodeUpgradeJobSpec) {
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
+ if in.CheckItems != nil {
+ in, out := &in.CheckItems, &out.CheckItems
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
return
}
@@ -318,7 +307,7 @@ func (in *NodeUpgradeJobStatus) DeepCopyInto(out *NodeUpgradeJobStatus) {
*out = *in
if in.Status != nil {
in, out := &in.Status, &out.Status
- *out = make([]UpgradeStatus, len(*in))
+ *out = make([]TaskStatus, len(*in))
copy(*out, *in)
}
return
@@ -335,18 +324,17 @@ func (in *NodeUpgradeJobStatus) DeepCopy() *NodeUpgradeJobStatus {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *UpgradeStatus) DeepCopyInto(out *UpgradeStatus) {
+func (in *TaskStatus) DeepCopyInto(out *TaskStatus) {
*out = *in
- out.History = in.History
return
}
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpgradeStatus.
-func (in *UpgradeStatus) DeepCopy() *UpgradeStatus {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus.
+func (in *TaskStatus) DeepCopy() *TaskStatus {
if in == nil {
return nil
}
- out := new(UpgradeStatus)
+ out := new(TaskStatus)
in.DeepCopyInto(out)
return out
}
diff --git a/pkg/util/fsm/backup_task.go b/pkg/util/fsm/backup_task.go
deleted file mode 100644
index a5332e79f..000000000
--- a/pkg/util/fsm/backup_task.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package fsm
-
-import api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
-
-const (
- BackingUpState api.State = "BackingUp"
- BackupInitState api.State = "BackupInit"
-)
-
-var BackupRule = map[string]api.State{
- "/Init/Init": api.TaskInit,
-
- "Init/Check/Init": api.TaskChecking,
- "Checking/Check/Success": BackupInitState,
- "Checking/Check/Failure": api.TaskFailed,
-
- "BackupInit/Backup/Start": BackingUpState,
- "BackingUp/Backup/Success": api.TaskSuccessful,
- "BackingUp/Backup/Failure": api.TaskFailed,
-}
diff --git a/pkg/util/fsm/fsm.go b/pkg/util/fsm/fsm.go
index 36ab92ebf..5c8300c9e 100644
--- a/pkg/util/fsm/fsm.go
+++ b/pkg/util/fsm/fsm.go
@@ -3,55 +3,70 @@ package fsm
import (
"fmt"
+ "k8s.io/klog/v2"
+
api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
)
type FSM struct {
- id string
- lastState api.State
- currentFunc func(id string) (api.State, error)
- updateFunc func(id string, state api.State, event Event) error
- guard map[string]api.State
+ id string
+ nodeName string
+ lastState api.State
+ currentFunc func(id, nodeName string) (api.State, error)
+ updateFunc func(id, nodeName string, state api.State, event Event) error
+ guard map[string]api.State
+ stageSequence map[api.State]api.State
+}
+
+func (F *FSM) NodeName(nodeName string) *FSM {
+ F.nodeName = nodeName
+ return F
}
type Event struct {
- Type string
- Action api.Action
- Name string
- Error error
+ Type string
+ Action api.Action
+ ErrorMsg string
}
func (e Event) UniqueName() string {
return e.Type + "/" + string(e.Action)
}
-const ()
-
-func (F *FSM) Id(id string) {
+func (F *FSM) ID(id string) *FSM {
F.id = id
+ return F
}
func (F *FSM) LastState(lastState api.State) {
F.lastState = lastState
}
-func (F *FSM) CurrentFunc(currentFunc func(id string) (api.State, error)) {
+func (F *FSM) CurrentFunc(currentFunc func(id, nodeName string) (api.State, error)) *FSM {
F.currentFunc = currentFunc
+ return F
}
-func (F *FSM) UpdateFunc(updateFunc func(id string, state api.State, event Event) error) {
+func (F *FSM) UpdateFunc(updateFunc func(id, nodeName string, state api.State, event Event) error) *FSM {
F.updateFunc = updateFunc
+ return F
}
-func (F *FSM) Guard(guard map[string]api.State) {
+func (F *FSM) Guard(guard map[string]api.State) *FSM {
F.guard = guard
+ return F
+}
+
+func (F *FSM) StageSequence(stageSequence map[api.State]api.State) *FSM {
+ F.stageSequence = stageSequence
+ return F
}
func (F *FSM) CurrentState() (api.State, error) {
if F.currentFunc == nil {
return "", fmt.Errorf("currentFunc is nil")
}
- return F.currentFunc(F.id)
+ return F.currentFunc(F.id, F.nodeName)
}
func (F *FSM) transitCheck(event Event) (api.State, api.State, error) {
@@ -64,7 +79,7 @@ func (F *FSM) transitCheck(event Event) (api.State, api.State, error) {
}
nextState, ok := F.guard[string(currentState)+"/"+event.UniqueName()]
if !ok {
- return "", "", fmt.Errorf("unsupported event")
+ return "", "", fmt.Errorf(string(currentState)+"/"+event.UniqueName(), " unsupported event")
}
return currentState, nextState, nil
}
@@ -82,10 +97,26 @@ func (F *FSM) Transit(event Event) error {
if F.updateFunc == nil {
return fmt.Errorf("updateFunc is nil")
}
- err = F.updateFunc(F.id, nextState, event)
+ err = F.updateFunc(F.id, F.nodeName, nextState, event)
if err != nil {
return err
}
F.lastState = currentState
return nil
}
+
+func TaskFinish(state api.State) bool {
+ return state == api.TaskFailed || state == api.TaskSuccessful
+}
+
+func (F *FSM) TaskStagCompleted(state api.State) bool {
+ currentState, err := F.CurrentState()
+ if err != nil {
+ klog.Error("get %s current state failed: %s", F.id, err.Error())
+ return false
+ }
+ if F.stageSequence[currentState] == state || TaskFinish(state) {
+ return true
+ }
+ return false
+}
diff --git a/pkg/util/fsm/rollback_task.go b/pkg/util/fsm/rollback_task.go
deleted file mode 100644
index 102f69ea9..000000000
--- a/pkg/util/fsm/rollback_task.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package fsm
-
-import api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
-
-const (
- RollingBackState api.State = "RollingBack"
- RollbackInitState api.State = "RollbackInit"
-)
-
-var RollbackRule = map[string]api.State{
- "/Init/Init": api.TaskInit,
-
- "Init/Check/Init": api.TaskChecking,
- "Checking/Check/Success": RollbackInitState,
- "Checking/Check/Failure": api.TaskFailed,
-
- "RollbackInit/Rollback/Start": RollingBackState,
- "RollingBack/Rollback/Failure": api.TaskFailed,
- "RollingBack/Rollback/Success": api.TaskFailed,
-}
diff --git a/pkg/util/fsm/upgrade_task.go b/pkg/util/fsm/upgrade_task.go
deleted file mode 100644
index df492f07d..000000000
--- a/pkg/util/fsm/upgrade_task.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package fsm
-
-import api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
-
-const (
- UpgradingState api.State = "Upgrading"
- UpgradeInitState api.State = "UpgradeInit"
-)
-
-// CurrentState/Event/Action: NextState
-var UpgradeRule = map[string]api.State{
- "/Init/Init": api.TaskInit,
-
- "Init/Check/Init": api.TaskChecking,
- "Checking/Check/Success": BackupInitState,
- "Checking/Check/Failure": api.TaskFailed,
-
- "BackupInit/Backup/Start": BackingUpState,
- "BackingUp/Backup/Success": UpgradeInitState,
- "BackingUp/Backup/Failure": api.TaskFailed,
-
- "UpgradeInit/Upgrade/Start": UpgradingState,
- "Upgrading/Upgrade/Success": api.TaskSuccessful,
- "Upgrading/Upgrade/Failure": RollbackInitState,
-
- "RollbackInit/Rollback/Start": RollingBackState,
- "RollingBack/Rollback/Failure": api.TaskFailed,
- "RollingBack/Rollback/Success": api.TaskFailed,
-}