diff options
| author | shouhong <shouhong.zhang@outlook.com> | 2019-06-06 15:11:26 +0800 |
|---|---|---|
| committer | shouhong <shouhong.zhang@outlook.com> | 2019-06-06 15:11:26 +0800 |
| commit | c781ca89f1d17fe4f062ca9702bc2e9155cf7a08 (patch) | |
| tree | 1167a172764284c3185aa499683184150803a970 | |
| parent | Merge pull request #656 from edisonxiang/fixmsglost (diff) | |
| download | kubeedge-c781ca89f1d17fe4f062ca9702bc2e9155cf7a08.tar.gz | |
move code only used by cloud to cloud project
| -rw-r--r-- | cloud/pkg/controller/config/kube.go | 5 | ||||
| -rw-r--r-- | cloud/pkg/controller/config/types.go | 48 | ||||
| -rw-r--r-- | common/types/types.go | 44 |
3 files changed, 50 insertions, 47 deletions
diff --git a/cloud/pkg/controller/config/kube.go b/cloud/pkg/controller/config/kube.go index c4f33e179..68b8e91db 100644 --- a/cloud/pkg/controller/config/kube.go +++ b/cloud/pkg/controller/config/kube.go @@ -5,11 +5,10 @@ import ( "github.com/kubeedge/beehive/pkg/common/config" "github.com/kubeedge/beehive/pkg/common/log" - "github.com/kubeedge/kubeedge/common/types" ) // Kube container Kubernetes related configuration -var Kube *types.KubeInfo +var Kube *KubeInfo // KubeNodeID for the current node var KubeNodeID string @@ -24,7 +23,7 @@ var KubeUpdateNodeFrequency time.Duration var EdgeSiteEnabled bool func init() { - Kube = types.NewKubeInfo() + Kube = NewKubeInfo() if km, err := config.CONFIG.GetValue("controller.kube.master").ToString(); err != nil { log.LOGGER.Errorf("Controller kube master not set") diff --git a/cloud/pkg/controller/config/types.go b/cloud/pkg/controller/config/types.go new file mode 100644 index 000000000..9cbc8ca47 --- /dev/null +++ b/cloud/pkg/controller/config/types.go @@ -0,0 +1,48 @@ +package config + +import ( + "time" + + "github.com/kubeedge/kubeedge/common/constants" +) + +// KubeInfo contains Kubernetes related configuration +type KubeInfo struct { + // KubeMaster is the url of edge master(kube api server) + KubeMaster string + + // KubeConfig is the config used connect to edge master + KubeConfig string + + // KubeNamespace is the namespace to watch(default is NamespaceAll) + KubeNamespace string + + // KubeContentType is the content type communicate with edge master(default is "application/vnd.kubernetes.protobuf") + KubeContentType string + + // KubeQPS is the QPS communicate with edge master(default is 1024) + KubeQPS float32 + + // KubeBurst default is 10 + KubeBurst int + + // NodeID for the current node + KubeNodeID string + + // NodeName for the current node + KubeNodeName string + + // KubeUpdateNodeFrequency is the time duration for update node status(default is 20s) + KubeUpdateNodeFrequency time.Duration +} + +// NewKubeInfo create KubeInfo struct with default values +func NewKubeInfo() *KubeInfo { + return &KubeInfo{ + KubeNamespace: constants.DefaultKubeNamespace, + KubeContentType: constants.DefaultKubeContentType, + KubeQPS: constants.DefaultKubeQPS, + KubeBurst: constants.DefaultKubeBurst, + KubeUpdateNodeFrequency: constants.DefaultKubeUpdateNodeFrequency * time.Second, + } +} diff --git a/common/types/types.go b/common/types/types.go index fb6e7faab..7ac2d054c 100644 --- a/common/types/types.go +++ b/common/types/types.go @@ -1,9 +1,6 @@ package types import ( - "time" - - "github.com/kubeedge/kubeedge/common/constants" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" @@ -29,44 +26,3 @@ type NodeStatusRequest struct { Status v1.NodeStatus ExtendResources map[v1.ResourceName][]ExtendResource } - -// KubeInfo contains Kubernetes related configuration -type KubeInfo struct { - // KubeMaster is the url of edge master(kube api server) - KubeMaster string - - // KubeConfig is the config used connect to edge master - KubeConfig string - - // KubeNamespace is the namespace to watch(default is NamespaceAll) - KubeNamespace string - - // KubeContentType is the content type communicate with edge master(default is "application/vnd.kubernetes.protobuf") - KubeContentType string - - // KubeQPS is the QPS communicate with edge master(default is 1024) - KubeQPS float32 - - // KubeBurst default is 10 - KubeBurst int - - // NodeID for the current node - KubeNodeID string - - // NodeName for the current node - KubeNodeName string - - // KubeUpdateNodeFrequency is the time duration for update node status(default is 20s) - KubeUpdateNodeFrequency time.Duration -} - -// NewKubeInfo create KubeInfo struct with default values -func NewKubeInfo() *KubeInfo { - return &KubeInfo{ - KubeNamespace: constants.DefaultKubeNamespace, - KubeContentType: constants.DefaultKubeContentType, - KubeQPS: constants.DefaultKubeQPS, - KubeBurst: constants.DefaultKubeBurst, - KubeUpdateNodeFrequency: constants.DefaultKubeUpdateNodeFrequency * time.Second, - } -} |
