Documentation ¶
Index ¶
- Variables
- func Digest(algo digest.Algorithm, rel Observation) digest.Digest
- func GetTestHooks(rls *helmrelease.Release) map[string]*helmrelease.Hook
- func IgnoreHookTestEvents(rel *Observation)
- func IsHookForEvent(hook *helmrelease.Hook, event helmrelease.HookEvent) bool
- func ObservedToSnapshot(rls Observation) *v2.Snapshot
- func ShortenName(name string) string
- func TestHooksFromRelease(rls *helmrelease.Release) map[string]*v2.TestHookStatus
- type DataFilter
- type Observation
Constants ¶
This section is empty.
Variables ¶
var ( DefaultDataFilters = []DataFilter{ IgnoreHookTestEvents, } )
Functions ¶
func Digest ¶
func Digest(algo digest.Algorithm, rel Observation) digest.Digest
Digest calculates the digest of the given Observation by JSON encoding it into a hash.Hash of the given digest.Algorithm. The algorithm is expected to have been confirmed to be available by the caller, not doing this may result in panics.
func GetTestHooks ¶
func GetTestHooks(rls *helmrelease.Release) map[string]*helmrelease.Hook
GetTestHooks returns the list of test hooks for the given release, indexed by hook name.
func IgnoreHookTestEvents ¶
func IgnoreHookTestEvents(rel *Observation)
IgnoreHookTestEvents ignores test event hooks. For example, to exclude it while generating a digest for the object. To prevent manual test triggers from a user to interfere with the checksum.
func IsHookForEvent ¶
func IsHookForEvent(hook *helmrelease.Hook, event helmrelease.HookEvent) bool
IsHookForEvent returns if the given hook fires on the provided event.
func ObservedToSnapshot ¶
func ObservedToSnapshot(rls Observation) *v2.Snapshot
ObservedToSnapshot returns a v2beta2.Snapshot constructed from the Observation data. Calculating the (config) digest using the digest.Canonical algorithm.
func ShortenName ¶
ShortenName returns a short release name in the format of '<shortened releaseName>-<hash>' for the given name if it exceeds 53 characters in length.
The shortening is done by hashing the given release name with SHA256 and taking the first 12 characters of the resulting hash. The hash is then appended to the release name shortened to 40 characters divided by a hyphen separator.
For example: 'some-front-appended-namespace-release-wi-1234567890ab' where '1234567890ab' are the first 12 characters of the SHA hash.
func TestHooksFromRelease ¶
func TestHooksFromRelease(rls *helmrelease.Release) map[string]*v2.TestHookStatus
TestHooksFromRelease returns the list of v2beta2.TestHookStatus for the given release, indexed by name.
Types ¶
type DataFilter ¶
type DataFilter func(rel *Observation)
DataFilter allows for filtering data from the returned Observation while making an observation.
type Observation ¶
type Observation struct { // Name of the release. Name string `json:"name"` // Version of the release, at times also called revision. Version int `json:"version"` // Info provides information about the release. Info helmrelease.Info `json:"info"` // ChartMetadata contains the current Chartfile data of the release. ChartMetadata chart.Metadata `json:"chartMetadata"` // Config is the set of extra Values added to the chart. // These values override the default values inside the chart. Config map[string]interface{} `json:"config"` // Manifest is the string representation of the rendered template. Manifest string `json:"manifest"` // Hooks are all the hooks declared for this release, and the current // state they are in. Hooks []helmrelease.Hook `json:"hooks"` // Namespace is the Kubernetes namespace of the release. Namespace string `json:"namespace"` }
Observation is a copy of a Helm release object, as observed to be written to the storage by a storage.Observer. The object is detached from the Helm storage object, and mutations to it do not change the underlying release object.
func ObserveRelease ¶
func ObserveRelease(rel *helmrelease.Release, filter ...DataFilter) Observation
ObserveRelease deep copies the values from the provided release.Release into a new Observation while omitting all chart data except metadata. If no filters are provided, it defaults to DefaultDataFilters. To not use any filters, pass an explicit empty slice.