kudo

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package kudo implements helpers around KUDO operators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	kudov1beta1.Instance
	// contains filtered or unexported fields
}

Instance wraps a KUDO instance.

func GetInstance

func GetInstance(client client.Client, name string, namespace string) (Instance, error)

GetInstance retrieves a KUDO instance in a namespace.

func ListInstances

func ListInstances(client client.Client, namespace string) ([]Instance, error)

ListInstances lists all KUDO instances in a namespace.

func (*Instance) Update

func (instance *Instance) Update() error

Update gets the current instance state.

func (*Instance) UpdateParameters

func (instance *Instance) UpdateParameters(parameters map[string]string) error

UpdateParameters merges new parameters with the existing ones. The instance will be updated on the server to use the new parameters. These updated can trigger plans.

func (*Instance) WaitForPlanComplete

func (instance *Instance) WaitForPlanComplete(plan string, options ...WaitOption) error

WaitForPlanComplete waits up to 5 minutes for an instance plan status to be completed. By default it waits for 5 minutes unless overridden with a WaitTimeout.

func (*Instance) WaitForPlanFailure added in v0.4.1

func (instance *Instance) WaitForPlanFailure(plan string, options ...WaitOption) error

WaitForPlanFailure waits for an instance plan status to be in ExecutionFatalError. By default it waits for 5 minutes unless overridden with a WaitTimeout.

func (*Instance) WaitForPlanInProgress

func (instance *Instance) WaitForPlanInProgress(plan string, options ...WaitOption) error

WaitForPlanInProgress waits for an instance plan status to be in progress. By default it waits for 30 seconds unless overridden with a WaitTimeout.

func (*Instance) WaitForPlanInStatus added in v0.4.1

func (instance *Instance) WaitForPlanInStatus(
	plan string,
	status kudov1beta1.ExecutionStatus,
	config WaitConfig) error

WaitForPlanInStatus waits for an instance plan status to reach a status.

func (*Instance) WaitForPlanStatus

func (instance *Instance) WaitForPlanStatus(
	ctx context.Context,
	ticker *time.Ticker,
	plan string,
	status kudov1beta1.ExecutionStatus) error

WaitForPlanStatus waits for an instance plan status to reach a status. A ticker polls the current instance status until the desired status is reached for a specific plan. A context can abort the polling.

type Operator

type Operator struct {
	Name            string
	Instance        Instance
	OperatorVersion kudov1beta1.OperatorVersion
	Operator        kudov1beta1.Operator
	// contains filtered or unexported fields
}

Operator wraps the cluster resources that are installed by KUDO for an operator package.

func (Operator) Uninstall

func (operator Operator) Uninstall() error

Uninstall removes the cluster resources of an operator. This will remove the Instance, OperatorVersion and Operator! We assume that this is the intended behavior for most test cases. Don't use this for test cases which have multiple Instances for a single OperatorVersion.

func (Operator) UninstallWaitForDeletion added in v0.3.0

func (operator Operator) UninstallWaitForDeletion(timeout time.Duration) error

UninstallWaitForDeletion is the same as Uninstall but initiates a foreground deletion, and waits for the KUDO resources to disappear. Waits up to timeout for the instance to be deleted, and up to 10 seconds for each of OperatorVersion and Operator.

Note that in the past some issues which were not fully understood were observed when using foreground deletion on Instances, see https://github.com/kudobuilder/kudo/issues/1071

type OperatorBuilder

type OperatorBuilder struct {
	Name            string
	Namespace       string
	Instance        string
	OperatorVersion *semver.Version
	AppVersion      *semver.Version
	Parameters      map[string]string
	Options         cmd_install.Options
}

OperatorBuilder tracks the options set for an operator.

func InstallOperator

func InstallOperator(operator string) OperatorBuilder

InstallOperator installs a KUDO operator package. Additional parameters can be added to this call. The installation is started by calling 'Do'.

