helm

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverChartVersions added in v0.7.0

func DiscoverChartVersions(
	ctx context.Context,
	repoURL string,
	chart string,
	semverConstraint string,
	creds *Credentials,
) ([]string, error)

DiscoverChartVersions connects to the specified Helm chart repository and retrieves all available versions of the specified chart, optionally filtering by a SemVer constraint. It then returns the versions in descending order.

The repository can be either a classic chart repository (using HTTP/S) or a repository within an OCI registry. Classic chart repositories can contain differently named charts. When repoURL points to such a repository, the name argument must specify the name of the chart within the repository. In the case of a repository within an OCI registry, the URL implicitly points to a specific chart and the name argument must be empty.

The credentials argument may be nil for public repositories, but must be non-nil for private repositories.

It returns an error if the repository cannot be reached or if the versions cannot be retrieved, but it does not return an error if no versions of the chart are found in the repository.

func NewRegistryClient added in v0.9.0

func NewRegistryClient(authorizer auth.Client) (*registry.Client, error)

NewRegistryClient creates a new registry client using the provided authorizer. This can be combined with an EphemeralAuthorizer to create a client that does not persist credentials to disk. The authorizer is used to authenticate requests to the registry, and the client is configured to write logs to io.Discard, meaning that it will not output any logs to the console or standard output.

func NormalizeChartRepositoryURL added in v0.5.0

func NormalizeChartRepositoryURL(repo string) string

NormalizeChartRepositoryURL normalizes a chart repository URL for purposes of comparison. Crucially, this function removes the oci:// prefix from the URL if there is one.

Types

type ChartDependency added in v1.6.0

type ChartDependency struct {
	Repository string `json:"repository,omitempty"`
	Name       string `json:"name,omitempty"`
	Version    string `json:"version,omitempty"`
}

ChartDependency represents a dependency of a Helm chart.

It contains the repository URL, chart name, and version of the dependency as specified in the chart's Chart.yaml or Chart.lock file.

func GetChartDependencies added in v1.6.0

func GetChartDependencies(p string) ([]ChartDependency, error)

GetChartDependencies reads a Helm chart's Chart.yaml or Chart.lock file and returns a slice of ChartDependency structs representing the chart's dependencies. If the file cannot be read or parsed, an error is returned.

type Credentials

type Credentials struct {
	// Username identifies a principal, which combined with the value of the
	// Password field, can be used for reading from some remote repository.
	Username string
	// Password, when combined with the principal identified by the Username
	// field, can be used for both reading from some remote repository.
	Password string
}

Credentials represents the credentials for connecting to a private Helm chart repository.

type EphemeralAuthorizer added in v1.6.0

type EphemeralAuthorizer struct {
	auth.Client
	credentials.Store
}

EphemeralAuthorizer provides a temporary authorizer for registry operations. It uses an in-memory credentials store and does not persist any credentials to disk. This is useful for ephemeral operations where you do not want to store credentials permanently. For example, because you are working with multiple tenants in a single process.

func NewEphemeralAuthorizer added in v1.6.0

func NewEphemeralAuthorizer() *EphemeralAuthorizer

NewEphemeralAuthorizer creates a new EphemeralAuthorizer with an in-memory credentials store. This authorizer does not persist credentials to disk and is suitable for temporary operations where you do not want to store credentials permanently.

func (*EphemeralAuthorizer) Login added in v1.6.0

func (a *EphemeralAuthorizer) Login(ctx context.Context, host, username, password string) error

Login logs in to the specified registry using the provided username and password. It uses the in-memory credentials store to save the credentials for the registry host. This method does not persist credentials to disk, so it is suitable for ephemeral operations where you do not want to store credentials permanently.

type EphemeralDependencyManager added in v1.6.0

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

EphemeralDependencyManager is a Helm dependency manager that uses an ephemeral Helm home directory for managing chart dependencies. This manager is designed for temporary operations where you do not want to store any Helm-related data permanently, such as when working with multiple tenants in a single process.

func NewEphemeralDependencyManager added in v1.6.0

func NewEphemeralDependencyManager(
	credsDB credentials.Database,
	project, workDir string,
) (*EphemeralDependencyManager, error)

NewEphemeralDependencyManager creates a new EphemeralDependencyManager that uses an ephemeral Helm home directory for managing chart dependencies. This manager is suitable for temporary operations where you do not want to store any Helm-related data permanently, such as when working with multiple tenants in a single process.

When using this manager, it is important to call the Teardown method to clean up the Helm home directory after you are done with it. This will remove the Helm home directory and all its contents, ensuring that no temporary data is left behind.

func (*EphemeralDependencyManager) Build added in v1.6.0

func (em *EphemeralDependencyManager) Build(ctx context.Context, chartPath string) error

Build builds the chart dependencies for the given chart path. It reads the Chart.yaml file to get the list of dependencies, validates them, and then uses the Helm downloader manager to build the dependencies.

Note that if the chart currently does not have a Chart.lock file, the build operation will create one by performing an update operation.

func (*EphemeralDependencyManager) Teardown added in v1.6.0

func (em *EphemeralDependencyManager) Teardown() error

Teardown cleans up the EphemeralDependencyManager by removing the Helm home directory that was created during its initialization. This is useful for cleaning up resources after the dependency manager is no longer needed.

func (*EphemeralDependencyManager) Update added in v1.6.0

func (em *EphemeralDependencyManager) Update(
	ctx context.Context,
	chartPath string,
	updates ...ChartDependency,
) (map[string]string, error)

Update updates the chart dependencies for the given chart path. It reads the Chart.yaml file to get the list of dependencies, validates them, and then processes any updates specified in the updates slice.

It returns a map of changes where the keys are the names of the dependencies and the values are the new versions. If a dependency was removed, the value will be an empty string. If a dependency was updated, the value will be a string indicating the old and new versions in the format "oldVersion -> newVersion".

Jump to

Keyboard shortcuts

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