hash

package
v1.12.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// TemplateHashLabelName is a label to annotate a Kubernetes resource
	// with the hash of its initial template before creation.
	TemplateHashLabelName = "cstor.openebs.io/template-hash"
)

Variables

This section is empty.

Functions

func GetTemplateHashLabel

func GetTemplateHashLabel(labels map[string]string) string

GetTemplateHashLabel returns the template hash label value if set, or an empty string.

func Hash

func Hash(obj interface{}) (string, error)

Hash constructs the hash value for any type of object

func HashObject

func HashObject(object interface{}) string

HashObject writes the specified object to a hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes. The returned hash can be used for object comparisons.

This is inspired by controller revisions in StatefulSets: https://github.com/kubernetes/kubernetes/blob/8de1569ddae62e8fab559fe6bd210a5d6100a277/pkg/controller/history/controller_history.go#L89-L101

func SetTemplateHashLabel

func SetTemplateHashLabel(labels map[string]string, template interface{}) map[string]string

SetTemplateHashLabel adds a label containing the hash of the given template into the given labels. This label can then be used for template or resource comparisons.

Types

This section is empty.

Jump to

Keyboard shortcuts

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