plan

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HiddenInsignificantOutput  = "<hidden insignificant output>"
	HiddenInsignificantChanges = "<hidden insignificant changes>"
	HiddenSensitiveOutput      = "<hidden sensitive output>"
	HiddenSensitiveChanges     = "<hidden sensitive changes>"
)
View Source
const (
	StageOpNameSuffixStart = "start"
	StageOpNameSuffixEnd   = "end"
)
View Source
const (
	StageOpNamePrefixInit              = operation.TypeStageOperation + "/initialization"
	StageOpNamePrefixStandaloneCRDs    = operation.TypeStageOperation + "/standalone-crds"
	StageOpNamePrefixHookCRDs          = operation.TypeStageOperation + "/pre-hook-crds"
	StageOpNamePrefixHookResources     = operation.TypeStageOperation + "/pre-hook-resources"
	StageOpNamePrefixGeneralCRDs       = operation.TypeStageOperation + "/general-crds"
	StageOpNamePrefixGeneralResources  = operation.TypeStageOperation + "/general-resources"
	StageOpNamePrefixPostHookCRDs      = operation.TypeStageOperation + "/post-hook-crds"
	StageOpNamePrefixPostHookResources = operation.TypeStageOperation + "/post-hooks-resources"
	StageOpNamePrefixFinal             = operation.TypeStageOperation + "/finalization"
)

Variables

Functions

func CalculatePlannedChanges

func CalculatePlannedChanges(
	releaseName string,
	releaseNamespace string,
	standaloneCRDsInfos []*info.DeployableStandaloneCRDInfo,
	hookResourcesInfos []*info.DeployableHookResourceInfo,
	generalResourcesInfos []*info.DeployableGeneralResourceInfo,
	prevReleaseGeneralResourceInfos []*info.DeployablePrevReleaseGeneralResourceInfo,
	prevRelFailed bool,
) (
	createdChanges []*CreatedResourceChange,
	recreatedChanges []*RecreatedResourceChange,
	updatedChanges []*UpdatedResourceChange,
	appliedChanges []*AppliedResourceChange,
	deletedChanges []*DeletedResourceChange,
	anyChangesPlanned bool,
)

func CurrentReleaseExistingResourcesUIDs

func CurrentReleaseExistingResourcesUIDs(
	standaloneCRDsInfos []*info.DeployableStandaloneCRDInfo,
	hookResourcesInfos []*info.DeployableHookResourceInfo,
	generalResourcesInfos []*info.DeployableGeneralResourceInfo,
) (existingUIDs []types.UID, present bool)

func LogPlannedChanges

func LogPlannedChanges(
	ctx context.Context,
	releaseName string,
	releaseNamespace string,
	releaseChangesPlanned bool,
	createdChanges []*CreatedResourceChange,
	recreatedChanges []*RecreatedResourceChange,
	updatedChanges []*UpdatedResourceChange,
	appliedChanges []*AppliedResourceChange,
	deletedChanges []*DeletedResourceChange,
)

Types

type AppliedResourceChange

type AppliedResourceChange struct {
	*id.ResourceID

	Udiff              string
	CleanedUpOnSuccess bool
	CleanedUpOnFailure bool
}

type CreatedResourceChange

type CreatedResourceChange struct {
	*id.ResourceID

	Udiff              string
	CleanedUpOnSuccess bool
	CleanedUpOnFailure bool
}

type DeletedResourceChange

type DeletedResourceChange struct {
	*id.ResourceID

	Udiff string
}

type DeployFailurePlanBuilder

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

func NewDeployFailurePlanBuilder

func NewDeployFailurePlanBuilder(
	releaseNamespace string,
	deployType common.DeployType,
	deployPlan *Plan,
	taskStore *statestore.TaskStore,
	hookResourcesInfos []*info.DeployableHookResourceInfo,
	generalResourceInfos []*info.DeployableGeneralResourceInfo,
	newRelease *release.Release,
	history release.Historier,
	kubeClient kube.KubeClienter,
	dynamicClient dynamic.Interface,
	mapper meta.ResettableRESTMapper,
	opts DeployFailurePlanBuilderOptions,
) *DeployFailurePlanBuilder

func (*DeployFailurePlanBuilder) Build

type DeployFailurePlanBuilderOptions

type DeployFailurePlanBuilderOptions struct {
	PrevRelease     *release.Release
	DeletionTimeout time.Duration
}

type DeployPlanBuilder

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

func NewDeployPlanBuilder

