common

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//KubeEdgeVersion sets the version of KubeEdge to be used
	KubeEdgeVersion = "kubeedge-version"

	//DockerVersion sets the version of Docker to be used
	DockerVersion = "docker-version"

	//KubernetesVersion sets the version of Kuberneted to be used
	KubernetesVersion = "kubernetes-version"

	//KubeConfig sets the path of kubeconfig , default is ""
	KubeConfig = "kube-config"

	//K8SAPIServerIPPort sets the IP:Port of Kubernetes api-server
	K8SAPIServerIPPort = "k8sserverip"

	//EdgeControllerIP sets the IP of KubeEdge edgecontroller cloud component
	EdgeControllerIP = "edgecontrollerip"

	//KubeEdge Node unique idenfitcation string
	EdgeNodeID = "edgenodeid"

	//CertPath sets the path of the certificates generated by the KubeEdge Cloud component
	CertPath = "certPath"

	//DefaultCertPath is the default certificate path in edge node
	DefaultCertPath = "/etc/kubeedge/certs"

	//DefaultKubeEdgeVersion is the current default version of KubeEdge
	DefaultKubeEdgeVersion = "0.3.0"

	//DefaultDockerVersion is the current default version of Docker
	DefaultDockerVersion = "18.06.0"

	//DefaultK8SVersion is the current default version of K8S
	DefaultK8SVersion = "1.14.1"

	// DefaultProjectID is default project id
	DefaultProjectID = "e632aba927ea4ac2b575ec1603d56f10"

	VendorK8sPrefix = "v1.10.9-kubeedge-"

	// RuntimeType is default runtime type
	RuntimeType = "runtimetype"
)

Variables

This section is empty.

Functions

func Write2File

func Write2File(path string, data interface{}) error

Write2File writes data into a file in path

func WriteCloudLoggingYamlFile

func WriteCloudLoggingYamlFile(path string) error

WriteCloudLoggingYamlFile writes logging yaml for cloud component

func WriteCloudModulesYamlFile

func WriteCloudModulesYamlFile(path string) error

WriteCloudModulesYamlFile writes modules.yaml for cloud component

func WriteControllerYamlFile

func WriteControllerYamlFile(path, kubeConfig string) error

WriteControllerYamlFile writes controller.yaml for cloud component

func WriteEdgeLoggingYamlFile

func WriteEdgeLoggingYamlFile(path string) error

WriteEdgeLoggingYamlFile writes logging yaml for edge component

func WriteEdgeModulesYamlFile

func WriteEdgeModulesYamlFile(path string) error

WriteEdgeModulesYamlFile writes modules.yaml for edge component

func WriteEdgeYamlFile

func WriteEdgeYamlFile(path string, modifiedEdgeYaml *EdgeYamlSt) error

WriteEdgeYamlFile write conf/edge.yaml for edge component

Types

type CloudControllerSt

type CloudControllerSt struct {
	Kube KubeEdgeControllerConfig `yaml:"kube"`
}

CloudControllerSt consists information to access api-server @ master

type CloudHubSt

type CloudHubSt struct {
	IPAddress         string `yaml:"address"`
	Port              uint16 `yaml:"port"`
	CA                string `yaml:"ca"`
	Cert              string `yaml:"cert"`
	Key               string `yaml:"key"`
	KeepAliveInterval uint32 `yaml:"keepalive-interval"`
	WriteTimeout      uint32 `yaml:"write-timeout"`
	NodeLimit         uint32 `yaml:"node-limit"`
}

CloudHubSt represents configuration options for http access

type ControllerSt

type ControllerSt struct {
	Placement           bool   `yaml:"placement"`
	Heartbeat           uint32 `yaml:"heartbeat"`
	RefreshAKSKInterval uint16 `yaml:"refresh-ak-sk-interval"`
	AuthInfoFilesPath   string `yaml:"auth-info-files-path"`
	PlacementURL        string `yaml:"placement-url"`
	ProjectID           string `yaml:"project-id"`
	NodeID              string `yaml:"node-id"`
}

ControllerSt contain edgecontroller config which edge component uses

type ControllerYaml

type ControllerYaml struct {
	Controller       CloudControllerSt  `yaml:"controller"`
	CloudHub         CloudHubSt         `yaml:"cloudhub"`
	DeviceController DeviceControllerSt `yaml:"devicecontroller"`
}

