desiredset

package
v0.11.1-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LabelApplied   = "objectset.rio.cattle.io/applied"
	LabelID        = "objectset.rio.cattle.io/id"
	LabelGVK       = "objectset.rio.cattle.io/owner-gvk"
	LabelName      = "objectset.rio.cattle.io/owner-name"
	LabelNamespace = "objectset.rio.cattle.io/owner-namespace"
	LabelHash      = "objectset.rio.cattle.io/hash"
	LabelPrefix    = "objectset.rio.cattle.io/"
	LabelPrune     = "objectset.rio.cattle.io/prune"
)

Variables

This section is empty.

Functions

func GetLabelsAndAnnotations

func GetLabelsAndAnnotations(setID string) (map[string]string, map[string]string, error)

GetLabelsAndAnnotations returns the labels and annotations, like "objectset.rio.cattle.io/hash" and owners, to be able to use apply.DryRun

func GetSetID

func GetSetID(bundleID, labelPrefix, labelSuffix string) string

GetSetID constructs a identifier from the provided args, bundleID "fleet-agent" is special

Types

type Client

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

func New

func New(config *rest.Config) (*Client, error)

func (*Client) Plan

func (a *Client) Plan(ctx context.Context, defaultNS string, setID string, objs ...runtime.Object) (Plan, error)

Plan does a dry run of the apply to get the difference between the desired and live state. It needs a client. This adds the "objectset.rio.cattle.io/applied" annotation, which is used for tracking changes.

func (*Client) PlanDelete

func (a *Client) PlanDelete(ctx context.Context, defaultNS string, setID string, objs ...runtime.Object) (objectset.ObjectKeyByGVK, error)

type InformerFactory

type InformerFactory interface {
	Get(gvk schema.GroupVersionKind, gvr schema.GroupVersionResource) (cache.SharedIndexInformer, error)
}

type InformerGetter

type InformerGetter interface {
	Informer() cache.SharedIndexInformer
	GroupVersionKind() schema.GroupVersionKind
}

type PatchByGVK

func (PatchByGVK) Set

func (p PatchByGVK) Set(gvk schema.GroupVersionKind, namespace, name, patch string)

type Plan

type Plan struct {
	Create objectset.ObjectKeyByGVK

	// Delete contains existing objects that are not in the desired state,
	// unless their prune label is set to "false".
	Delete objectset.ObjectKeyByGVK

	// Update contains objects, already existing in the cluster, that have
	// changes. The patch would restore their desired state, as represented
	// in the helm manifest's resources passed into Plan(..., objs).
	Update PatchByGVK

	// Objects contains objects, already existing in the cluster, that have
	// valid metadata
	Objects []runtime.Object
}

func Diff

func Diff(plan Plan, bd *fleet.BundleDeployment, ns string, objs ...runtime.Object) (Plan, error)

Diff factors the bundledeployment's bundle diff patches into the plan from DryRun. This way, the status of the bundledeployment can be updated accurately.

Jump to

Keyboard shortcuts

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