k8s

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package k8s handles interacting with Kubernetes clusters.

Index

Constants

View Source
const (
	ErrWaitConditionInvalidCode = 1751
	ErrResourceWaitFailureCode  = 1752
)

Object error codes (1751-2000)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionalWaiter

type ConditionalWaiter struct {
	// contains filtered or unexported fields
}

ConditionalWaiter stores information for executing a wait loop to ensure a specific condition is met for one or more resources.

func NewConditionalWaiter

func NewConditionalWaiter(resource *dynamicResource, waitCondition WaitCondition,
	waitGroup *sync.WaitGroup) *ConditionalWaiter

NewConditionalWaiter creates and initializes a new ConditionalWaiter object.

func (*ConditionalWaiter) Error

func (w *ConditionalWaiter) Error() error

Error returns the error associated with the object.

func (*ConditionalWaiter) Run

func (w *ConditionalWaiter) Run(ctx context.Context)

Run executes a loop waiting for the given condition to be true for all matching resources.

Any errors that occur while the waiter is running can be retrieved by calling the waiter's Error() function.

The following errors are possible with this function: ErrResourceWaitFailure

type ErrResourceWaitFailure

type ErrResourceWaitFailure struct {
	Kind      string
	Name      string
	Selectors string
	Err       error
}

ErrResourceWaitFailure occurs when an error occurs while waiting for a resource.

func (*ErrResourceWaitFailure) Code

func (e *ErrResourceWaitFailure) Code() int

Code returns the corresponding error code.

func (*ErrResourceWaitFailure) Error

func (e *ErrResourceWaitFailure) Error() string

Error returns the string version of the error.

func (*ErrResourceWaitFailure) InternalError

func (e *ErrResourceWaitFailure) InternalError() error

InternalError returns the internal standard error object if there is one or nil if none is set.

type ErrWaitConditionInvalid

type ErrWaitConditionInvalid struct {
	Err error
}

ErrWaitConditionInvalid occurs when a wait condition is invalid.

func (*ErrWaitConditionInvalid) Code

func (e *ErrWaitConditionInvalid) Code() int

Code returns the corresponding error code.

func (*ErrWaitConditionInvalid) Error

func (e *ErrWaitConditionInvalid) Error() string

Error returns the string version of the error.

func (*ErrWaitConditionInvalid) InternalError

func (e *ErrWaitConditionInvalid) InternalError() error

InternalError returns the internal standard error object if there is one or nil if none is set.

type WaitCondition

type WaitCondition struct {
	Condition   string                 `yaml:"condition"`
	RawResource map[string]interface{} `yaml:"resource"`
	Selectors   []string               `yaml:"selectors"`
	Timeout     uint                   `yaml:"timeout"`

	ResourceDefinition []byte
}

WaitCondition holds information on what resources we must wait on before continuing.

func (*WaitCondition) UnmarshalYAML

func (c *WaitCondition) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML handles parsing YAML into an object and setting sensible defaults.

The following errors are returned by this function: ErrWaitConditionInvalid

Jump to

Keyboard shortcuts

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