ControllerYaml has the edgecontroller yaml configuration/content which shall be written in conf/controller.yaml for cloud component

type DeviceControllerSt

type DeviceControllerSt struct {
	Kube KubeEdgeControllerConfig `yaml:"kube"`
}

DeviceControllerSt consists information to access api-server @ master for Device CRD

type EdgeDSt

type EdgeDSt struct {
	RegisterNodeNamespace             string `yaml:"register-node-namespace"`
	HostnameOverride                  string `yaml:"hostname-override"`
	InterfaceName                     string `yaml:"interface-name"`
	NodeStatusUpdateFrequency         uint16 `yaml:"node-status-update-frequency"`
	DevicePluginEnabled               bool   `yaml:"device-plugin-enabled"`
	GPUPluginEnabled                  bool   `yaml:"gpu-plugin-enabled"`
	ImageGCHighThreshold              uint16 `yaml:"image-gc-high-threshold"`
	ImageGCLowThreshold               uint16 `yaml:"image-gc-low-threshold"`
	MaximumDeadContainersPerContainer uint16 `yaml:"maximum-dead-containers-per-container"`
	DockerAddress                     string `yaml:"docker-address"`
	Version                           string `yaml:"version"`
	EdgedMemory                       uint16 `yaml:"edged-memory-capacity-bytes"`
	RuntimeType                       string `yaml:"runtime-type"`
	RuntimeEndpoint                   string `yaml:"remote-runtime-endpoint"`
	ImageEndpoint                     string `yaml:"remote-image-endpoint"`
	RequestTimeout                    uint16 `yaml:"runtime-request-timeout"`
	PodSandboxImage                   string `yaml:"podsandbox-image"`
}

EdgeDSt contains configuration required by edged module in KubeEdge component

type EdgeHubSt

type EdgeHubSt struct {
	WebSocket  WebSocketSt  `yaml:"websocket"`
	Controller ControllerSt `yaml:"controller"`
}

EdgeHubSt contains both websocket and controller config

type EdgeYamlSt

type EdgeYamlSt struct {
	MQTT    MQTTConfig `yaml:"mqtt"`
	EdgeHub EdgeHubSt  `yaml:"edgehub"`
	EdgeD   EdgeDSt    `yaml:"edged"`
	Mesh    Mesh       `yaml:"mesh"`
}

EdgeYamlSt content is written into conf/edge.yaml

type FlagData

type FlagData struct {
	Val    interface{}
	DefVal interface{}
}

FlagData stores value and default value of the flags used in this command

type InitOptions

type InitOptions struct {
	KubeEdgeVersion   string
	KubernetesVersion string
	DockerVersion     string
	KubeConfig        string
}

InitOptions has the kubeedge cloud init information filled by CLI

type InstallState

type InstallState uint8

InstallState enum set used for verifying a tool version is installed in host

const (
	NewInstallRequired InstallState = iota
	AlreadySameVersionExist
	DefVerInstallRequired
	VersionNAInRepo
)

Difference enum values for type InstallState

type JoinOptions

type JoinOptions struct {
	InitOptions
	CertPath           string
	EdgeControllerIP   string
	K8SAPIServerIPPort string
	EdgeNodeID         string
	RuntimeType        string
}

JoinOptions has the kubeedge cloud init information filled by CLI

type KubeEdgeControllerConfig

type KubeEdgeControllerConfig struct {
	//Master is the url of edge master(kube api server)
	Master string `yaml:"master"`
	//Namespace is the namespace to watch(default is NamespaceAll)
	Namespace string `yaml:"namespace"`
	//ContentType is the content type communicate with edge master(default is "application/vnd.kubernetes.protobuf")
	ContentType string `yaml:"content_type"`
	//QPS is the QPS communicate with edge master(default is 100.0)
	QPS uint `yaml:"qps"`
	//Burst default is 10
	Burst uint `yaml:"burst"`
	//NodeFrequency is the time duration for update node status(default is 20s)
	NodeUpdateFrequency time.Duration `yaml:"node_update_frequency"`
	//KubeConfig is the config used connect to edge master
	KubeConfig string `yaml:"kubeconfig"`
}

KubeEdgeControllerConfig has all the below fields; (data taken from "github.com/kubeedge/kubeedge/cloud/pkg/controller/config/kube.go")

type LoadBalance

type LoadBalance struct {
	StrategyName string `yaml:"strategy-name"`
}

