Documentation ¶
Overview ¶
Copyright 2019 The KubeEdge Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func AddToolVals(f *pflag.Flag, flagData map[string]types.FlagData)
- func BuildConfig(kubeConfig, master string) (conf *rest.Config, err error)
- func CheckIfAvailable(val, defval string) string
- func Compress(tarName string, paths []string) (err error)
- func ExecShellFilter(c string) (string, error)
- func FileExists(path string) bool
- func GetLatestVersion() (string, error)
- func GetOSInterface() types.OSTypeInstaller
- func GetPackageManager() string
- func IsContain(items []string, item string) bool
- func KubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
- func ParseEdgecoreConfig(edgecorePath string) (*v1alpha1.EdgeCoreConfig, error)
- func PrintFail(cmd string, s string)
- func PrintSucceed(cmd string, s string)
- func RunningModule() (types.ModuleRunning, error)
- type Command
- type Common
- type DebOS
- func (d *DebOS) InstallKubeEdge(options types.InstallOptions) error
- func (d *DebOS) InstallMQTT() error
- func (d *DebOS) IsK8SComponentInstalled(kubeConfig, master string) error
- func (d *DebOS) IsKubeEdgeProcessRunning(proc string) (bool, error)
- func (d *DebOS) IsProcessRunning(proc string) (bool, error)
- func (d *DebOS) KillKubeEdgeBinary(proc string) error
- func (d *DebOS) RunEdgeCore() error
- func (d *DebOS) SetKubeEdgeVersion(version semver.Version)
- type K8SInstTool
- type KubeCloudInstTool
- type KubeEdgeInstTool
- type MQTTInstTool
- type PacmanOS
- func (o *PacmanOS) InstallKubeEdge(options types.InstallOptions) error
- func (o *PacmanOS) InstallMQTT() error
- func (o *PacmanOS) IsK8SComponentInstalled(kubeConfig, master string) error
- func (o *PacmanOS) IsKubeEdgeProcessRunning(proc string) (bool, error)
- func (o *PacmanOS) IsProcessRunning(proc string) (bool, error)
- func (o *PacmanOS) KillKubeEdgeBinary(proc string) error
- func (o *PacmanOS) RunEdgeCore() error
- func (o *PacmanOS) SetKubeEdgeVersion(version semver.Version)
- type RpmOS
- func (r *RpmOS) InstallKubeEdge(options types.InstallOptions) error
- func (r *RpmOS) InstallMQTT() error
- func (r *RpmOS) IsK8SComponentInstalled(kubeConfig, master string) error
- func (r *RpmOS) IsKubeEdgeProcessRunning(proc string) (bool, error)
- func (r *RpmOS) IsProcessRunning(proc string) (bool, error)
- func (r *RpmOS) KillKubeEdgeBinary(proc string) error
- func (r *RpmOS) RunEdgeCore() error
- func (r *RpmOS) SetKubeEdgeVersion(version semver.Version)
Constants ¶
const ( KubeEdgeDownloadURL = "https://github.com/kubeedge/kubeedge/releases/download" EdgeServiceFile = "edgecore.service" CloudServiceFile = "cloudcore.service" ServiceFileURLFormat = "https://raw.githubusercontent.com/kubeedge/kubeedge/release-%s/build/tools/%s" KubeEdgePath = "/etc/kubeedge/" KubeEdgeUsrBinPath = "/usr/local/bin" KubeEdgeBinaryName = "edgecore" KubeCloudBinaryName = "cloudcore" KubeEdgeConfigDir = KubeEdgePath + "config/" KubeEdgeCloudCoreNewYaml = KubeEdgeConfigDir + "cloudcore.yaml" KubeEdgeEdgeCoreNewYaml = KubeEdgeConfigDir + "edgecore.yaml" KubeEdgeLogPath = "/var/log/kubeedge/" KubeEdgeCrdPath = KubeEdgePath + "crds" KubeEdgeSocketPath = "/var/lib/kubeedge/" EdgeRootDir = "/var/lib/edged" SystemdBootPath = "/run/systemd/system" KubeEdgeCRDDownloadURL = "https://raw.githubusercontent.com/kubeedge/kubeedge/release-%s/build/crds" RetryTimes = 5 OSArchAMD64 string = "amd64" OSArchARM64 string = "arm64" OSArchARM32 string = "arm" APT string = "apt" YUM string = "yum" PACMAN string = "pacman" )
Constants used by installers
Variables ¶
This section is empty.
Functions ¶
func AddToolVals ¶
AddToolVals gets the value and default values of each flags and collects them in temporary cache
func BuildConfig ¶
build Config from flags
func CheckIfAvailable ¶
CheckIfAvailable checks is val of a flag is empty then return the default value
func ExecShellFilter ¶
Execute shell script and filter
func FileExists ¶
func GetLatestVersion ¶
GetLatestVersion return the latest non-prerelease, non-draft version of kubeedge in releases
func GetOSInterface ¶
func GetOSInterface() types.OSTypeInstaller
GetOSInterface helps in returning OS specific object which implements OSTypeInstaller interface.
func GetPackageManager ¶
func GetPackageManager() string
GetPackageManager get package manager of OS
func KubeClient ¶
func KubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
KubeClient from config
func ParseEdgecoreConfig ¶
func ParseEdgecoreConfig(edgecorePath string) (*v1alpha1.EdgeCoreConfig, error)
func RunningModule ¶
func RunningModule() (types.ModuleRunning, error)
RunningModule identifies cloudcore/edgecore running or not.
Types ¶
type Command ¶
Command defines commands to be executed and captures std out and std error
func NewCommand ¶
func (*Command) Exec ¶
Exec run command and exit formatted error, callers can print err directly Any running error or non-zero exitcode is consider as error
func (Command) GetCommand ¶
type Common ¶
type Common struct { types.OSTypeInstaller OSVersion string ToolVersion semver.Version KubeConfig string Master string }
Common struct contains OS and Tool version properties and also embeds OS interface
func (*Common) SetOSInterface ¶
func (co *Common) SetOSInterface(intf types.OSTypeInstaller)
SetOSInterface defines a method to set the implemtation of the OS interface
type DebOS ¶
type DebOS struct { KubeEdgeVersion semver.Version IsEdgeNode bool //True - Edgenode False - Cloudnode }
DebOS struct objects shall have information of the tools version to be installed on Hosts having Ubuntu OS. It implements OSTypeInstaller interface
func (*DebOS) InstallKubeEdge ¶
func (d *DebOS) InstallKubeEdge(options types.InstallOptions) error
InstallKubeEdge downloads the provided version of KubeEdge. Untar's in the specified location /etc/kubeedge/ and then copies the binary to excecutables' path (eg: /usr/local/bin)
func (*DebOS) InstallMQTT ¶
InstallMQTT checks if MQTT is already installed and running, if not then install it from OS repo
func (*DebOS) IsK8SComponentInstalled ¶
IsK8SComponentInstalled checks if said K8S version is already installed in the host
func (*DebOS) IsKubeEdgeProcessRunning ¶
IsKubeEdgeProcessRunning checks if the given process is running or not
func (*DebOS) KillKubeEdgeBinary ¶
KillKubeEdgeBinary will search for KubeEdge process and forcefully kill it
func (*DebOS) RunEdgeCore ¶
RunEdgeCore starts edgecore with logs being captured
func (*DebOS) SetKubeEdgeVersion ¶
SetKubeEdgeVersion sets the KubeEdge version for the objects instance
type K8SInstTool ¶
type K8SInstTool struct {
Common
}
K8SInstTool embedes Common struct and contains the default K8S version and a flag depicting if host is an edge or cloud node It implements ToolsInstaller interface
func (*K8SInstTool) InstallTools ¶
func (ks *K8SInstTool) InstallTools() error
InstallTools sets the OS interface, checks if K8S installation is required or not. If required then install the said version.
func (*K8SInstTool) TearDown ¶
func (ks *K8SInstTool) TearDown() error
TearDown shoud uninstall K8S, but it is not required either for cloud or edge node. It is defined so that K8SInstTool implements ToolsInstaller interface
type KubeCloudInstTool ¶
KubeCloudInstTool embedes Common struct It implements ToolsInstaller interface
func (*KubeCloudInstTool) InstallTools ¶
func (cu *KubeCloudInstTool) InstallTools() error
InstallTools downloads KubeEdge for the specified version and makes the required configuration changes and initiates cloudcore.
func (*KubeCloudInstTool) RunCloudCore ¶
func (cu *KubeCloudInstTool) RunCloudCore() error
RunCloudCore starts cloudcore process
func (*KubeCloudInstTool) TearDown ¶
func (cu *KubeCloudInstTool) TearDown() error
TearDown method will remove the edge node from api-server and stop cloudcore process
type KubeEdgeInstTool ¶
type KubeEdgeInstTool struct { Common CertPath string CloudCoreIP string EdgeNodeName string RuntimeType string RemoteRuntimeEndpoint string Token string CertPort string CGroupDriver string TarballPath string }
KubeEdgeInstTool embedes Common struct and contains cloud node ip:port information It implements ToolsInstaller interface
func (*KubeEdgeInstTool) InstallTools ¶
func (ku *KubeEdgeInstTool) InstallTools() error
InstallTools downloads KubeEdge for the specified verssion and makes the required configuration changes and initiates edgecore.
func (*KubeEdgeInstTool) TearDown ¶
func (ku *KubeEdgeInstTool) TearDown() error
TearDown method will remove the edge node from api-server and stop edgecore process
type MQTTInstTool ¶
type MQTTInstTool struct {
Common
}
MQTTInstTool embedes Common struct and It implements ToolsInstaller interface
func (*MQTTInstTool) InstallTools ¶
func (m *MQTTInstTool) InstallTools() error
InstallTools sets the OS interface, it simply installs the said version
func (*MQTTInstTool) TearDown ¶
func (m *MQTTInstTool) TearDown() error
TearDown shoud uninstall MQTT, but it is not required either for cloud or edge node. It is defined so that MQTTInstTool implements ToolsInstaller interface
type PacmanOS ¶
PacmanOS struct objects shall have information of the tools version to be installed on Hosts having PacmanOS. It implements OSTypeInstaller interface
func (*PacmanOS) InstallKubeEdge ¶
func (o *PacmanOS) InstallKubeEdge(options types.InstallOptions) error
InstallKubeEdge downloads the provided version of KubeEdge. Untar's in the specified location /etc/kubeedge/ and then copies the binary to excecutables' path (eg: /usr/local/bin)
func (*PacmanOS) InstallMQTT ¶
InstallMQTT checks if MQTT is already installed and running, if not then install it from OS repo
func (*PacmanOS) IsK8SComponentInstalled ¶
IsK8SComponentInstalled checks if said K8S version is already installed in the host
func (*PacmanOS) IsKubeEdgeProcessRunning ¶
IsKubeEdgeProcessRunning checks if the given process is running or not
func (*PacmanOS) IsProcessRunning ¶
IsKubeEdgeProcessRunning checks if the given process is running or not
func (*PacmanOS) KillKubeEdgeBinary ¶
KillKubeEdgeBinary will search for KubeEdge process and forcefully kill it
func (*PacmanOS) RunEdgeCore ¶
RunEdgeCore sets the environment variable GOARCHAIUS_CONFIG_PATH for the configuration path and the starts edgecore with logs being captured
func (*PacmanOS) SetKubeEdgeVersion ¶
SetKubeEdgeVersion sets the KubeEdge version for the objects instance
type RpmOS ¶
type RpmOS struct { KubeEdgeVersion semver.Version IsEdgeNode bool //True - Edgenode False - Cloudnode }
RpmOS struct objects shall have information of the tools version to be installed on Hosts having RpmOS OS. It implements OSTypeInstaller interface
func (*RpmOS) InstallKubeEdge ¶
func (r *RpmOS) InstallKubeEdge(options types.InstallOptions) error
InstallKubeEdge downloads the provided version of KubeEdge. Untar's in the specified location /etc/kubeedge/ and then copies the binary to excecutables' path (eg: /usr/local/bin)
func (*RpmOS) InstallMQTT ¶
InstallMQTT checks if MQTT is already installed and running, if not then install it from OS repo Information is used from https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-centos-7
func (*RpmOS) IsK8SComponentInstalled ¶
IsK8SComponentInstalled checks if said K8S version is already installed in the host
func (*RpmOS) IsKubeEdgeProcessRunning ¶
IsKubeEdgeProcessRunning checks if the given process is running or not
func (*RpmOS) IsProcessRunning ¶
IsKubeEdgeProcessRunning checks if the given process is running or not
func (*RpmOS) KillKubeEdgeBinary ¶
KillKubeEdgeBinary will search for KubeEdge process and forcefully kill it
func (*RpmOS) RunEdgeCore ¶
RunEdgeCore starts edgecore with logs being captured
func (*RpmOS) SetKubeEdgeVersion ¶
SetKubeEdgeVersion sets the KubeEdge version for the objects instance