operator, err := kudo.InstallOperator("kafka").
	WithNamespace("kafka").
	WithInstance("kafka-instance").
	WithAppVersion("2.4.0").
	Do(client)

func (OperatorBuilder) Do

func (builder OperatorBuilder) Do(client client.Client) (Operator, error)

Do installs the operator on the cluster.

func (OperatorBuilder) WithAppVersion

func (builder OperatorBuilder) WithAppVersion(version semver.Version) OperatorBuilder

WithAppVersion sets the version of the application that is bundled by the operator.

func (OperatorBuilder) WithInstance

func (builder OperatorBuilder) WithInstance(instance string) OperatorBuilder

WithInstance sets the name of instance that will be used for the operator.

func (OperatorBuilder) WithNamespace

func (builder OperatorBuilder) WithNamespace(namespace string) OperatorBuilder

WithNamespace sets the namespace in which the operator will be installed.

func (OperatorBuilder) WithOperatorVersion

func (builder OperatorBuilder) WithOperatorVersion(version semver.Version) OperatorBuilder

WithOperatorVersion sets the version of the operator.

func (OperatorBuilder) WithParameters

func (builder OperatorBuilder) WithParameters(parameters map[string]string) OperatorBuilder

WithParameters sets the parameters to use for the operator instance.

type PlanStatusTimeout added in v0.2.1

type PlanStatusTimeout struct {
	Plan           string
	ExpectedStatus kudov1beta1.ExecutionStatus
	ActualStatus   kudov1beta1.ExecutionStatus
	Message        string
}

PlanStatusTimeout is the error returned when waiting for a plan status times out.

func (PlanStatusTimeout) Error added in v0.2.1

func (p PlanStatusTimeout) Error() string

Error returns a pretty-printed error string.

func (PlanStatusTimeout) Temporary added in v0.2.1

func (PlanStatusTimeout) Temporary() bool

Temporary indicates that this is a temporary error.

func (PlanStatusTimeout) Timeout added in v0.2.1

func (PlanStatusTimeout) Timeout() bool

Timeout indicates that this is an error describing a timeout.

type UpgradeBuilder

type UpgradeBuilder struct {
	Name            string
	OperatorVersion *semver.Version
	AppVersion      *semver.Version
	Parameters      map[string]string
}

UpgradeBuilder tracks the options set for an upgrade.

func UpgradeOperator

func UpgradeOperator() UpgradeBuilder

UpgradeOperator upgrades an operator. Additional options can be added to this call. The upgrade is started by calling 'Do'.

kudo.UpgradeOperator().
	ToAppVersion("1.0.1").
	Do(operator)

func (UpgradeBuilder) Do

func (builder UpgradeBuilder) Do(operator *Operator) error

Do upgrades the operator.

func (UpgradeBuilder) ToAppVersion

func (builder UpgradeBuilder) ToAppVersion(version semver.Version) UpgradeBuilder

ToAppVersion sets the application version to upgrade to.

func (UpgradeBuilder) ToOperatorVersion

func (builder UpgradeBuilder) ToOperatorVersion(version semver.Version) UpgradeBuilder

ToOperatorVersion sets the operator version to upgrade to.

func (UpgradeBuilder) WithOperator

func (builder UpgradeBuilder) WithOperator(name string) UpgradeBuilder

WithOperator sets the name of the operator to upgrade with.

func (UpgradeBuilder) WithParameters

func (builder UpgradeBuilder) WithParameters(parameters map[string]string) UpgradeBuilder

WithParameters sets or changes parameters that the upgraded operator should use.

type WaitConfig added in v0.2.1

type WaitConfig struct {
	Timeout time.Duration
	Retry   time.Duration
}

WaitConfig is used to configure instance wait calls.

type WaitOption added in v0.2.1

type WaitOption func(*WaitConfig)

WaitOption changes a WaitConfig

func WaitTimeout added in v0.2.1

func WaitTimeout(timeout time.Duration) WaitOption

WaitTimeout sets the timeout of a instance wait call.

Jump to

Keyboard shortcuts

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