updater

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
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 GetHash

func GetHash(obj runtime.Object) (string, error)

func HashObject

func HashObject(obj runtime.Object) string

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 StoreHash

func StoreHash(obj runtime.Object, hash string) error

func UpdateStatus

func UpdateStatus(ctx context.Context, c client.Client, obj client.Object, f MutateFunc) error

UpdateStatus updates the status of the given object using a mutating function.

Types

type MutateFunc

type MutateFunc func() error

Jump to

Keyboard shortcuts

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