Documentation ¶
Index ¶
Constants ¶
const ( K3sVersion1_26 = "v1.26.2-k3s1" K3sVersion1_28 = "v1.28.2-k3s1" )
k3s versions warning: k3s versions are tagged with a `+` separator before `k3s1`, but k3s images use `-`.
const DefaultNamespace = "default"
Variables ¶
var TestableRetryFunc = func(err error) bool { var testableRetrierError *TestableRetrierError ok := errors.As(err, &testableRetrierError) return ok }
TestableRetryFunc returns true if the returned error is a TestableRetrierError and indicates that an action should be tried until the retrier hits its limit.
Functions ¶
func NewCommandExecutor ¶
func NewCommandExecutor(clientSet kubernetes.Interface, coreV1RestClient rest.Interface) *defaultCommandExecutor
NewCommandExecutor creates a new instance of NewCommandExecutor
Types ¶
type K3dCluster ¶
type K3dCluster struct { ClusterName string AdminServiceAccount string // contains filtered or unexported fields }
func CreateK3dCluster ¶
func CreateK3dCluster(ctx context.Context, clusterNamePrefix string) (*K3dCluster, error)
CreateK3dCluster creates a completely new K8s cluster with an optional clusterNamePrefix.
func NewK3dCluster ¶
func NewK3dCluster(t *testing.T) *K3dCluster
NewK3dCluster creates a completely new cluster within the provided container engine. This method is the usual entry point of a test with testclusters-go.
func (*K3dCluster) ClientSet ¶
func (c *K3dCluster) ClientSet() (*kubernetes.Clientset, error)
ClientSet returns a K8s clientset which allows to interoperate with the cluster K8s API.
func (*K3dCluster) CtlKube ¶
func (c *K3dCluster) CtlKube(fieldManager string) (*YamlApplier, error)
type Lookout ¶
type Lookout struct {
// contains filtered or unexported fields
}
func (*Lookout) Pod ¶
func (l *Lookout) Pod(namespace, name string) *PodSelector
func (*Lookout) Pods ¶
func (l *Lookout) Pods(namespace string) *PodListSelector
type PodListSelector ¶
type PodListSelector struct {
// contains filtered or unexported fields
}
func (*PodListSelector) ByFieldSelector ¶
func (pls *PodListSelector) ByFieldSelector(fieldSelector string) *PodListSelector
func (*PodListSelector) ByLabels ¶
func (pls *PodListSelector) ByLabels(labels string) *PodListSelector
func (*PodListSelector) List ¶
func (pls *PodListSelector) List() *PodList
type PodSelector ¶
type PodSelector struct {
// contains filtered or unexported fields
}
type ShellCommand ¶
type ShellCommand struct {
// contains filtered or unexported fields
}
ShellCommand represents all necessary arguments to execute a command inside a container.
func NewShellCommand ¶
func NewShellCommand(command string, args ...string) ShellCommand
NewShellCommand creates a new ShellCommand. While the command is mandatory, there can be zero to n command arguments.
func (*ShellCommand) CommandWithArgs ¶
func (sc *ShellCommand) CommandWithArgs() []string
func (*ShellCommand) String ¶
func (sc *ShellCommand) String() string
type TestableRetrierError ¶
type TestableRetrierError struct {
Err error
}
TestableRetrierError marks errors that indicate that a previously executed action should be retried with again. It must wrap an existing error.
func (*TestableRetrierError) Error ¶
func (tre *TestableRetrierError) Error() string
Error returns the error's string representation.
type YamlApplier ¶
type YamlApplier struct {
// contains filtered or unexported fields
}
YamlApplier provides a pod with kubectl access to the cluster.
func NewYamlApplier ¶
func NewYamlApplier(restConfig *rest.Config, fieldManager, defaultNamespace string) (*YamlApplier, error)
func (*YamlApplier) ApplyWithFile ¶
func (ya *YamlApplier) ApplyWithFile(ctx context.Context, yamlBytes []byte) error
ApplyWithFile copies the yaml bytes into a file and calls `kubectl apply -f`.