resource

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInputRevisions added in v0.0.10

func NewInputRevisions(obj client.Object, refKey string) *apiv1.InputRevisions

func Slice

func Slice(comp *apiv1.Composition, previous []*apiv1.ResourceSlice, outputs []*unstructured.Unstructured, maxJsonBytes int) ([]*apiv1.ResourceSlice, error)

Slice builds a new set of resource slices by merging a new set of resources onto an old set of slices. - New and updated resources are partitioned across slices per maxJsonBytes - Removed resources are converted into "tombstones" i.e. manifests with Deleted == true

Types

type Cache added in v0.0.48

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

Cache caches resources indexed and logically grouped by the UUID of the synthesis that produced them. Kind of like an informer but optimized for Eno.

func (*Cache) Fill added in v0.0.48

func (c *Cache) Fill(ctx context.Context, comp types.NamespacedName, synUUID string, items []apiv1.ResourceSlice)

Fill populates the cache with resources from a synthesis. Call Visit first to see if filling the cache is necessary. Get the resource slices from the API - not the informers, which prune out the manifests to save memory.

func (*Cache) Get added in v0.0.48

func (c *Cache) Get(ctx context.Context, synthesisUUID string, ref Ref) (res *Resource, visible, found bool)

func (*Cache) Purge added in v0.0.48

func (c *Cache) Purge(ctx context.Context, compNSN types.NamespacedName, comp *apiv1.Composition)

Purge removes all syntheses from the cache that are not part of the given composition. If comp is nil, all syntheses will be purged.

func (*Cache) SetQueue added in v0.0.48

func (c *Cache) SetQueue(queue workqueue.TypedRateLimitingInterface[Request])

func (*Cache) Visit added in v0.0.48

func (c *Cache) Visit(ctx context.Context, comp *apiv1.Composition, synUUID string, items []apiv1.ResourceSlice) bool

Visit takes a set of resource slices from the informers and updates the resource status in the cache. Return false if the synthesis is not in the cache.

type ManifestRef added in v0.0.7

type ManifestRef struct {
	Slice types.NamespacedName
	Index int // position of this manifest within the slice
}

ManifestRef references a particular resource manifest within a resource slice.

type Ref

type Ref struct {
	Name, Namespace, Group, Kind string
}

Ref refers to a specific synthesized resource.

func (*Ref) String added in v0.0.47

func (r *Ref) String() string

type Request added in v0.0.48

type Request struct {
	Resource    Ref
	Composition types.NamespacedName
}

type Resource

type Resource struct {
	Ref               Ref
	Manifest          *apiv1.Manifest
	ManifestRef       ManifestRef
	ReconcileInterval *metav1.Duration
	GVK               schema.GroupVersionKind
	ReadinessChecks   readiness.Checks
	Patch             jsonpatch.Patch
	DisableUpdates    bool
	ReadinessGroup    int

	// DefinedGroupKind is set on CRDs to represent the resource type they define.
	DefinedGroupKind *schema.GroupKind
	// contains filtered or unexported fields
}

Resource is the controller's internal representation of a single resource out of a ResourceSlice.

func NewResource

func NewResource(ctx context.Context, slice *apiv1.ResourceSlice, index int) (*Resource, error)

func (*Resource) Deleted

func (r *Resource) Deleted(comp *apiv1.Composition) bool

func (*Resource) FindStatus added in v0.0.7

func (r *Resource) FindStatus(slice *apiv1.ResourceSlice) *apiv1.ResourceState

func (*Resource) Less added in v0.0.47

func (r *Resource) Less(than *Resource) bool

Less returns true when r < than. Used to establish determinstic ordering for conflicting resources.

func (*Resource) Merge added in v0.0.45

Merge performs a three-way merge between the resource, it's old/previous Resource, and the current state. Falls back to a non-structured three-way merge if the SchemaGetter returns a nil TypeRef.

func (*Resource) NeedsToBePatched added in v0.0.6

func (r *Resource) NeedsToBePatched(current *unstructured.Unstructured) bool

func (*Resource) ObserveReconciliation

func (l *Resource) ObserveReconciliation() time.Duration

func (*Resource) Parse

func (r *Resource) Parse() (*unstructured.Unstructured, error)

type SchemaGetter added in v0.0.45

type SchemaGetter interface {
	Get(ctx context.Context, gvk schema.GroupVersionKind) (typeref *smdschema.TypeRef, schem *smdschema.Schema, err error)
}

Jump to

Keyboard shortcuts

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