func NewDeployPlanBuilder(
	releaseNamespace string,
	deployType common.DeployType,
	taskStore *statestore.TaskStore,
	logStore *kdutil.Concurrent[*logstore.LogStore],
	standaloneCRDsInfos []*info.DeployableStandaloneCRDInfo,
	hookResourcesInfos []*info.DeployableHookResourceInfo,
	generalResourcesInfos []*info.DeployableGeneralResourceInfo,
	prevReleaseGeneralResourceInfos []*info.DeployablePrevReleaseGeneralResourceInfo,
	newRelease *release.Release,
	history release.Historier,
	kubeClient kube.KubeClienter,
	staticClient kubernetes.Interface,
	dynamicClient dynamic.Interface,
	discoveryClient discovery.CachedDiscoveryInterface,
	mapper meta.ResettableRESTMapper,
	opts DeployPlanBuilderOptions,
) *DeployPlanBuilder

func (*DeployPlanBuilder) Build

func (b *DeployPlanBuilder) Build(ctx context.Context) (*Plan, error)

type DeployPlanBuilderOptions

type DeployPlanBuilderOptions struct {
	PrevRelease         *release.Release
	PrevDeployedRelease *release.Release
	CreationTimeout     time.Duration
	ReadinessTimeout    time.Duration
	DeletionTimeout     time.Duration
}

type Plan

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

func NewPlan

func NewPlan() *Plan

func (*Plan) AddDependency

func (p *Plan) AddDependency(fromOpID, toOpID string) error

func (*Plan) AddInStagedOperation

func (p *Plan) AddInStagedOperation(op operation.Operation, stageInID string)

func (*Plan) AddOperation

func (p *Plan) AddOperation(op operation.Operation)

func (*Plan) AddOutStagedOperation

func (p *Plan) AddOutStagedOperation(op operation.Operation, stageOutID string)

func (*Plan) AddStagedOperation

func (p *Plan) AddStagedOperation(op operation.Operation, stageInID, stageOutID string)

func (*Plan) CanceledOperations

func (p *Plan) CanceledOperations() (canceledOps []operation.Operation, found bool, err error)

func (*Plan) CompletedOperations

func (p *Plan) CompletedOperations() (completedOps []operation.Operation, found bool, err error)

func (*Plan) DOT

func (p *Plan) DOT() ([]byte, error)

func (*Plan) FailedOperations

func (p *Plan) FailedOperations() (failedOps []operation.Operation, found bool, err error)

func (*Plan) Operation

func (p *Plan) Operation(idFormat string, a ...any) (op operation.Operation, found bool)

func (*Plan) Operations

func (p *Plan) Operations() (operations []operation.Operation, found bool, err error)

func (*Plan) OperationsMatch

func (p *Plan) OperationsMatch(regex *regexp.Regexp) (ops []operation.Operation, found bool, err error)

func (*Plan) Optimize

func (p *Plan) Optimize() error

func (*Plan) PredecessorMap

func (p *Plan) PredecessorMap() (map[string]map[string]graph.Edge[string], error)

func (*Plan) SaveDOT

func (p *Plan) SaveDOT(path string) error

func (*Plan) Useless

func (p *Plan) Useless() (bool, error)

func (*Plan) WorthyCanceledOperations

func (p *Plan) WorthyCanceledOperations() (worthyCanceledOps []operation.Operation, found bool, err error)

func (*Plan) WorthyCompletedOperations

func (p *Plan) WorthyCompletedOperations() (worthyCompletedOps []operation.Operation, found bool, err error)

func (*Plan) WorthyFailedOperations

func (p *Plan) WorthyFailedOperations() (worthyFailedOps []operation.Operation, found bool, err error)

type PlanExecutor

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

func NewPlanExecutor

func NewPlanExecutor(plan *Plan, opts PlanExecutorOptions) *PlanExecutor

func (*PlanExecutor) Execute

func (e *PlanExecutor) Execute(parentCtx context.Context) error

type PlanExecutorOptions

type PlanExecutorOptions struct {
	NetworkParallelism int
}

type RecreatedResourceChange

type RecreatedResourceChange struct {
	*id.ResourceID

	Udiff              string
	CleanedUpOnSuccess bool
	CleanedUpOnFailure bool
}

type StageOpNamePrefix

type StageOpNamePrefix string

type UpdatedResourceChange

type UpdatedResourceChange struct {
	*id.ResourceID

	Udiff              string
	CleanedUpOnSuccess bool
	CleanedUpOnFailure bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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