helm

package
v0.0.0-...-40f1ada Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeYAMLValues

func MergeYAMLValues(tempDir string, vs ...[]byte) (map[string]any, error)

MergeYAMLValues uses helm's values package to merge a collection of YAML values in accordance with helm's merging logic. Sadly, their merging logic is not exported nor can it accept raw JSON/YAML so we dump files on disk.

func ToFlags

func ToFlags(flagsStruct any) []string

ToFlags is a reflect based helper that translates a go struct with `flag` tags into a string slice of command line arguments. If flagsStruct is not a struct, ToFlags panics.

func UpdateChartLock

func UpdateChartLock(chartLock ChartLock, filepath string) error

Types

type Chart

type Chart struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	AppVersion  string `json:"app_version"`
	Description string `json:"description"`
}

type ChartLock

type ChartLock struct {
	// Generated is the date the lock file was last generated.
	Generated time.Time `json:"generated"`
	// Digest is a hash of the dependencies in Chart.yaml.
	Digest string `json:"digest"`
	// Dependencies is the list of dependencies that this lock file has locked.
	Dependencies []*Dependency `json:"dependencies"`
}

ChartLock is a helm lock file for dependencies.

func GetChartLock

func GetChartLock(filePath string) (ChartLock, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a sandboxed programmatic API for the `helm` CLI.

It leverages an isolated HELM_CONFIG_HOME directory to keep operation hermetic but shares a global cache to keep network chatter to a minimum. See `helm env` for more details.

func New

func New(opts Options) (*Client, error)

New creates a new helm client.

func (*Client) DependencyBuild

func (c *Client) DependencyBuild(ctx context.Context, chartDir string) error

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, url, filename string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, namespace, name string) (Release, error)

func (*Client) GetConfigHome

func (c *Client) GetConfigHome() string

func (*Client) GetValues

func (c *Client) GetValues(ctx context.Context, release *Release, values any) error

func (*Client) Install

func (c *Client) Install(ctx context.Context, chart string, opts InstallOptions) (Release, error)

func (*Client) List

func (c *Client) List(ctx context.Context) ([]Release, error)

func (*Client) RepoAdd

func (c *Client) RepoAdd(ctx context.Context, name, url string) error

func (*Client) RepoList

func (c *Client) RepoList(ctx context.Context) ([]Repo, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, keyword string) ([]Chart, error)

func (*Client) ShowValues

func (c *Client) ShowValues(ctx context.Context, chart string, values any) error

func (*Client) Template

func (c *Client) Template(ctx context.Context, chart string, opts TemplateOptions) ([]byte, error)

func (*Client) Test

func (c *Client) Test(ctx context.Context, release Release) error

func (*Client) Uninstall

func (c *Client) Uninstall(ctx context.Context, release Release) error

func (*Client) Upgrade

func (c *Client) Upgrade(ctx context.Context, release, chart string, opts UpgradeOptions) (Release, error)

type Dependency

type Dependency struct {
	// Name is the name of the dependency.
	//
	// This must mach the name in the dependency's Chart.yaml.
	Name string `json:"name"`
	// Version is the version (range) of this chart.
	//
	// A lock file will always produce a single version, while a dependency
	// may contain a semantic version range.
	Version string `json:"version,omitempty"`
	// The URL to the repository.
	//
	// Appending `index.yaml` to this string should result in a URL that can be
	// used to fetch the repository index.
	Repository string `json:"repository"`
	// A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
	Condition string `json:"condition,omitempty"`
	// Tags can be used to group charts for enabling/disabling together
	Tags []string `json:"tags,omitempty"`
	// Enabled bool determines if chart should be loaded
	Enabled bool `json:"enabled,omitempty"`
	// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
	// string or pair of child/parent sublist items.
	ImportValues []interface{} `json:"import-values,omitempty"`
	// Alias usable alias to be used for the chart
	Alias string `json:"alias,omitempty"`
}

Dependency describes a chart upon which another chart depends.

type InstallOptions

type InstallOptions struct {
	CreateNamespace bool     `flag:"create-namespace"`
	Name            string   `flag:"-"`
	Namespace       string   `flag:"namespace"`
	Values          any      `flag:"-"`
	Version         string   `flag:"version"`
	NoWait          bool     `flag:"wait"`
	NoWaitForJobs   bool     `flag:"wait-for-jobs"`
	GenerateName    bool     `flag:"generate-name"`
	ValuesFile      string   `flag:"values"`
	Set             []string `flag:"set"`
}

type Options

type Options struct {
	ConfigHome string
	KubeConfig *rest.Config
}

type RawYAML

type RawYAML []byte

type Release

type Release struct {
	Name       string    `json:"name"`
	Namespace  string    `json:"namespace"`
	Revision   int       `json:"revision"`
	DeployedAt time.Time `json:"deployedAt"`
	Status     string    `json:"status"`
	Chart      string    `json:"chart"`
	AppVersion string    `json:"app_version"`
}

type Repo

type Repo struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type TemplateOptions

type TemplateOptions struct {
	Name         string   `flag:"-"`
	Namespace    string   `flag:"namespace"`
	Values       any      `flag:"-"`
	Version      string   `flag:"version"`
	GenerateName bool     `flag:"generate-name"`
	ValuesFile   string   `flag:"values"`
	Set          []string `flag:"set"`
	SkipTests    bool     `flag:"skip-tests"`
}

type UpgradeOptions

type UpgradeOptions struct {
	CreateNamespace bool     `flag:"create-namespace"`
	Install         bool     `flag:"install"`
	Namespace       string   `flag:"namespace"`
	Version         string   `flag:"version"`
	NoWait          bool     `flag:"wait"`
	NoWaitForJobs   bool     `flag:"wait-for-jobs"`
	ReuseValues     bool     `flag:"reuse-values"`
	Values          any      `flag:"-"`
	ValuesFile      string   `flag:"values"`
	Set             []string `flag:"set"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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