type LoggingYaml

type LoggingYaml struct {
	LoggerLevel   string   `yaml:"loggerLevel,omitempty"`
	EnableRsysLog bool     `yaml:"enableRsyslog,omitempty"`
	LogFormatText bool     `yaml:"logFormatText,omitempty"`
	Writers       []string `yaml:"writers,omitempty"`
	LoggerFile    string   `yaml:"loggerFile,omitempty"`
}

LoggingYaml shall be written in conf/logging.yaml for cloud and edge component

type MQTTConfig

type MQTTConfig struct {
	Server           string      `yaml:"server"`
	InternalServer   string      `yaml:"internal-server"`
	Mode             MQTTMode    `yaml:"mode"`
	QOS              MQTTQoSType `yaml:"qos"`
	Retain           bool        `yaml:"retain"`
	SessionQueueSize uint64      `yaml:"session-queue-size"`
}

MQTTConfig contains MQTT specific config to use MQTT broker

type MQTTMode

type MQTTMode uint8

MQTTMode = # 0: internal mqtt broker enable only. 1: internal and external mqtt broker enable. 2: external mqtt broker enable only.

const (
	MQTTInternalMode MQTTMode = iota
	MQTTInternalExternalMode
	MQTTExternalMode
)

Different message exchange mode supported in KubeEdge using MQTT

type MQTTQoSType

type MQTTQoSType uint8

MQTTQoSType = # 0: QOSAtMostOnce, 1: QOSAtLeastOnce, 2: QOSExactlyOnce.

const (
	MQTTQoSAtMostOnce MQTTQoSType = iota
	MQTTQoSAtLeastOnce
	MQTTQoSExactlyOnce
)

Different MQTT QoS

type Mesh

type Mesh struct {
	LB LoadBalance `yaml:"loadbalance"`
}

type ModuleRunning

type ModuleRunning uint8

ModuleRunning is defined to know the running status of KubeEdge components

const (
	NoneRunning ModuleRunning = iota
	KubeEdgeCloudRunning
	KubeEdgeEdgeRunning
)

Different possible values for ModuleRunning type

type ModulesSt

type ModulesSt struct {
	Enabled []string `yaml:"enabled"`
}

ModulesSt contains the list of modules which shall be added to edgecontroller and edge_core respectively during init

type ModulesYaml

type ModulesYaml struct {
	Modules ModulesSt `yaml:"modules"`
}

ModulesYaml is the module list which shall be written in conf/modules.yaml for cloud and edge component

type NodeDefinition

type NodeDefinition struct {
	Kind       string
	APIVersion string
	MetaData   NodeMetaDataSt
}

NodeDefinition defines

type NodeMetaDataLabels

type NodeMetaDataLabels struct {
	Name string
}

NodeMetaDataLabels defines

type NodeMetaDataSt

type NodeMetaDataSt struct {
	Name   string
	Labels NodeMetaDataLabels
}

NodeMetaDataSt defines

type OSTypeInstaller

type OSTypeInstaller interface {
	IsToolVerInRepo(string, string) (bool, error)
	IsDockerInstalled(string) (InstallState, error)
	InstallDocker() error
	InstallMQTT() error
	IsK8SComponentInstalled(string, string) (InstallState, error)
	InstallK8S() error
	StartK8Scluster() error
	InstallKubeEdge() error
	SetDockerVersion(string)
	SetK8SVersionAndIsNodeFlag(version string, flag bool)
	SetKubeEdgeVersion(string)
	RunEdgeCore() error
	KillKubeEdgeBinary(string) error
	IsKubeEdgeProcessRunning(string) (bool, error)
}

OSTypeInstaller interface for methods to be executed over a specified OS distribution type

type ToolsInstaller

type ToolsInstaller interface {
	InstallTools() error
	TearDown() error
}

ToolsInstaller interface for tools with install and teardown methods.

type WebSocketSt

type WebSocketSt struct {
	URL              string `yaml:"url"`
	CertFile         string `yaml:"certfile"`
	KeyFile          string `yaml:"keyfile"`
	HandshakeTimeout uint16 `yaml:"handshake-timeout"`
	WriteDeadline    uint16 `yaml:"write-deadline"`
	ReadDeadline     uint16 `yaml:"read-deadline"`
}

WebSocketSt contains websocket configurations to communicate between CloudHub and EdgeHub

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL