Documentation
¶
Index ¶
- Constants
- Variables
- type Agent
- type Cluster
- type Config
- type Engine
- func (e *Engine) ConfigureNode(node *Node) error
- func (e *Engine) Connect() error
- func (e *Engine) Disconnect() error
- func (e *Engine) FilterNodes(selector Role) []*Node
- func (e *Engine) Install() error
- func (e *Engine) KubeConfig(outputPath string) error
- func (e *Engine) SetSpec(config *Config) error
- func (e *Engine) Uninstall() error
- type Node
- type Option
- type Options
- type Role
- type Server
Constants ¶
const (
InstallerURL = "https://get.k3s.io"
)
const (
// Program is used to configure the name of the configuration file.
Program = "k3se"
)
Variables ¶
var ( // Channels is a list of the available release channels. Channels = []string{"stable", "latest", "testing"} )
Functions ¶
This section is empty.
Types ¶
type Agent ¶ added in v1.0.0
type Agent struct { Debug bool `yaml:"debug,omitempty"` V int `yaml:"v,omitempty"` VModule string `yaml:"vmodule,omitempty"` Log string `yaml:"log,omitempty"` AlsoLogToStderr bool `yaml:"also-log-to-stderr,omitempty"` Server string `yaml:"server,omitempty"` DataDir string `yaml:"data-dir,omitempty"` NodeName string `yaml:"node-name,omitempty"` WithNodeID bool `yaml:"with-node-id,omitempty"` NodeLabel []string `yaml:"node-label,omitempty"` NodeTaint []string `yaml:"node-taint,omitempty"` ImageCredentialProviderBinDir string `yaml:"image-credential-provider-bin-dir,omitempty"` ImageCredentialProviderConfig string `yaml:"image-credential-provider-config,omitempty"` Docker bool `yaml:"docker,omitempty"` ContainerRuntimeEndpoint string `yaml:"container-runtime-endpoint,omitempty"` PauseImage string `yaml:"pause-image,omitempty"` Snapshotter string `yaml:"snapshotter,omitempty"` PrivateRegistry string `yaml:"private-registry,omitempty"` NodeIP []string `yaml:"node-ip,omitempty"` NodeExternalIP []string `yaml:"node-external-ip,omitempty"` ResolvConf string `yaml:"resolv-conf,omitempty"` FlannelIface string `yaml:"flannel-iface,omitempty"` FlannelConf string `yaml:"flannel-conf,omitempty"` KubeletArg []string `yaml:"kubelet-arg,omitempty"` KubeProxyArg []string `yaml:"kube-proxy-arg,omitempty"` ProtectKernelDefaults bool `yaml:"protect-kernel-defaults,omitempty"` Rootless bool `yaml:"rootless,omitempty"` LBServerPort int `yaml:"lb-server-port,omitempty"` }
Agent describes the configuration of a k3s agent. For more information, please refer to the k3s documentation: https://rancher.com/docs/k3s/latest/en/installation/install-options/agent-config/#k3s-agent-cli-help
type Cluster ¶ added in v1.0.0
type Cluster struct { Server Server `yaml:"server,omitempty"` Agent Agent `yaml:"agent,omitempty"` }
Cluster defines share settings across all servers and agents.
type Config ¶
type Config struct { // Version is the version of k3s to use. It may also be a // channel as specified in the k3s installation options. Version string `yaml:"version"` // Cluster defines shared configuration settings across all // servers and agents. Cluster Cluster `yaml:"cluster"` // Nodes is a list of nodes to deploy the cluster on. It stores // both, connection information and node-specific configuration. Nodes []Node `yaml:"nodes"` // SSHProxy describes the SSH connection configuration // for an SSH proxy, often also referred to as bastion // host or jumpbox. SSHProxy sshx.Config `yaml:"ssh-proxy"` }
Config describes the state of a k3s cluster. For general reference, please refer to the k3s installation options: https://rancher.com/docs/k3s/latest/en/installation/install-options
func LoadConfig ¶
LoadConfig sets up the configuration parser and loads the configuration file.
type Engine ¶ added in v0.2.0
type Engine struct { Logger *zerolog.Logger sync.Mutex Spec *Config // contains filtered or unexported fields }
Engine is a type that encapsulates parts of the installation logic.
func (*Engine) ConfigureNode ¶ added in v0.3.0
ConfigureNode uploads the installer and the configuration to a node prior to running the installation script.
func (*Engine) Disconnect ¶ added in v0.3.0
Disconnect closes all SSH connections to all nodes.
func (*Engine) FilterNodes ¶ added in v0.3.0
FilterNodes returns a list of nodes based on the specified selector. Use RoleAny to match all nodes, RoleAgent to match all worker nodes, and RoleServer to match all control-plane nodes.
func (*Engine) KubeConfig ¶ added in v0.3.5
KubeConfig writes the kubeconfig of the cluster to the specified location.
type Node ¶
type Node struct { Role Role `yaml:"role"` SSH sshx.Config `yaml:"ssh"` Server Server `yaml:"server,omitempty"` Agent Agent `yaml:"agent,omitempty"` Client *sshx.Client `yaml:"-"` Logger zerolog.Logger `yaml:"-"` }
Node describes the configuration of a node.
func (*Node) Disconnect ¶
Disconnect closes the connection to the node.
type Option ¶
Option applies a configuration option for the execution of an operation.
func WithLogger ¶
WithLogger allows to use a custom logger.
func WithSSHProxy ¶
WithSSHProxy allows to use an existing SSH connection as an SSH bastion host.
func WithTimeout ¶
WithTimeout allows to set a custom timeout.
type Options ¶
Options contains the configuration for an operation.
func GetDefaultOptions ¶
func GetDefaultOptions() *Options
GetDefaultOptions returns the default options for all operations of this library.
type Server ¶ added in v1.0.0
type Server struct { V int `yaml:"v,omitempty"` VModule string `yaml:"vmodule,omitempty"` Log string `yaml:"log,omitempty"` AlsoLogToStderr bool `yaml:"also-log-to-stderr,omitempty"` BindAddress string `yaml:"bind-address,omitempty"` HTTPSListenPort int `yaml:"https-listen-port,omitempty"` AdvertiseAddress string `yaml:"advertise-address,omitempty"` AdvertisePort int `yaml:"advertise-port,omitempty"` TLSSAN []string `yaml:"tls-san,omitempty"` DataDir string `yaml:"data-dir,omitempty"` ClusterCIDR []string `yaml:"cluster-cidr,omitempty"` ServiceCIDR []string `yaml:"service-cidr,omitempty"` ServiceNodePortRange string `yaml:"service-node-port-range,omitempty"` ClusterDNS []string `yaml:"cluster-dns,omitempty"` ClusterDomain string `yaml:"cluster-domain,omitempty"` FlannelBackend string `yaml:"flannel-backend,omitempty"` WriteKubeconfig string `yaml:"write-kubeconfig,omitempty"` WriteKubeconfigMode string `yaml:"write-kubeconfig-mode,omitempty"` EtcdArg []string `yaml:"etcd-arg,omitempty"` KubeAPIServerArg []string `yaml:"kube-apiserver-arg,omitempty"` KubeSchedulerArg []string `yaml:"kube-scheduler-arg,omitempty"` KubeControllerManagerArg []string `yaml:"kube-controller-manager-arg,omitempty"` KubeCloudControllerManagerArg []string `yaml:"kube-cloud-controller-manager-arg,omitempty"` DatastoreEndpoint string `yaml:"datastore-endpoint,omitempty"` DatastoreCAFile string `yaml:"datastore-cafile,omitempty"` DatastoreCertFile string `yaml:"datastore-certfile,omitempty"` DatastoreKeyFile string `yaml:"datastore-keyfile,omitempty"` EtcdExposeMetrics bool `yaml:"etcd-expose-metrics,omitempty"` EtcdDisableSnapshots bool `yaml:"etcd-disable-snapshots,omitempty"` EtcdSnapshotName string `yaml:"etcd-snapshot-name,omitempty"` EtcdSnapshotScheduleCron string `yaml:"etcd-snapshot-schedule-cron,omitempty"` EtcdSnapshotRetention int `yaml:"etcd-snapshot-retention,omitempty"` EtcdSnapshotDir string `yaml:"etcd-snapshot-dir,omitempty"` EtcdS3 bool `yaml:"etcd-s3,omitempty"` EtcdS3Endpoint string `yaml:"etcd-s3-endpoint,omitempty"` EtcdS3EndpointCA string `yaml:"etcd-s3-endpoint-ca,omitempty"` EtcdS3SkipSSLVerify bool `yaml:"etcd-s3-skip-ssl-verify,omitempty"` EtcdS3AccessKey string `yaml:"etcd-s3-access-key,omitempty"` EtcdS3SecretKey string `yaml:"etcd-s3-secret-key,omitempty"` EtcdS3Bucket string `yaml:"etcd-s3-bucket,omitempty"` EtcdS3Region string `yaml:"etcd-s3-region,omitempty"` EtcdS3Folder string `yaml:"etcd-s3-folder,omitempty"` DefaultLocalStoragePath string `yaml:"default-local-storage-path,omitempty"` Disable []string `yaml:"disable,omitempty"` DisableScheduler bool `yaml:"disable-scheduler,omitempty"` DisableCloudController bool `yaml:"disable-cloud-controller,omitempty"` DisableKubeProxy bool `yaml:"disable-kube-proxy,omitempty"` DisableNetworkPolicy bool `yaml:"disable-network-policy,omitempty"` NodeName string `yaml:"node-name,omitempty"` WithNodeID bool `yaml:"with-node-id,omitempty"` NodeLabel []string `yaml:"node-label,omitempty"` NodeTaint []string `yaml:"node-taint,omitempty"` ImageCredentialProviderBinDir string `yaml:"image-credential-provider-bin-dir,omitempty"` ImageCredentialProviderConfig string `yaml:"image-credential-provider-config,omitempty"` Docker string `yaml:"docker,omitempty"` ContainerRuntimeEndpoint string `yaml:"container-runtime-endpoint,omitempty"` PauseImage string `yaml:"pause-image,omitempty"` Snapshotter string `yaml:"snapshotter,omitempty"` PrivateRegistry string `yaml:"private-registry,omitempty"` NodeIP []string `yaml:"node-ip,omitempty"` NodeExternalIP []string `yaml:"node-external-ip,omitempty"` ResolvConf string `yaml:"resolv-conf,omitempty"` FlannelIface string `yaml:"flannel-iface,omitempty"` FlannelConf string `yaml:"flannel-conf,omitempty"` KubeletArg []string `yaml:"kubelet-arg,omitempty"` KubeProxyArg []string `yaml:"kube-proxy-arg,omitempty"` ProtectKernelDefaults bool `yaml:"protect-kernel-defaults,omitempty"` Rootless bool `yaml:"rootless,omitempty"` Server string `yaml:"server,omitempty"` // Options to manage the clustering, such as "--cluster-init", are omitted as this // is handled automatically by the engine. ClusterResetRestorePath bool `yaml:"cluster-reset-restore-path,omitempty"` SecretsEncryption bool `yaml:"secrets-encryption,omitempty"` SystemDefaultRegistry string `yaml:"system-default-registry,omitempty"` SELinux bool `yaml:"selinux,omitempty"` LBServerPort int `yaml:"lb-server-port,omitempty"` }
Server describes the configuration of a k3s server. For more information, please refer to the k3s documentation: https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/#k3s-server-cli-help