Documentation ¶
Overview ¶
Package k3t provides a simple wrapper around the k3d client to operate a cluster for integration tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DebugKubeconfigPath = "/tmp/k3t/kubeconfig"
Functions ¶
func ConfigureLogger ¶
ConfigureLogger configures k3d logger to use testing.T's Log method instead of stdout. This funciton is called from NewCluster, unless disabled by an option. Note that this configures a global config, so it's not safe to configure from tests running in parallel. Note that testing.T automatically logs the name of this file, hence the short but still descriptive filename.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func (Cluster) API ¶
func (c Cluster) API() *kubernetes.Clientset
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures a cluster creation. It intentionally contains unexported methods to make sure that the contract of Option can be changed without breaking changes. We're using an interface with specific types for each option because it's easier to debug these kind of options later, compared to a list of anonymous functions.
func WithAPIPort ¶
WithAPIPort overrides the Kubernetes API port exposed on the host machine, instead of using a random free one.
func WithImages ¶
WithImages returns an option that preloads the specified images into the cluster. It expects those images to be already present on the host. Can be specified multiple times.
func WithLoadBalancerPort ¶
WithLoadBalancerPort overrides the load balancer port exposed on the host machine, instead of using a random free one.
func WithNoLoggerOverride ¶
func WithNoLoggerOverride() Option
WithNoLoggerOverride disables the k3d logger override to the testing.T.Logf(). This is useful if multiple tests are ran in parallel, as k3d logger is one global one.