committer

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatuslessCommitter added in v0.11.0

func NewStatuslessCommitter[R StatuslessResource, P Patcher[R]](patcher ClusterPatcher[R, P], shallowCopy ObjectMetaShallowCopy[R]) func(context.Context, R, R) error

NewStatuslessCommitter returns a function that can patch instances of status-less R.

func NewStatuslessCommitterScoped added in v0.11.0

func NewStatuslessCommitterScoped[R StatuslessResource](patcher Patcher[R], shallowCopy ObjectMetaShallowCopy[R]) func(context.Context, R, R) error

NewStatuslessCommitterScoped returns a function that can patch instances of status-less R changes using a scoped patcher.

func ShallowCopy added in v0.11.0

func ShallowCopy[R any](obj *R) *R

ShallowCopy does a shallow copy using Golang's default assignment operator.

Types

type ClusterPatcher added in v0.10.0

type ClusterPatcher[R runtime.Object, P Patcher[R]] interface {
	Cluster(cluster logicalcluster.Path) P
}

ClusterPatcher is just the cluster-aware Patch API with a generic to keep use sites type safe.

type CommitFunc added in v0.11.0

type CommitFunc[Sp any, St any] func(context.Context, *Resource[Sp, St], *Resource[Sp, St]) error

CommitFunc is an alias to clean up type declarations.

func NewCommitter

func NewCommitter[R runtime.Object, P Patcher[R], Sp any, St any](patcher ClusterPatcher[R, P]) CommitFunc[Sp, St]

NewCommitter returns a function that can patch instances of R based on meta, spec or status changes using a cluster-aware patcher.

func NewCommitterScoped added in v0.10.0

func NewCommitterScoped[R runtime.Object, P Patcher[R], Sp any, St any](patcher Patcher[R]) CommitFunc[Sp, St]

NewCommitterScoped returns a function that can patch instances of R based on meta, spec or status changes using a patcher scoped to a specific cluster.

type ObjectMetaShallowCopy added in v0.11.0

type ObjectMetaShallowCopy[R any] func(obj R) R

ObjectMetaShallowCopy copies the object such that the ObjectMeta is a shallow copy that can be mutated without mutating the input object.

type Patcher

type Patcher[R runtime.Object] interface {
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (R, error)
}

Patcher is just the Patch API with a generic to keep use sites type safe.

type Resource

type Resource[Sp any, St any] struct {
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Sp `json:"spec"`
	Status            St `json:"status,omitempty"`
}

Resource is a generic wrapper around resources so we can generate patches.

type StatuslessResource added in v0.11.0

type StatuslessResource interface {
	runtime.Object
	metav1.Object
}

Jump to

Keyboard shortcuts

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