summaryrefslogtreecommitdiff
path: root/common/types/types.go
blob: dfe14dad15fdfd7f8f9a57e380fbfb828b2fc693 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package types

import (
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"

	api "github.com/kubeedge/kubeedge/pkg/apis/fsm/v1alpha1"
	"github.com/kubeedge/kubeedge/pkg/apis/operations/v1alpha1"
)

// PodStatusRequest is Message.Content which comes from edge
type PodStatusRequest struct {
	UID    types.UID
	Name   string
	Status v1.PodStatus
}

// ExtendResource is the extended resource detail that comes from edge
type ExtendResource struct {
	Name     string            `json:"name,omitempty"`
	Type     string            `json:"type,omitempty"`
	Capacity resource.Quantity `json:"capacity,omitempty"`
}

// NodeStatusRequest is Message.Content which comes from edge
type NodeStatusRequest struct {
	UID             types.UID
	Status          v1.NodeStatus
	ExtendResources map[v1.ResourceName][]ExtendResource
}

// NodeUpgradeJobRequest is upgrade msg coming from cloud to edge
type NodeUpgradeJobRequest struct {
	UpgradeID   string
	HistoryID   string
	Version     string
	UpgradeTool string
	Image       string
}

// NodeUpgradeJobResponse is used to report status msg to cloudhub https service
type NodeUpgradeJobResponse struct {
	UpgradeID   string
	HistoryID   string
	NodeName    string
	FromVersion string
	ToVersion   string
	Status      string
	Reason      string
}

// NodePreCheckRequest is pre-check msg coming from cloud to edge
type NodePreCheckRequest struct {
	CheckItem []string
}

type NodeTaskRequest struct {
	TaskID string
	Type   string
	State  string
	Item   interface{}
}

type NodeTaskResponse struct {
	// NodeName is the name of edge node.
	NodeName string
	// State represents for the upgrade state phase of the edge node.
	// There are several possible state values: "", Upgrading, BackingUp, RollingBack and Checking.
	State api.State
	// Event represents for the event of the ImagePrePullJob.
	// There are three possible event values: Init, Check, Pull.
	Event string
	// Action represents for the action of the ImagePrePullJob.
	// There are three possible action values: Success, Failure, TimeOut.
	Action api.Action
	// Reason represents for the reason of the ImagePrePullJob.
	Reason string
	// Time represents for the running time of the ImagePrePullJob.
	Time string

	ExternalMessage string
}

// ObjectResp is the object that api-server response
type ObjectResp struct {
	Object metaV1.Object
	Err    error
}

// ImagePrePullJobRequest is image prepull msg from cloud to edge
type ImagePrePullJobRequest struct {
	Images     []string
	NodeName   string
	Secret     string
	RetryTimes int32
	CheckItems []string
}

// ImagePrePullJobResponse is used to report status msg to cloudhub https service from each node
type ImagePrePullJobResponse struct {
	NodeName    string
	State       string
	Reason      string
	ImageStatus []v1alpha1.ImageStatus
}