actions

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequeueDelay      = 60 * time.Minute
	RequeueDelayError = 5 * time.Second
)
View Source
const (
	ConditionStatusSuccess = "True"
)

Variables

This section is empty.

Functions

func IsDeploymentReady

func IsDeploymentReady(resource *appsv1.Deployment) (bool, error)

func IsEndpointsReady

func IsEndpointsReady(resource *corev1.Endpoints) (bool, error)

func IsJobReady

func IsJobReady(resource *batchv1.Job) (bool, error)

func IsResourceFound added in v0.1.4

func IsResourceFound(client client.Client, ctx context.Context, req ctrl.Request, instance client.Object) (bool, error)

func IsResourceNotReadyError

func IsResourceNotReadyError(err error) bool

func IsServiceMeshControlPlaneReady

func IsServiceMeshControlPlaneReady(resource *unstructured.Unstructured) (bool, error)

func IsServiceMeshMemberReady

func IsServiceMeshMemberReady(resource *unstructured.Unstructured) (bool, error)

func IsServiceMeshMemberRollReady

func IsServiceMeshMemberRollReady(resource *unstructured.Unstructured) (bool, error)

func ManageError added in v0.1.4

func ManageError(client client.Client, ctx context.Context, instance client.Object, statusConditions *[]conditions.Condition, issue error) (reconcile.Result, error)

func ManageSuccess added in v0.1.4

func ManageSuccess(client client.Client, ctx context.Context, instance client.Object, statusConditions *[]conditions.Condition, resourcesReady bool) (reconcile.Result, error)

func ReadCurrentState added in v0.1.4

func ReadCurrentState(client client.Client, ctx context.Context, instance client.Object, conditions *[]conditions.Condition, currentState ResourceState) (reconcile.Result, error)

func RunDesiredStateActions added in v0.1.4

func RunDesiredStateActions(client client.Client, scheme *runtime.Scheme, ctx context.Context, instance client.Object, conditions *[]conditions.Condition, currentState ResourceState, desiredState DesiredResourceState) (reconcile.Result, error)

Types

type ActionRunner

type ActionRunner interface {
	RunAll(desiredState DesiredResourceState) error
	Create(obj client.Object, skipOwnerRef bool) error
	Update(obj client.Object, skipOwnerRef bool) error
	Delete(obj client.Object) error
	Error(err error) error
}

func NewControllerActionRunner

func NewControllerActionRunner(context context.Context, client client.Client, scheme *runtime.Scheme, cr client.Object) ActionRunner

NewControllerActionRunner creates an action runner to run kubernetes actions

type ControllerAction

type ControllerAction interface {
	Run(runner ActionRunner) (string, error)
}

type ControllerActionRunner

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

func (*ControllerActionRunner) Create

func (i *ControllerActionRunner) Create(obj client.Object, skipOwnerRef bool) error

func (*ControllerActionRunner) Delete

func (i *ControllerActionRunner) Delete(obj client.Object) error

func (*ControllerActionRunner) Error

func (i *ControllerActionRunner) Error(err error) error

func (*ControllerActionRunner) RunAll

func (i *ControllerActionRunner) RunAll(desiredState DesiredResourceState) error

func (*ControllerActionRunner) Update

func (i *ControllerActionRunner) Update(obj client.Object, skipOwnerRef bool) error

type DesiredResourceState

type DesiredResourceState []ControllerAction

func (*DesiredResourceState) AddAction

func (*DesiredResourceState) AddActions

type GenericCreateAction

type GenericCreateAction struct {
	Ref          client.Object
	Msg          string
	SkipOwnerRef bool
}

An action to create generic kubernetes resources (resources that don't require special treatment)

func (GenericCreateAction) Run

func (i GenericCreateAction) Run(runner ActionRunner) (string, error)

type GenericDeleteAction

type GenericDeleteAction struct {
	Ref client.Object
	Msg string
}

An action to delete generic kubernetes resources (resources that don't require special treatment)

func (GenericDeleteAction) Run

func (i GenericDeleteAction) Run(runner ActionRunner) (string, error)

type GenericErrorAction

type GenericErrorAction struct {
	Ref error
	Msg string
}

An action to return error

func (GenericErrorAction) Run

func (i GenericErrorAction) Run(runner ActionRunner) (string, error)

type GenericUpdateAction

type GenericUpdateAction struct {
	Ref          client.Object
	Msg          string
	SkipOwnerRef bool
}

An action to update generic kubernetes resources (resources that don't require special treatment)

func (GenericUpdateAction) Run

func (i GenericUpdateAction) Run(runner ActionRunner) (string, error)

type ResourceNotReadyError

type ResourceNotReadyError struct {
	PartialObject client.Object
}

func (*ResourceNotReadyError) Error

func (e *ResourceNotReadyError) Error() string

type ResourceState added in v0.1.4

type ResourceState interface {
	Read(context.Context, client.Object) error
	IsResourcesReady(client.Object) (bool, error)
}

type StateManager

type StateManager struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func GetStateManager

func GetStateManager() *StateManager

func (*StateManager) Clear

func (sm *StateManager) Clear()

func (*StateManager) GetState

func (sm *StateManager) GetState(key string) interface{}

func (*StateManager) SetState

func (sm *StateManager) SetState(key string, value interface{})

Jump to

Keyboard shortcuts

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