chartutil

package
v0.37.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResourceNotFound signals the referenced values resource could not be
	// found.
	ErrResourceNotFound = errors.New("resource not found")
	// ErrKeyNotFound signals the key could not be found in the referenced
	// values resource.
	ErrKeyNotFound = errors.New("key not found")
	// ErrUnsupportedRefKind signals the values reference kind is not
	// supported.
	ErrUnsupportedRefKind = errors.New("unsupported values reference kind")
	// ErrValuesDataRead signals the referenced resource's values data could
	// not be read.
	ErrValuesDataRead = errors.New("failed to read values data")
	// ErrValueMerge signals a single value could not be merged into the
	// values.
	ErrValueMerge = errors.New("failed to merge value")
	// ErrUnknown signals the reason an error occurred is unknown.
	ErrUnknown = errors.New("unknown error")
)

Functions

func ChartValuesFromReferences

func ChartValuesFromReferences(ctx context.Context, client kubeclient.Client, namespace string,
	values map[string]interface{}, refs ...v2.ValuesReference) (chartutil.Values, error)

ChartValuesFromReferences attempts to construct new chart values by resolving the provided references using the client, merging them in the order given. If provided, the values map is merged in last. Overwriting values from references. It returns the merged values, or an ErrValuesReference error.

func DigestValues

func DigestValues(algo digest.Algorithm, values chartutil.Values) digest.Digest

DigestValues calculates the digest of the values using the provided algorithm. The caller is responsible for ensuring that the algorithm is supported.

func ReplacePathValue

func ReplacePathValue(values chartutil.Values, path string, value string) error

ReplacePathValue replaces the value at the dot notation path with the given value using Helm's string value parser using strvals.ParseInto. Single or double-quoted values are merged using strvals.ParseIntoString.

func VerifyValues

func VerifyValues(digest digest.Digest, values chartutil.Values) bool

VerifyValues verifies the digest of the values against the provided digest.

Types

type ErrValuesRefReason

type ErrValuesRefReason error

ErrValuesRefReason is the descriptive reason for an ErrValuesReference.

type ErrValuesReference

type ErrValuesReference struct {
	// Reason for the values reference error. Nil equals ErrUnknown.
	// Can be used with Is to reason about a returned error:
	//  err := &ErrValuesReference{Reason: ErrResourceNotFound, ...}
	//  errors.Is(err, ErrResourceNotFound)
	Reason ErrValuesRefReason
	// Kind of the values reference the error is being reported for.
	Kind string
	// Name of the values reference the error is being reported for.
	Name types.NamespacedName
	// Key of the values reference the error is being reported for.
	Key string
	// Optional indicates if the error is being reported for an optional values
	// reference.
	Optional bool
	// Err contains the further error chain leading to this error, it can be
	// nil.
	Err error
}

ErrValuesReference is returned by ChartValuesFromReferences

func NewErrValuesReference

func NewErrValuesReference(name types.NamespacedName, ref v2.ValuesReference, reason ErrValuesRefReason, err error) *ErrValuesReference

NewErrValuesReference returns a new ErrValuesReference constructed from the provided values.

func (*ErrValuesReference) Error

func (e *ErrValuesReference) Error() string

Error returns an error string constructed out of the state of ErrValuesReference.

func (*ErrValuesReference) Is

func (e *ErrValuesReference) Is(target error) bool

Is returns if target == Reason, or target == Err. Can be used to Reason about a returned error:

err := &ErrValuesReference{Reason: ErrResourceNotFound, ...}
errors.Is(err, ErrResourceNotFound)

func (*ErrValuesReference) Unwrap

func (e *ErrValuesReference) Unwrap() error

Unwrap returns the wrapped Err.

Jump to

Keyboard shortcuts

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