Documentation ¶
Overview ¶
k3s provides functions to install and delete a k3s cluster on an existing node as well as joining additional agents to an existing cluster. This package is heavily inspired by github.com/alexellis/k3sup (some code snippets are also copied).
Index ¶
- Variables
- func DeleteCluster(cluster *Cluster) error
- func MakeOrUpdateCluster(name string, cluster *Cluster) error
- type CRIConfig
- type Cluster
- type K8sClient
- type Node
- type RemoteExecutor
- func (e *RemoteExecutor) CombinedOutput(cmd string) (string, error)
- func (e *RemoteExecutor) CopyFile(fileReader io.Reader, dest string) error
- func (e *RemoteExecutor) ExecuteScript(script []byte) error
- func (e *RemoteExecutor) Output(cmd string) (string, error)
- func (e *RemoteExecutor) SudoCombinedOutput(cmd string) (string, error)
- func (e *RemoteExecutor) SudoOutput(cmd string) (string, error)
- type ResettableRESTMapper
- type VersionConfiguration
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequiredProperty = errors.New("property is required") ErrOutputOnly = errors.New("property is only for output") )
Functions ¶
func DeleteCluster ¶
func MakeOrUpdateCluster ¶
Types ¶
type Cluster ¶
type Cluster struct { MasterNodes []Node `json:"masterNodes,omitempty"` Agents []Node `json:"agents,omitempty"` KubeConfig string `json:"kubeconfig,omitempty"` VersionConfig VersionConfiguration `json:"versionConfig,omitempty"` }
type K8sClient ¶
type K8sClient struct {
// contains filtered or unexported fields
}
func (*K8sClient) CreateOrUpdateFromFile ¶
type Node ¶
type Node struct { Host string `json:"host,omitempty"` User string `json:"user,omitempty"` PrivateKey string `json:"privateKey,omitempty"` // Args define CLI arguments for k3s server or k3s agent respectively. // The passed args won't be validated and just passed to the installation instructions of the node. // An example value for the master node would look like []string{"--disable=traefik"}. Args []string `json:"args,omitempty"` CRIConfig CRIConfig `json:"criConfig,omitempty"` }
type RemoteExecutor ¶
type RemoteExecutor struct { FileHandler *sftp.Client CmdHandler *sshexec.Client // contains filtered or unexported fields }
func NewExecutorForNode ¶
func NewExecutorForNode(node Node, useSudo bool) (*RemoteExecutor, error)
func NewRemoteExecutor ¶
func NewRemoteExecutor(addr, user string, sshkeyPEM []byte, useSudo bool) (*RemoteExecutor, error)
func (*RemoteExecutor) CombinedOutput ¶
func (e *RemoteExecutor) CombinedOutput(cmd string) (string, error)
func (*RemoteExecutor) CopyFile ¶
func (e *RemoteExecutor) CopyFile(fileReader io.Reader, dest string) error
func (*RemoteExecutor) ExecuteScript ¶
func (e *RemoteExecutor) ExecuteScript(script []byte) error
func (*RemoteExecutor) SudoCombinedOutput ¶
func (e *RemoteExecutor) SudoCombinedOutput(cmd string) (string, error)
func (*RemoteExecutor) SudoOutput ¶
func (e *RemoteExecutor) SudoOutput(cmd string) (string, error)
type ResettableRESTMapper ¶
type ResettableRESTMapper interface { meta.RESTMapper Reset() }
TODO: replace with meta.ResettableRESTMapper as soon as available (currently only in master)
type VersionConfiguration ¶
type VersionConfiguration struct { Channel string `json:"channel,omitempty"` Version string `json:"version,omitempty"` }
VersionConfiguration resembles a K3s version. This can either be a release channel or a static version. If both are set the defined version will be preferred. Available channels can be found at: https://rancher.com/docs/k3s/latest/en/upgrades/basic/#release-channels An autoupdate configuration will automatically be added. For more information look here: https://rancher.com/docs/k3s/latest/en/upgrades/automated/ If none is set stable channel will be used.
func (VersionConfiguration) EnvSetting ¶
func (v VersionConfiguration) EnvSetting() string
func (VersionConfiguration) YAMLValue ¶
func (v VersionConfiguration) YAMLValue() string