Documentation ¶
Index ¶
- Constants
- type InfraDriver
- type SSHInfraDriver
- func (d *SSHInfraDriver) AddClusterEnv(envs []string)
- func (d *SSHInfraDriver) Cmd(host net.IP, env map[string]interface{}, cmd string) ([]byte, error)
- func (d *SSHInfraDriver) CmdAsync(host net.IP, env map[string]interface{}, cmd ...string) error
- func (d *SSHInfraDriver) CmdToString(host net.IP, env map[string]interface{}, cmd, spilt string) (string, error)
- func (d *SSHInfraDriver) Copy(host net.IP, localFilePath, remoteFilePath string) error
- func (d *SSHInfraDriver) CopyR(host net.IP, remoteFilePath, localFilePath string) error
- func (d *SSHInfraDriver) DeleteClusterHostAliases(hosts []net.IP) error
- func (d *SSHInfraDriver) Execute(hosts []net.IP, f func(host net.IP) error) error
- func (d *SSHInfraDriver) GetClusterBasePath() string
- func (d *SSHInfraDriver) GetClusterEnv() map[string]interface{}
- func (d *SSHInfraDriver) GetClusterImageName() string
- func (d *SSHInfraDriver) GetClusterLaunchApps() []string
- func (d *SSHInfraDriver) GetClusterLaunchCmds() []string
- func (d *SSHInfraDriver) GetClusterName() string
- func (d *SSHInfraDriver) GetClusterRegistry() v2.Registry
- func (d *SSHInfraDriver) GetClusterRootfsPath() string
- func (d *SSHInfraDriver) GetHostEnv(host net.IP) map[string]interface{}
- func (d *SSHInfraDriver) GetHostIPList() []net.IP
- func (d *SSHInfraDriver) GetHostIPListByRole(role string) []net.IP
- func (d *SSHInfraDriver) GetHostLabels(host net.IP) map[string]string
- func (d *SSHInfraDriver) GetHostName(hostIP net.IP) (string, error)
- func (d *SSHInfraDriver) GetHostTaints(host net.IP) []k8sv1.Taint
- func (d *SSHInfraDriver) GetHostsPlatform(hosts []net.IP) (map[v1.Platform][]net.IP, error)
- func (d *SSHInfraDriver) GetPlatform(host net.IP) (v1.Platform, error)
- func (d *SSHInfraDriver) GetRoleListByHostIP(ip string) []string
- func (d *SSHInfraDriver) IsDirExist(host net.IP, remoteDirPath string) (bool, error)
- func (d *SSHInfraDriver) IsFileExist(host net.IP, remoteFilePath string) (bool, error)
- func (d *SSHInfraDriver) Ping(host net.IP) error
- func (d *SSHInfraDriver) SetClusterHostAliases(hosts []net.IP) error
- func (d *SSHInfraDriver) SetHostName(host net.IP, hostName string) error
Constants ¶
View Source
const ( DelSymbol = "-" EqualSymbol = "=" ColonSymbol = ":" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfraDriver ¶
type InfraDriver interface { // GetHostTaints GetHostTaint return host taint GetHostTaints(host net.IP) []k8sv1.Taint GetHostIPList() []net.IP GetHostIPListByRole(role string) []net.IP GetRoleListByHostIP(ip string) []string GetHostsPlatform(hosts []net.IP) (map[v1.Platform][]net.IP, error) //GetHostEnv return merged env with host env and cluster env. GetHostEnv(host net.IP) map[string]interface{} //GetHostLabels return host labels. GetHostLabels(host net.IP) map[string]string //GetClusterEnv return cluster.spec.env as map[string]interface{} GetClusterEnv() map[string]interface{} AddClusterEnv(envs []string) //GetClusterName ${clusterName} GetClusterName() string //GetClusterImageName ${cluster image Name} GetClusterImageName() string //GetClusterLaunchCmds ${user-defined launch command} GetClusterLaunchCmds() []string //GetClusterLaunchApps ${user-defined launch apps} GetClusterLaunchApps() []string //GetClusterRootfsPath /var/lib/sealer/data/${clusterName}/rootfs GetClusterRootfsPath() string // GetClusterBasePath /var/lib/sealer/data/${clusterName} GetClusterBasePath() string // Execute use eg.Go to execute shell cmd concurrently Execute(hosts []net.IP, f func(host net.IP) error) error // Copy local files to remote host // scp -r /tmp root@192.168.0.2:/root/tmp => Copy("192.168.0.2","tmp","/root/tmp") // need check md5sum Copy(host net.IP, localFilePath, remoteFilePath string) error // CopyR copy remote host files to localhost CopyR(host net.IP, remoteFilePath, localFilePath string) error // CmdAsync exec command on remote host, and asynchronous return logs CmdAsync(host net.IP, env map[string]interface{}, cmd ...string) error // Cmd exec command on remote host, and return combined standard output and standard error Cmd(host net.IP, env map[string]interface{}, cmd string) ([]byte, error) // CmdToString exec command on remote host, and return spilt standard output and standard error CmdToString(host net.IP, env map[string]interface{}, cmd, spilt string) (string, error) // IsFileExist check remote file exist or not IsFileExist(host net.IP, remoteFilePath string) (bool, error) // IsDirExist Remote file existence returns true, nil IsDirExist(host net.IP, remoteDirPath string) (bool, error) // GetPlatform Get remote platform GetPlatform(host net.IP) (v1.Platform, error) GetHostName(host net.IP) (string, error) // Ping Ping remote host Ping(host net.IP) error // SetHostName add or update host name on host SetHostName(host net.IP, hostName string) error //SetClusterHostAliases set additional HostAliases SetClusterHostAliases(hosts []net.IP) error //DeleteClusterHostAliases delete additional HostAliases DeleteClusterHostAliases(hosts []net.IP) error GetClusterRegistry() v2.Registry }
InfraDriver treat the entire cluster as an operating system kernel, interface function here is the target system call.
func NewInfraDriver ¶
func NewInfraDriver(cluster *v2.Cluster) (InfraDriver, error)
NewInfraDriver will create a new Infra driver, and if extraEnv specified, it will set env not exist in Cluster
type SSHInfraDriver ¶
type SSHInfraDriver struct {
// contains filtered or unexported fields
}
func (*SSHInfraDriver) AddClusterEnv ¶
func (d *SSHInfraDriver) AddClusterEnv(envs []string)
func (*SSHInfraDriver) CmdToString ¶
func (*SSHInfraDriver) Copy ¶
func (d *SSHInfraDriver) Copy(host net.IP, localFilePath, remoteFilePath string) error
func (*SSHInfraDriver) CopyR ¶
func (d *SSHInfraDriver) CopyR(host net.IP, remoteFilePath, localFilePath string) error
func (*SSHInfraDriver) DeleteClusterHostAliases ¶
func (d *SSHInfraDriver) DeleteClusterHostAliases(hosts []net.IP) error
func (*SSHInfraDriver) GetClusterBasePath ¶
func (d *SSHInfraDriver) GetClusterBasePath() string
func (*SSHInfraDriver) GetClusterEnv ¶
func (d *SSHInfraDriver) GetClusterEnv() map[string]interface{}
func (*SSHInfraDriver) GetClusterImageName ¶
func (d *SSHInfraDriver) GetClusterImageName() string
func (*SSHInfraDriver) GetClusterLaunchApps ¶
func (d *SSHInfraDriver) GetClusterLaunchApps() []string
func (*SSHInfraDriver) GetClusterLaunchCmds ¶
func (d *SSHInfraDriver) GetClusterLaunchCmds() []string
func (*SSHInfraDriver) GetClusterName ¶
func (d *SSHInfraDriver) GetClusterName() string
func (*SSHInfraDriver) GetClusterRegistry ¶
func (d *SSHInfraDriver) GetClusterRegistry() v2.Registry
func (*SSHInfraDriver) GetClusterRootfsPath ¶
func (d *SSHInfraDriver) GetClusterRootfsPath() string
func (*SSHInfraDriver) GetHostEnv ¶
func (d *SSHInfraDriver) GetHostEnv(host net.IP) map[string]interface{}
func (*SSHInfraDriver) GetHostIPList ¶
func (d *SSHInfraDriver) GetHostIPList() []net.IP
func (*SSHInfraDriver) GetHostIPListByRole ¶
func (d *SSHInfraDriver) GetHostIPListByRole(role string) []net.IP
func (*SSHInfraDriver) GetHostLabels ¶
func (d *SSHInfraDriver) GetHostLabels(host net.IP) map[string]string
func (*SSHInfraDriver) GetHostName ¶
func (d *SSHInfraDriver) GetHostName(hostIP net.IP) (string, error)
func (*SSHInfraDriver) GetHostTaints ¶
func (d *SSHInfraDriver) GetHostTaints(host net.IP) []k8sv1.Taint
func (*SSHInfraDriver) GetHostsPlatform ¶
func (*SSHInfraDriver) GetPlatform ¶
func (*SSHInfraDriver) GetRoleListByHostIP ¶
func (d *SSHInfraDriver) GetRoleListByHostIP(ip string) []string
func (*SSHInfraDriver) IsDirExist ¶
func (*SSHInfraDriver) IsFileExist ¶
func (*SSHInfraDriver) SetClusterHostAliases ¶
func (d *SSHInfraDriver) SetClusterHostAliases(hosts []net.IP) error
func (*SSHInfraDriver) SetHostName ¶
func (d *SSHInfraDriver) SetHostName(host net.IP, hostName string) error
Click to show internal directories.
Click to hide internal directories.