updater

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 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 = "gpu-ninja.com/template-hash"
)

Variables

This section is empty.

Functions

func CreateOrUpdateFromTemplate added in v0.4.1

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 added in v0.4.1

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

func HashObject added in v0.4.1

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 added in v0.4.1

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

func UpdateStatus

func UpdateStatus(ctx context.Context, c client.Client, key client.ObjectKey, 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