Documentation ¶
Overview ¶
Package updater provides a way to update Kubernetes resources. Inspired by controllerutil, gardener, and the kubernetes statefulset controller. https://github.com/gardener/gardener/blob/master/docs/development/kubernetes-clients.md https://github.com/kubernetes/kubernetes/blob/ee265c92fec40cd69d1de010b477717e4c142492/pkg/controller/history/controller_history.go#L92
Index ¶
- Constants
- func CreateOrUpdateFromTemplate(ctx context.Context, c client.Client, template client.Object) (client.Object, error)
- func GetHash(obj runtime.Object) (string, error)
- func HashObject(obj runtime.Object) string
- func StoreHash(obj runtime.Object, hash string) error
- func UpdateStatus(ctx context.Context, c client.Client, obj client.Object, f MutateFunc) error
- type MutateFunc
Constants ¶
const (
// AnnotationKey is the key used to store the hash of the template object.
AnnotationKey = "controller-essentials.pecke.tt/template-hash"
)
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdateFromTemplate ¶
func CreateOrUpdateFromTemplate(ctx context.Context, c client.Client, template client.Object) (client.Object, error)
CreateOrUpdateFromTemplate creates or updates the given object using the given template.
func HashObject ¶
HashObject returns a hash of the given object. This is inspired by the way Kubernetes manages controller revisions in StatefulSets: https://github.com/kubernetes/kubernetes/blob/ee265c92fec40cd69d1de010b477717e4c142492/pkg/controller/history/controller_history.go#L92
func UpdateStatus ¶
UpdateStatus updates the status of the given object using a mutating function.
Types ¶
type MutateFunc ¶
type MutateFunc func() error