common

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Examples

Constants

View Source
const GlobalKey = "global"

GlobalKey is the name of the Values key that is used for storing global vars.

Variables

View Source
var (
	// DefaultVersionSet is the default version set, which includes only Core V1 ("v1").
	DefaultVersionSet = allKnownVersions()

	DefaultCapabilities = func() *Capabilities {
		caps, err := makeDefaultCapabilities()
		if err != nil {
			panic(fmt.Sprintf("failed to create default capabilities: %v", err))
		}
		return caps

	}()
)

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	// KubeVersion is the Kubernetes version.
	KubeVersion KubeVersion
	// APIVersions are supported Kubernetes API versions.
	APIVersions VersionSet
	// HelmVersion is the build information for this helm version
	HelmVersion helmversion.BuildInfo
}

Capabilities describes the capabilities of the Kubernetes cluster.

func (*Capabilities) Copy

func (capabilities *Capabilities) Copy() *Capabilities

type DecodeAndLoadSecretsOptions

type DecodeAndLoadSecretsOptions struct {
	CustomSecretValueFiles     []string
	LoadFromLocalFilesystem    bool
	NoDecryptSecrets           bool
	SecretsWorkingDir          string
	WithoutDefaultSecretValues bool
}

type ErrInvalidChartName

type ErrInvalidChartName struct {
	Name string
}

func (ErrInvalidChartName) Error

func (e ErrInvalidChartName) Error() string

type ErrNoTable

type ErrNoTable struct {
	Key string
}

ErrNoTable indicates that a chart does not have a matching table.

func (ErrNoTable) Error

func (e ErrNoTable) Error() string

type ErrNoValue

type ErrNoValue struct {
	Key string
}

ErrNoValue indicates that Values does not contain a key with a value

func (ErrNoValue) Error

func (e ErrNoValue) Error() string

type File

type File struct {
	// Name is the path-like name of the template.
	Name string `json:"name"`
	// Data is the template as byte data.
	Data []byte `json:"data"`
	// ModTime is the file's mod-time
	ModTime time.Time `json:"modtime,omitzero"`
}

File represents a file as a name/value pair.

By convention, name is a relative path within the scope of the chart's base directory.

type KubeVersion

type KubeVersion struct {
	Version string // Full version (e.g., v1.33.4-gke.1245000)

	Major string // Kubernetes major version
	Minor string // Kubernetes minor version
	// contains filtered or unexported fields
}

KubeVersion is the Kubernetes version.

func ParseKubeVersion

func ParseKubeVersion(version string) (*KubeVersion, error)

ParseKubeVersion parses kubernetes version from string

func (*KubeVersion) GitVersion deprecated

func (kv *KubeVersion) GitVersion() string

GitVersion returns the full Kubernetes version string.

Deprecated: use KubeVersion.Version.

func (*KubeVersion) String

func (kv *KubeVersion) String() string

String implements fmt.Stringer. Returns the normalized version used for constraint checking.

type ReleaseOptions

type ReleaseOptions struct {
	Name      string
	Namespace string
	Revision  int
	IsUpgrade bool
	IsInstall bool
}

ReleaseOptions represents the additional release options needed for the composition of the final values struct

type RuntimeData

type RuntimeData interface {
	DecodeAndLoadSecrets(ctx context.Context, loadedChartFiles []*nelmcommon.BufferedFile, secretsManager *secrets_manager.SecretsManager, opts DecodeAndLoadSecretsOptions) error
	GetDecryptedSecretValues() map[string]interface{}
	GetDecryptedSecretFilesData() map[string]string
}

type Values

type Values map[string]any

Values represents a collection of chart values.

Example
doc := `
title: "Moby Dick"
chapter:
  one:
    title: "Loomings"
  two:
    title: "The Carpet-Bag"
  three:
    title: "The Spouter Inn"
`
d, err := ReadValues([]byte(doc))
if err != nil {
	panic(err)
}
ch1, err := d.Table("chapter.one")
if err != nil {
	panic("could not find chapter one")
}
fmt.Print(ch1["title"])
Output:
Loomings

func ReadValues

func ReadValues(data []byte) (vals Values, err error)

ReadValues will parse YAML byte data into a Values.

func ReadValuesFile

func ReadValuesFile(filename string) (Values, error)

ReadValuesFile will parse a YAML file into a map of values.

func (Values) AsMap

func (v Values) AsMap() map[string]any

AsMap is a utility function for converting Values to a map[string]interface{}.

It protects against nil map panics.

func (Values) Encode

func (v Values) Encode(w io.Writer) error

Encode writes serialized Values information to the given io.Writer.

func (Values) PathValue

func (v Values) PathValue(path string) (any, error)

PathValue takes a path that traverses a YAML structure and returns the value at the end of that path. The path starts at the root of the YAML structure and is comprised of YAML keys separated by periods. Given the following YAML data the value at path "chapter.one.title" is "Loomings".

chapter:
  one:
    title: "Loomings"

func (Values) Table

func (v Values) Table(name string) (Values, error)

Table gets a table (YAML subsection) from a Values object.

The table is returned as a Values.

Compound table names may be specified with dots:

foo.bar

The above will be evaluated as "The table bar inside the table foo".

An ErrNoTable is returned if the table does not exist.

func (Values) YAML

func (v Values) YAML() (string, error)

YAML encodes the Values into a YAML string.

type VersionSet

type VersionSet []string

VersionSet is a set of Kubernetes API versions.

func (VersionSet) Has

func (v VersionSet) Has(apiVersion string) bool

Has returns true if the version string is in the set.

vs.Has("apps/v1")

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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