Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRegistryClient ¶
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.
Types ¶
type ChartDependency ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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".