k3s

package
v0.0.1-alpha4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLatestK3sVersions

func GetLatestK3sVersions() ([]string, error)

GetLatestK3sVersions returns the latest K3s versions

Types

type GitHubRelease

type GitHubRelease struct {
	TagName    string `json:"tag_name"`
	Prerelease bool   `json:"prerelease"`
}

GitHubRelease represents a GitHub release

type Service

type Service struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

Service is the service for managing k3s cluster nodes using SSH.

func NewK3sService

func NewK3sService(client *ssh.Client) *Service

NewK3sService provides functionalities for managing k3s cluster nodes using SSH.

func (*Service) DownloadK3sKubeconfig

func (s *Service) DownloadK3sKubeconfig() error

DownloadK3sKubeconfig downloads the K3s kubeconfig file

func (*Service) Exec

func (s *Service) Exec(output ssh.OutputWriter, cmdStr string) error

Exec executes a given SSH command on the remote machine. It takes an OutputWriter to handle the output of the SSH command, and a cmdStr which is the string representation of the command to be executed.

func (*Service) InstallK3s

func (s *Service) InstallK3s(output ssh.OutputWriter, initCluster bool, tlsSan, k3sArgs, version string) (string, error)

InstallCluster installs a K3s cluster on the remote host

func (*Service) JoinK3s

func (s *Service) JoinK3s(output ssh.OutputWriter, server string, master bool, token string) (string, error)

JoinK3s joins a node to a k3s cluster.

func (*Service) ListClusters

func (s *Service) ListClusters() ([]db.K3sCluster, error)

ListClusters returns a list of all clusters in the database.

func (*Service) ListNodesByCluster

func (s *Service) ListNodesByCluster(clusterID string) ([]db.K3sNode, error)

ListNodesByCluster returns a list of all nodes in a cluster.

func (*Service) SetKubeconfig

func (s *Service) SetKubeconfig() error

SetKubeconfig sets the KUBECONFIG environment variable

func (*Service) UninstallK3s

func (s *Service) UninstallK3s(output ssh.OutputWriter, agent bool) (string, error)

UninstallK3s uninstalls K3s from host

Jump to

Keyboard shortcuts

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