committer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommitter

func NewCommitter[R any, Sp any, St any](patcher NamespacedPatcher[R]) func(context.Context, *Resource[Sp, St], *Resource[Sp, St]) error

NewCommitter returns a function that can patch instances of R based on spec or status changes.

Types

type NamespacedPatcher

type NamespacedPatcher[R any] func(ns string) Patcher[R]

func ClusterScoped

func ClusterScoped[R any](p Patcher[R]) NamespacedPatcher[R]

ClusterScoped wraps a generic patcher to make it look like a namespaced patcher, but it ignores the namespace argument (which is empty string in cluster-scoped code).

type Patcher

type Patcher[R any] 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

Jump to

Keyboard shortcuts

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