Documentation ¶
Index ¶
- Constants
- Variables
- func Write2File(path string, data interface{}) error
- func WriteCloudModulesYamlFile(path string) error
- func WriteControllerYamlFile(path, kubeConfig string) error
- func WriteEdgeModulesYamlFile(path string) error
- func WriteEdgeYamlFile(path string, modifiedEdgeYaml *EdgeYamlSt) error
- type CheckObject
- type CheckOptions
- type CloudCoreYaml
- type CloudHubSt
- type CollectOptions
- type ComponentType
- type ControllerKubeConfig
- type ControllerSt
- type DeviceControllerSt
- type DiagnoseObject
- type DiagnoseOptions
- type EdgeControllerSt
- type EdgeDSt
- type EdgeHubSt
- type EdgeYamlSt
- type FlagData
- type GettokenOptions
- type InitOptions
- type InstallOptions
- type InstallState
- type JoinOptions
- type LoadBalance
- type MQTTConfig
- type MQTTMode
- type MQTTQoSType
- type Mesh
- type ModuleRunning
- type ModulesSt
- type ModulesYaml
- type NodeDefinition
- type NodeMetaDataLabels
- type NodeMetaDataSt
- type OSTypeInstaller
- type ResetOptions
- type ToolsInstaller
- type WebSocketSt
Constants ¶
const ( // KubeEdgeVersion sets the version of KubeEdge to be used KubeEdgeVersion = "kubeedge-version" // KubernetesVersion sets the version of Kuberneted to be used KubernetesVersion = "kubernetes-version" // KubeConfig sets the path of kubeconfig KubeConfig = "kube-config" // Master sets the address of K8s master Master = "master" // CloudCoreIPPort sets the IP and port of KubeEdge cloud component CloudCoreIPPort = "cloudcore-ipport" // KubeEdge Node unique idenfitcation string EdgeNodeName = "edgenode-name" // KubeEdge remote-runtime-endpoint string RemoteRuntimeEndpoint = "remote-runtime-endpoint" // 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" // DefaultK8SMinimumVersion is the minimum version of K8S DefaultK8SMinimumVersion = 11 // DefaultKubeConfig is the default path of kubeconfig DefaultKubeConfig = "/root/.kube/config" // DefaultProjectID is default project id DefaultProjectID = "e632aba927ea4ac2b575ec1603d56f10" // RuntimeType is default runtime type RuntimeType = "runtimetype" // DefaultKubeEdgeVersion is the default KubeEdge version DefaultKubeEdgeVersion = "1.5.0" // Token sets the token used when edge applying for the certificate Token = "token" // HttpServer sets the port where to apply for the edge certificate CertPort = "certport" AdvertiseAddress = "advertise-address" TokenSecretName = "tokensecret" TokenDataName = "tokendata" DomainName = "domainname" // CGroupDriver is type of edgecore Cgroup CGroupDriver = "cgroupdriver" // TarballPath sets the temp directory path for KubeEdge tarball, if not exist, download it // eg. "/tmp/kubeedge" or "/etc/kubeedge" by default TarballPath = "tarballpath" StrCheck = "check" StrDiagnose = "diagnose" CmdGetDNSIP = "cat /etc/resolv.conf | grep nameserver | grep -v -E ':|#' | awk '{print $2}' | head -n1" CmdGetStatusDocker = "systemctl status docker |grep Active | awk '{print $2}'" CmdPing = "ping %s -w %d |grep 'packets transmitted' |awk '{print $6}'" CmdGetMaxProcessNum = "sysctl kernel.pid_max|awk '{print $3}'" CmdGetProcessNum = "ps -A|wc -l" EdgecoreConfig = "config" EdgeCoreServer = "127.0.0.1:10350" // Default edgecore config path EdgecoreConfigPath = "/etc/kubeedge/config/edgecore.yaml" // cmd to copy file CmdCopyFile = "cp -r %s %s/" /*system info*/ CmdDiskInfo = "df -h > %s/disk" CmdArchInfo = "arch > %s/arch" CmdProcessInfo = "ps -axu > %s/process" CmdDateInfo = "date > %s/date" CmdUptimeInfo = "uptime > %s/uptime" CmdHistorynfo = "history -a && cat ~/.bash_history > %s/history" CmdNetworkInfo = "netstat -pan > %s/network" PathCpuinfo = "/proc/cpuinfo" PathMemory = "/proc/meminfo" PathHosts = "/etc/hosts" PathDNSResolv = "/etc/resolv.conf" /*edgecore info*/ PathEdgecoreService = "/lib/systemd/system/edgecore.service" CmdEdgecoreVersion = "edgecore --version > %s/version" /*runtime info*/ CmdDockerVersion = "docker version > %s/version" CmdContainerInfo = "docker ps -a > %s/containerInfo" CmdContainerLogInfo = "journalctl -u docker > %s/log" CmdDockerInfo = "docker info > %s/info" CmdDockerImageInfo = "docker images > %s/images" PathDockerService = "/lib/systemd/system/docker.service" DescAll = "Check all item" DescArch = "Check whether the architecture can work" DescCPU = "Check node CPU requirements" DescMemory = "Check node memory requirements" Descdisk = "Check node disk requirements" DescDNS = "Check whether DNS can work" DescRuntime = "Check whether runtime can work" DescNetwork = "Check whether the network is normal" DescPID = "Check node PID requirements" /**Diagnose**/ ArgDiagnoseAll = "all" DescDiagnoseAll = "Diagnose all iteams" ArgDiagnoseNode = "node" DescDiagnoseNode = "Diagnose edge node" ArgDiagnosePod = "pod" DescDiagnosePod = "Diagnose pod" ArgDiagnoseInstall = "install" DescDiagnoseInstall = "Diagnose install" ArgCheckAll = "all" ArgCheckArch = "arch" ArgCheckCPU = "cpu" ArgCheckMemory = "mem" ArgCheckDisk = "disk" ArgCheckDNS = "dns" ArgCheckRuntime = "runtime" ArgCheckNetwork = "network" ArgCheckPID = "pid" DefaultRuntime = "docker" KB = 1024 MB = KB * 1024 GB = MB * 1024 AllowedValueCPU = 1 AllowedValueMemory = 256 * MB AllowedValueDisk = GB AllowedValuePIDRate = 0.05 AllowedCurrentValueCPURate = 0.9 AllowedCurrentValueMemRate = 0.9 AllowedCurrentValueDiskRate = 0.9 AllowedCurrentValueMem = 128 * MB AllowedCurrentValueDisk = 512 * MB )
Variables ¶
var ( AllowedValueArch = []string{"amd64", "arm64v8", "arm32v7", "i386", "s390x", "x86_64", "aarch64"} CheckObjectMap = []CheckObject{ { Use: ArgCheckAll, Desc: DescAll, }, { Use: ArgCheckCPU, Desc: DescCPU, }, { Use: ArgCheckMemory, Desc: DescMemory, }, { Use: ArgCheckDisk, Desc: Descdisk, }, { Use: ArgCheckDNS, Desc: DescDNS, }, { Use: ArgCheckRuntime, Desc: DescRuntime, }, { Use: ArgCheckNetwork, Desc: DescNetwork, }, { Use: ArgCheckPID, Desc: DescPID, }, } DiagnoseObjectMap = []DiagnoseObject{ { Use: ArgDiagnoseNode, Desc: DescDiagnoseNode, }, { Use: ArgDiagnosePod, Desc: DescDiagnosePod, }, { Use: ArgDiagnoseInstall, Desc: DescDiagnoseInstall, }, } )
Functions ¶
func Write2File ¶
Write2File writes data into a file in path
func WriteCloudModulesYamlFile ¶
WriteCloudModulesYamlFile writes modules.yaml for cloud component
func WriteControllerYamlFile ¶
WriteControllerYamlFile writes controller.yaml for cloud component
func WriteEdgeModulesYamlFile ¶
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 CheckObject ¶
type CheckOptions ¶
type CloudCoreYaml ¶
type CloudCoreYaml struct { EdgeController EdgeControllerSt `yaml:"controller"` CloudHub CloudHubSt `yaml:"cloudhub"` DeviceController DeviceControllerSt `yaml:"devicecontroller"` }
CloudCoreYaml has the edgecontroller yaml configuration/content which shall be written in conf/controller.yaml for cloud component
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 CollectOptions ¶
CollectOptions has the kubeedge debug collect information filled by CLI
type ComponentType ¶
type ComponentType string
ModuleRunning is defined to know the running status of KubeEdge components
const ( CloudCore ComponentType = "cloudcore" EdgeCore ComponentType = "edgecore" )
All Component type
type ControllerKubeConfig ¶
type ControllerKubeConfig 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"` }
ControllerKubeConfig has all the below fields; (data taken from "github.com/kubeedge/kubeedge/cloud/pkg/edgecontroller/config/kube.go")
type ControllerSt ¶
type ControllerSt struct { Heartbeat uint32 `yaml:"heartbeat"` ProjectID string `yaml:"project-id"` NodeID string `yaml:"node-id"` }
ControllerSt contain edgecontroller config which edge component uses
type DeviceControllerSt ¶
type DeviceControllerSt struct {
Kube ControllerKubeConfig `yaml:"kube"`
}
DeviceControllerSt consists information to access api-server @ master for Device CRD
type DiagnoseObject ¶
type DiagnoseOptions ¶
type DiagnoseOptions struct { Pod string Namespace string Config string CheckOptions *CheckOptions DBPath string }
type EdgeControllerSt ¶
type EdgeControllerSt struct {
Kube ControllerKubeConfig `yaml:"kube"`
}
EdgeControllerSt consists information to access api-server @ master
type EdgeDSt ¶
type EdgeDSt struct { RegisterNodeNamespace string `yaml:"register-node-namespace"` HostnameOverride string `yaml:"hostname-override"` 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"` 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"` ConcurrentConsumers int `yaml:"concurrent-consumers"` }
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 GettokenOptions ¶
type GettokenOptions struct {
Kubeconfig string
}
type InitOptions ¶
type InitOptions struct { KubeEdgeVersion string KubeConfig string Master string AdvertiseAddress string DNS string TarballPath string }
InitOptions has the kubeedge cloud init information filled by CLI
type InstallOptions ¶
type InstallOptions struct { ComponentType ComponentType TarballPath string }
InstallOptions is defined to know the options for installing kubeedge
type InstallState ¶
type InstallState uint8
InstallState enum set used for verifying a tool version is installed in host
const ( NewInstallRequired InstallState = iota AlreadySameVersionExist ExitError )
Difference enum values for type InstallState
type JoinOptions ¶
type JoinOptions struct { InitOptions CertPath string CloudCoreIPPort string EdgeNodeName string RuntimeType string RemoteRuntimeEndpoint string Token string CertPort string CGroupDriver string }
JoinOptions has the kubeedge cloud init information filled by CLI
type LoadBalance ¶
type LoadBalance struct {
StrategyName string `yaml:"strategy-name"`
}
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.
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 cloudcore and edgecore 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 NodeMetaDataSt ¶
type NodeMetaDataSt struct { Name string Labels NodeMetaDataLabels }
NodeMetaDataSt defines
type OSTypeInstaller ¶
type OSTypeInstaller interface { InstallMQTT() error IsK8SComponentInstalled(string, string) error SetKubeEdgeVersion(version semver.Version) InstallKubeEdge(InstallOptions) error RunEdgeCore() error KillKubeEdgeBinary(string) error IsKubeEdgeProcessRunning(string) (bool, error) IsProcessRunning(string) (bool, error) }
OSTypeInstaller interface for methods to be executed over a specified OS distribution type
type ResetOptions ¶
type ToolsInstaller ¶
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