remote

package
v0.0.0-...-82cfb88 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Remote

type Remote struct {
	Sudo  bool
	Debug bool
	Name  string
	// contains filtered or unexported fields
}

Remote connects to the server via ssh.

func NewRemoteAuthSocket

func NewRemoteAuthSocket(name, addr, username string) (Remote, error)

NewRemoteAuthSocket creates a new Remove based using SSH_AUTH_SOCK to authorize.

func NewRemoteUsernamePassword

func NewRemoteUsernamePassword(name, addr, username, password string) (Remote, error)

NewRemoteUsernamePassword creates a new Remove based on a username password login.

func (Remote) AwaitDNS

func (r Remote) AwaitDNS(domain string) error

AwaitDNS blocks until cluster domain resolves to API server.

func (Remote) AwaitNodeReady

func (r Remote) AwaitNodeReady(node string) error

AwaitNodeReady blocks until node becomes ready.

func (Remote) AwaitReady

func (r Remote) AwaitReady(skipAwaitReady bool) error

AwaitReady blocks until the clusters becomes ready.

func (Remote) CAHash

func (r Remote) CAHash() (string, error)

CAHash calculates the hash of the ca certificate.

func (Remote) CertKey

func (r Remote) CertKey() (string, error)

CertKey calculates a new kubeadm certificate-key and uploads the certs to etcd with the new key.

func (Remote) Close

func (r Remote) Close()

Close disconnects the ssh connection.

func (Remote) DDDisk

func (r Remote) DDDisk(path string) error

DDDisk removes the fist 100Mi from the disk.

func (Remote) DeleteDisk

func (r Remote) DeleteDisk(path string) error

DeleteDisk removes all data from a disk.

func (Remote) DeletePods

func (r Remote) DeletePods() error

DeletePods deletes all pods running on a node.

func (Remote) DirExists

func (r Remote) DirExists(name string) (bool, error)

DirExists verifies a file path exists.

func (Remote) DisableCronjob

func (r Remote) DisableCronjob(namespace, resource string) error

DisableCronjob stops new jobs from a cronjob being scheduled.

func (Remote) DownloadFolder

func (r Remote) DownloadFolder(src, dest string) error

DownloadFolder downloads the content of a folder recursively.

func (Remote) Drain

func (r Remote) Drain(node string, skipDrain bool) error

Drain shifts all workload from the node.

func (Remote) EnableCronjob

func (r Remote) EnableCronjob(namespace, resource string) error

EnableCronjob activates a given cronjob.

func (Remote) Execute

func (r Remote) Execute(cmd string, stdIn io.Reader, stdOut, stdErr io.Writer) error

Execute runs a command on the remote server.

func (Remote) ExecuteStdin

func (r Remote) ExecuteStdin(stdIn io.Reader, stdOut, stdErr io.Writer) error

ExecuteStdin runs a command on the remote server.

func (Remote) Exists

func (r Remote) Exists(namespace, resource string) bool

Exists checks if a kubernetes resource exists.

func (Remote) FileExists

func (r Remote) FileExists(name string) (bool, error)

FileExists verifies a file path exists.

func (Remote) FilesMatch

func (r Remote) FilesMatch(path, otherPath string) (bool, error)

FilesMatch calculates and compares the hashes of two files.

func (Remote) JoinToken

func (r Remote) JoinToken() (string, error)

JoinToken creates a new join token for kubeadm.

func (Remote) Log

func (r Remote) Log(f string, a ...interface{})

Log prints messages prefixed with the servers name.

func (Remote) Md5

func (r Remote) Md5(path string) (string, error)

func (Remote) MkDir

func (r Remote) MkDir(path string) error

MkDir creates a directory recursively.

func (Remote) PrepareGracefulReboot

func (r Remote) PrepareGracefulReboot() error

func (Remote) Reboot

func (r Remote) Reboot() error

Reboot restarts the server via the 'reboot' command. The disk gets sync before rebooting.

func (Remote) ReceiveFile

func (r Remote) ReceiveFile(path string, w io.Writer) error

ReceiveFile download a file.

func (Remote) Remove

func (r Remote) Remove(path string) error

Remove removess a directory recursively.

func (Remote) RestartService

func (r Remote) RestartService(svc string) error

RestartService restarts a service via systemctl.

func (Remote) Run

func (r Remote) Run(cmd string) error

Run executes a command on the remote server and returns the output.

func (Remote) RunChanges

func (r Remote) RunChanges(cmd, file string) (bool, error)

Run executes a command on the remote server and returns true if the file changed.

func (Remote) RunFetchStdout

func (r Remote) RunFetchStdout(cmd string) (string, error)

Run executes a command on the remote server and returns the output.

func (Remote) RunStdout

func (r Remote) RunStdout(cmd string) error

RunStdout executes a command on the remote server and pritns the output to stderr & stdout.

func (Remote) Scale

func (r Remote) Scale(namespace, resource string, replicas int) error

Scale changes the replica count of a kubernetes resource.

func (Remote) Sha256

func (r Remote) Sha256(path string) (string, error)

func (Remote) StopService

func (r Remote) StopService(svc string) error

StopService stops a service via systemctl.

func (Remote) SyncDir

func (r Remote) SyncDir(path string) error

SyncDir calls syncs to flush a directory.

func (Remote) SyncDisks

func (r Remote) SyncDisks() error

SyncDisks calls sync to flush dirty pages to disk.

func (Remote) TempDir

func (r Remote) TempDir(suffix string) (string, error)

TempDir creates and returns the path to a tempdir.

func (Remote) Touch

func (r Remote) Touch(path string) error

Touch creates a file.

func (Remote) Uncordon

func (r Remote) Uncordon(node string, skipDrain bool) error

Uncordon allows the pods to be scheduled on the node.

func (r Remote) Unlink(path string) error

Unlink removes a file.

func (Remote) UploadFile

func (r Remote) UploadFile(src, dest string) error

UploadFile uploads a file.

func (Remote) UploadFolder

func (r Remote) UploadFolder(src, dest string) error

UploadFolder uploads the content of a folder recursively.

func (Remote) UploadFolderViaTar

func (r Remote) UploadFolderViaTar(src, dest string) error

UploadFolder uploads the content of a folder recursively.

func (Remote) WriteFile

func (r Remote) WriteFile(content []byte, path string, mode uint) error

WriteFile uploads a file.

Jump to

Keyboard shortcuts

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