Documentation ¶
Overview ¶
Package sshclient contains the interface to speak to bare metal servers with ssh.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCommandExitedWithoutExitSignal means the ssh command exited unplanned. ErrCommandExitedWithoutExitSignal = errors.New("wait: remote command exited without exit status or exit signal") // ErrCommandExitedWithStatusOne means the ssh command exited with sttatus 1. ErrCommandExitedWithStatusOne = errors.New("Process exited with status 1") //nolint:stylecheck // this is used to check ssh errors // ErrConnectionRefused means the ssh connection was refused. ErrConnectionRefused = errors.New("connect: connection refused") // ErrAuthenticationFailed means ssh was unable to authenticate. ErrAuthenticationFailed = errors.New("ssh: unable to authenticate") // ErrEmptyStdOut means that StdOut equals empty string. ErrEmptyStdOut = errors.New("unexpected empty output in stdout") // ErrTimeout means that there is a timeout error. ErrTimeout = errors.New("i/o timeout") )
Functions ¶
func IsAuthenticationFailedError ¶
IsAuthenticationFailedError checks whether the ssh error is an authentication failed error.
func IsCommandExitedWithoutExitSignalError ¶
IsCommandExitedWithoutExitSignalError checks whether the ssh error is an unplanned exit error.
func IsConnectionRefusedError ¶
IsConnectionRefusedError checks whether the ssh error is a connection refused error.
func IsTimeoutError ¶
IsTimeoutError checks whether the ssh error is an unplanned exit error.
Types ¶
type Client ¶
type Client interface { GetHostName() Output GetHardwareDetailsRAM() Output GetHardwareDetailsNics() Output GetHardwareDetailsStorage() Output GetHardwareDetailsCPUArch() Output GetHardwareDetailsCPUModel() Output GetHardwareDetailsCPUClockGigahertz() Output GetHardwareDetailsCPUFlags() Output GetHardwareDetailsCPUThreads() Output GetHardwareDetailsCPUCores() Output GetHardwareDetailsDebug() Output GetRunningInstallImageProcesses() Output GetCloudInitOutput() Output CreateAutoSetup(data string) Output DownloadImage(path, url string) Output CreatePostInstallScript(data string) Output ExecuteInstallImage(hasPostInstallScript bool) Output Reboot() Output EnsureCloudInit() Output CreateNoCloudDirectory() Output CreateMetaData(hostName string) Output CreateUserData(userData string) Output CloudInitStatus() Output CheckCloudInitLogsForSigTerm() Output CleanCloudInitLogs() Output CleanCloudInitInstances() Output ResetKubeadm() Output UntarTGZ() Output DetectLinuxOnAnotherDisk(sliceOfWwns []string) Output }
Client is the interface defining all functions necessary to talk to a bare metal server via SSH.
type Credentials ¶
Credentials defines the credentials for SSH calls specified in a secret.
func CredentialsFromSecret ¶
func CredentialsFromSecret(secret *corev1.Secret, secretRef infrav1.SSHSecretRef) Credentials
CredentialsFromSecret generates the credentials object from a secret and a secretRef.
func (Credentials) Validate ¶
func (creds Credentials) Validate() error
Validate returns an error if the ssh credentials are invalid.