lifecycle

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Overview

Package lifecycle provides utilities to manipulate lifecycle of resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lifecycle

type Lifecycle []*Stage

Lifecycle is a list of lifecycle stage.

func NewLifecycle

func NewLifecycle(stages []*internalversion.Stage) (Lifecycle, error)

NewLifecycle returns a new Lifecycle.

func (Lifecycle) ListAllPossible

func (s Lifecycle) ListAllPossible(ctx context.Context, label, annotation labels.Set, data interface{}) ([]*Stage, error)

ListAllPossible returns all possible stages.

func (Lifecycle) Match

func (s Lifecycle) Match(ctx context.Context, label, annotation labels.Set, data interface{}) (*Stage, error)

Match returns matched stage.

type Next

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

Next represents the next step in the lifecycle

func (*Next) Delete

func (n *Next) Delete() bool

Delete returns whether the resource should be deleted

func (*Next) Event

func (n *Next) Event() *internalversion.StageEvent

Event returns the event for the resource

func (*Next) Finalizers

func (n *Next) Finalizers(metaFinalizers []string) (*Patch, error)

Finalizers returns the finalizers patch

func (*Next) Patches

func (n *Next) Patches(resource any, renderer gotpl.Renderer) ([]*Patch, error)

Patches returns the patches for the resource

type Patch

type Patch struct {
	Data          []byte
	Type          types.PatchType
	Subresource   string
	Impersonation *internalversion.ImpersonationConfig
}

Patch represents a patch for the resource

type Stage

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

Stage is a resource lifecycle stage manager

func NewStage

func NewStage(s *internalversion.Stage) (*Stage, error)

NewStage returns a new Stage.

func (*Stage) Delay

func (s *Stage) Delay(ctx context.Context, v interface{}, now time.Time) (time.Duration, bool)

Delay returns the delay duration of the stage. It's not a constant value, it can be a random value.

func (*Stage) ImmediateNextStage

func (s *Stage) ImmediateNextStage() bool

ImmediateNextStage returns whether the stage is immediate next stage.

func (*Stage) Name

func (s *Stage) Name() string

Name returns the name of the stage

func (*Stage) Next

func (s *Stage) Next() *Next

Next returns the next of the stage.

func (*Stage) Weight

func (s *Stage) Weight(ctx context.Context, v interface{}) (int64, bool)

Weight returns the weight of the stage.

Jump to

Keyboard shortcuts

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