util

package
v1.2.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFromYAML

func CreateFromYAML(ctx context.Context, kc *kubernetes.Clientset, rc *rest.Config, filename string) error

func CreateResources

func CreateResources(ctx context.Context, resources []*unstructured.Unstructured, kc *kubernetes.Clientset, client *dynamic.DynamicClient) error

func GetControlPlaneNodesIDs added in v1.1.0

func GetControlPlaneNodesIDs(prefix string) ([]string, error)

func GetDynamicClient

func GetDynamicClient(rc *rest.Config) (*dynamic.DynamicClient, error)

func GetJoinToken

func GetJoinToken(kc *kubernetes.Clientset, rc *rest.Config, name string, namespace string) (string, error)

func GetKMCClientSet

func GetKMCClientSet(ctx context.Context, kc *kubernetes.Clientset, name string, namespace string, port int) (*kubernetes.Clientset, error)

GetKMCClientSet returns a kubernetes clientset for the cluster given the name and the namespace of the cluster.k0smotron.io

func GetNodeAddress

func GetNodeAddress(ctx context.Context, kc *kubernetes.Clientset, node string) (string, error)

func InstallK0smotronOperator

func InstallK0smotronOperator(ctx context.Context, kc *kubernetes.Clientset, rc *rest.Config) error

func InstallLocalPathStorage added in v0.9.5

func InstallLocalPathStorage(ctx context.Context, kc *kubernetes.Clientset, rc *rest.Config) error

func NewSuiteContext added in v0.4.1

func NewSuiteContext(t *testing.T) (context.Context, context.CancelCauseFunc)

func ParseManifests

func ParseManifests(data []byte) ([]*unstructured.Unstructured, error)

func Poll added in v1.1.0

func Poll(ctx context.Context, condition wait.ConditionWithContextFunc) error

Poll tries a condition func until it returns true, an error or the specified context is canceled or expired.

func RetryWatchErrors added in v1.1.0

func RetryWatchErrors(logf LogfFn) watch.ErrorCallback

func WaitForDeployment added in v1.1.0

func WaitForDeployment(ctx context.Context, kc *kubernetes.Clientset, name, namespace string) error

WaitForDeployment waits for the Deployment with the given name to become available as long as the given context isn't canceled.

func WaitForNodeReadyStatus added in v1.1.0

func WaitForNodeReadyStatus(ctx context.Context, clients kubernetes.Interface, nodeName string, status corev1.ConditionStatus) error

func WaitForSecret added in v0.4.1

func WaitForSecret(ctx context.Context, kc *kubernetes.Clientset, name string, namespace string) error

func WaitForStatefulSet added in v1.1.0

func WaitForStatefulSet(ctx context.Context, kc *kubernetes.Clientset, name, namespace string) error

WaitForStatefulSet waits for the StatefulSet with the given name to have as many ready replicas as defined in the spec.

Types

type ErrorHandler

type ErrorHandler func(err error, msgAndArgs ...interface{})

type LineWriter added in v1.1.0

type LineWriter struct {
	WriteLine func([]byte)
	// contains filtered or unexported fields
}

func (*LineWriter) Flush added in v1.1.0

func (s *LineWriter) Flush()

Logs any remaining data in the buffer that doesn't end with a newline.

func (*LineWriter) Write added in v1.1.0

func (s *LineWriter) Write(in []byte) (int, error)

Write implements io.Writer.

type LogfFn added in v1.1.0

type LogfFn func(format string, args ...any)

LogfFn will be used whenever something needs to be logged.

type PortForwarder

type PortForwarder struct {
	ReadyChan chan struct{}
	// contains filtered or unexported fields
}

func GetPortForwarder

func GetPortForwarder(cfg *rest.Config, name string, namespace string, port int) (*PortForwarder, error)

func (*PortForwarder) Close

func (pf *PortForwarder) Close()

Close closes the forwarder

func (*PortForwarder) LocalPort added in v0.4.0

func (pf *PortForwarder) LocalPort() (int, error)

Get the local port that is forwarded to the remote port

func (*PortForwarder) Start

func (pf *PortForwarder) Start(errorHandler ErrorHandler)

Start runs ForwardPorts. The errorHandler is expected to be s.Require().NoError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL