task

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyTask

type ApplyTask struct {
	TaskName string

	DynamicClient     dynamic.Interface
	OpenAPIGetter     discovery.OpenAPISchemaInterface
	InfoHelper        info.Helper
	Mapper            meta.RESTMapper
	Objects           object.UnstructuredSet
	Filters           []filter.ValidationFilter
	Mutators          []mutator.Interface
	DryRunStrategy    common.DryRunStrategy
	ServerSideOptions common.ServerSideOptions
}

ApplyTask applies the given Objects to the cluster by using the ApplyOptions.

func (*ApplyTask) Action added in v0.26.0

func (a *ApplyTask) Action() event.ResourceAction

func (*ApplyTask) Cancel added in v0.27.0

func (a *ApplyTask) Cancel(_ *taskrunner.TaskContext)

Cancel is not supported by the ApplyTask.

func (*ApplyTask) Identifiers added in v0.26.0

func (a *ApplyTask) Identifiers() object.ObjMetadataSet

func (*ApplyTask) Name added in v0.26.0

func (a *ApplyTask) Name() string

func (*ApplyTask) Start

func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext)

Start creates a new goroutine that will invoke the Run function on the ApplyOptions to update the cluster. It will push a TaskResult on the taskChannel to signal to the taskrunner that the task has completed (or failed). It will also fetch the Generation from each of the applied resources after the Run function has completed. This information is then added to the taskContext. The generation is increased every time the desired state of a resource is changed.

func (*ApplyTask) StatusUpdate added in v0.27.0

func (a *ApplyTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)

StatusUpdate is not supported by the ApplyTask.

type DeleteInvTask added in v0.26.0

type DeleteInvTask struct {
	TaskName  string
	InvClient inventory.Client
	InvInfo   inventory.Info
	DryRun    common.DryRunStrategy
}

DeleteInvTask encapsulates structures necessary to delete the inventory object from the cluster. Implements the Task interface. This task should happen after all resources have been deleted.

func (*DeleteInvTask) Action added in v0.26.0

func (i *DeleteInvTask) Action() event.ResourceAction

func (*DeleteInvTask) Cancel added in v0.27.0

func (i *DeleteInvTask) Cancel(_ *taskrunner.TaskContext)

Cancel is not supported by the DeleteInvTask.

func (*DeleteInvTask) Identifiers added in v0.26.0

func (i *DeleteInvTask) Identifiers() object.ObjMetadataSet

func (*DeleteInvTask) Name added in v0.26.0

func (i *DeleteInvTask) Name() string

func (*DeleteInvTask) Start added in v0.26.0

func (i *DeleteInvTask) Start(taskContext *taskrunner.TaskContext)

Start deletes the inventory object from the cluster.

func (*DeleteInvTask) StatusUpdate added in v0.27.0

func (i *DeleteInvTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)

StatusUpdate is not supported by the DeleteInvTask.

type InvAddTask added in v0.26.0

type InvAddTask struct {
	TaskName  string
	InvClient inventory.Client
	InvInfo   inventory.Info
	Objects   object.UnstructuredSet
	DryRun    common.DryRunStrategy
}

InvAddTask encapsulates structures necessary to add/merge inventory into the cluster. The InvAddTask should add/merge inventory references before the actual object is applied.

func (*InvAddTask) Action added in v0.26.0

func (i *InvAddTask) Action() event.ResourceAction

func (*InvAddTask) Cancel added in v0.27.0

func (i *InvAddTask) Cancel(_ *taskrunner.TaskContext)

Cancel is not supported by the InvAddTask.

func (*InvAddTask) Identifiers added in v0.26.0

func (i *InvAddTask) Identifiers() object.ObjMetadataSet

func (*InvAddTask) Name added in v0.26.0

func (i *InvAddTask) Name() string

func (*InvAddTask) Start added in v0.26.0

func (i *InvAddTask) Start(taskContext *taskrunner.TaskContext)

Start updates the inventory by merging the locally applied objects into the current inventory.

func (*InvAddTask) StatusUpdate added in v0.27.0

func (i *InvAddTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)

StatusUpdate is not supported by the InvAddTask.

type InvSetTask added in v0.26.0

type InvSetTask struct {
	TaskName      string
	InvClient     inventory.Client
	InvInfo       inventory.Info
	PrevInventory object.ObjMetadataSet
	DryRun        common.DryRunStrategy
}

InvSetTask encapsulates structures necessary to set the inventory references at the end of the apply/prune.

func (*InvSetTask) Action added in v0.26.0

func (i *InvSetTask) Action() event.ResourceAction

func (*InvSetTask) Cancel added in v0.27.0

func (i *InvSetTask) Cancel(_ *taskrunner.TaskContext)

Cancel is not supported by the InvSetTask.

func (*InvSetTask) Identifiers added in v0.26.0

func (i *InvSetTask) Identifiers() object.ObjMetadataSet

func (*InvSetTask) Name added in v0.26.0

func (i *InvSetTask) Name() string

func (*InvSetTask) Start added in v0.26.0

func (i *InvSetTask) Start(taskContext *taskrunner.TaskContext)

Start sets (creates or replaces) the inventory.

The guiding principal is that anything in the cluster should be in the inventory, unless it was explicitly abandoned.

This task must run after all the apply and prune tasks have completed.

Added objects: - Applied resources (successful)

Retained objects: - Applied resources (filtered/skipped) - Applied resources (failed) - Deleted resources (filtered/skipped) that were not abandoned - Deleted resources (failed) - Abandoned resources (failed)

Removed objects: - Deleted resources (successful) - Abandoned resources (successful)

func (*InvSetTask) StatusUpdate added in v0.27.0

func (i *InvSetTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)

StatusUpdate is not supported by the InvSetTask.

type KubectlPrinterAdapter added in v0.14.0

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

KubectlPrinterAdapter is a workaround for capturing progress from ApplyOptions. ApplyOptions were originally meant to print progress directly using a configurable printer. The KubectlPrinterAdapter plugs into ApplyOptions as a ToPrinter function, but instead of printing the info, it emits it as an event on the provided channel.

type PruneTask

type PruneTask struct {
	TaskName string

	Pruner            *prune.Pruner
	Objects           object.UnstructuredSet
	Filters           []filter.ValidationFilter
	DryRunStrategy    common.DryRunStrategy
	PropagationPolicy metav1.DeletionPropagation
	// True if we are destroying, which deletes the inventory object
	// as well (possibly) the inventory namespace.
	Destroy bool
}

PruneTask prunes objects from the cluster by using the PruneOptions. The provided Objects is the set of resources that have just been applied.

func (*PruneTask) Action added in v0.26.0

func (p *PruneTask) Action() event.ResourceAction

func (*PruneTask) Cancel added in v0.27.0

func (p *PruneTask) Cancel(_ *taskrunner.TaskContext)

Cancel is not supported by the PruneTask.

func (*PruneTask) Identifiers added in v0.26.0

func (p *PruneTask) Identifiers() object.ObjMetadataSet

func (*PruneTask) Name added in v0.26.0

func (p *PruneTask) Name() string

func (*PruneTask) Start

func (p *PruneTask) Start(taskContext *taskrunner.TaskContext)

Start creates a new goroutine that will invoke the Run function on the PruneOptions to update the cluster. It will push a TaskResult on the taskChannel to signal to the taskrunner that the task has completed (or failed).

func (*PruneTask) StatusUpdate added in v0.27.0

func (p *PruneTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)

StatusUpdate is not supported by the PruneTask.

type SendEventTask

type SendEventTask struct {
	Event event.Event
}

SendEventTask is an implementation of the Task interface that will send the provided event on the eventChannel when executed.

func (*SendEventTask) ClearTimeout

func (s *SendEventTask) ClearTimeout()

ClearTimeout doesn't do anything as SendEventTask doesn't support timeouts.

func (*SendEventTask) Start

func (s *SendEventTask) Start(taskContext *taskrunner.TaskContext)

Start start a separate goroutine that will send the event and then push a TaskResult on the taskChannel to signal to the taskrunner that the task is completed.

Jump to

Keyboard shortcuts

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