hash

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hash allows the user to get a hash number for a given Kubernetes object. This is useful to detect when a derived resource need to be changed too.

The code in this package is adapted from:

https://github.com/kubernetes/kubernetes/blob/master/pkg/util/hash/hash.go // wokeignore:rule=master https://github.com/kubernetes/kubernetes/blob/ea07644/pkg/controller/controller_utils.go#L1189

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(object interface{}) (string, error)

ComputeHash returns a hash value calculated from the provided object. The hash will be safe encoded to avoid bad words.

func ComputeVersionedHash added in v1.19.6

func ComputeVersionedHash(object interface{}, epoc int) (string, error)

ComputeVersionedHash follows the same rules of ComputeHash with the exception that accepts also a epoc value. The epoc value is used to generate a new hash from a same object. This is useful to force a new hash even if the original object is not changed. A practical use is to force a reconciliation loop of the object.

func DeepHashObject

func DeepHashObject(hasher hash.Hash, objectToWrite interface{}) error

DeepHashObject writes specified object to 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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