committer

package
v0.20.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatuslessCommitter

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

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

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

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

Types

type ClusterPatcher

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

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

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

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

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