Documentation ¶
Index ¶
- func CleanupDataDir(cnf *config.Control)
- func ClusterIPNet() *net.IPNet
- func FindStringInCmdAsync(scanner *bufio.Scanner, target string) bool
- func GenerateDataDir(cnf *config.Control) error
- func GenerateRuntime(cnf *config.Control) error
- func IsExistingServer() bool
- func IsRoot() bool
- func K3sCmd(cmdName string, cmdArgs ...string) (string, error)
- func K3sKillServer(server *K3sServer) error
- func K3sRemoveDataDir(dataDir string) error
- func K3sServerArgs() []string
- func ServerArgsPresent(neededArgs []string) bool
- func ServiceIPNet() *net.IPNet
- type K3sServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupDataDir ¶
CleanupDataDir removes the associated "/tmp/k3s/<RANDOM_STRING>" directory along with the 'latest' symlink that points at it.
func ClusterIPNet ¶
func GenerateDataDir ¶
GenerateDataDir creates a temporary directory at "/tmp/k3s/<RANDOM_STRING>/". The latest directory created with this function is soft linked to "/tmp/k3s/latest/". This allows tests to replicate the "/var/lib/rancher/k3s" directory structure.
func GenerateRuntime ¶
GenerateRuntime creates a temporary data dir and configures config.ControlRuntime with all the appropriate certificate keys.
func IsExistingServer ¶
func IsExistingServer() bool
func K3sCmd ¶
K3sCmd launches the provided K3s command via exec. Command blocks until finished. Command output from both Stderr and Stdout is provided via string.
cmdEx1, err := K3sCmd("etcd-snapshot", "ls") cmdEx2, err := K3sCmd("kubectl", "get", "pods", "-A")
func K3sKillServer ¶
K3sKillServer terminates the running K3s server and unlocks the file for other tests
func K3sRemoveDataDir ¶
K3sRemoveDataDir removes the provided directory as root
func K3sServerArgs ¶
func K3sServerArgs() []string
K3sServerArgs returns the list of arguments that the k3s server launched with
func ServerArgsPresent ¶
ServerArgsPresent checks if the given arguments are found in the running k3s server
func ServiceIPNet ¶
Types ¶
type K3sServer ¶
type K3sServer struct {
// contains filtered or unexported fields
}
func K3sStartServer ¶
K3sStartServer acquires an exclusive lock on a temporary file, then launches a k3s cluster with the provided arguments. Subsequent/parallel calls to this function will block until the original lock is cleared using K3sKillServer