helm

package
v5.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package helm provides client helpers for interacting with Helm in KSail.

This package wraps the Helm Go SDK and provides utilities for managing Helm charts, repositories, and releases, including installation and repository management.

Index

Constants

View Source
const (
	// DefaultTimeout defines the fallback Helm chart installation timeout.
	DefaultTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func InstallOrUpgradeChart

func InstallOrUpgradeChart(
	ctx context.Context,
	client Interface,
	repoConfig RepoConfig,
	chartConfig ChartConfig,
	timeout time.Duration,
) error

InstallOrUpgradeChart performs a Helm install or upgrade operation.

Types

type ChartConfig

type ChartConfig struct {
	// ReleaseName is the Helm release name.
	ReleaseName string
	// ChartName is the chart identifier (e.g., "repo/chart").
	ChartName string
	// Namespace is the Kubernetes namespace for installation.
	Namespace string
	// RepoURL is the Helm repository URL.
	RepoURL string
	// CreateNamespace determines if the namespace should be created.
	CreateNamespace bool
	// SetJSONVals contains JSON values to set during installation.
	SetJSONVals map[string]string
}

ChartConfig holds chart installation configuration.

type ChartSpec

type ChartSpec struct {
	ReleaseName string
	ChartName   string
	Namespace   string
	Version     string

	CreateNamespace bool
	Atomic          bool
	Wait            bool
	WaitForJobs     bool
	Timeout         time.Duration
	Silent          bool
	UpgradeCRDs     bool

	ValuesYaml  string
	ValueFiles  []string
	SetValues   map[string]string
	SetFileVals map[string]string
	SetJSONVals map[string]string

	RepoURL               string
	Username              string
	Password              string
	CertFile              string
	KeyFile               string
	CaFile                string
	InsecureSkipTLSverify bool
}

ChartSpec mirrors the mittwald chart specification while keeping KSail specific convenience fields.

type Client

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

Client represents the default helm implementation used by KSail.

func NewClient

func NewClient(kubeConfig, kubeContext string) (*Client, error)

NewClient creates a Helm client using the provided kubeconfig and context.

func (*Client) AddRepository

func (c *Client) AddRepository(ctx context.Context, entry *RepositoryEntry) error

AddRepository registers a Helm repository for the current client instance.

func (*Client) InstallChart

func (c *Client) InstallChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)

InstallChart installs a Helm chart using the provided specification.

func (*Client) InstallOrUpgradeChart

func (c *Client) InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)

InstallOrUpgradeChart upgrades a Helm chart when present and installs it otherwise.

func (*Client) UninstallRelease

func (c *Client) UninstallRelease(ctx context.Context, releaseName, namespace string) error

UninstallRelease removes a Helm release by name within the provided namespace.

type Interface

type Interface interface {
	InstallChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
	InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
	UninstallRelease(ctx context.Context, releaseName, namespace string) error
	AddRepository(ctx context.Context, entry *RepositoryEntry) error
}

Interface defines the subset of Helm functionality required by KSail.

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockInterface

NewMockInterface creates a new instance of MockInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockInterface) AddRepository

func (_mock *MockInterface) AddRepository(ctx context.Context, entry *RepositoryEntry) error

AddRepository provides a mock function for the type MockInterface

func (*MockInterface) EXPECT

func (_m *MockInterface) EXPECT() *MockInterface_Expecter

func (*MockInterface) InstallChart

func (_mock *MockInterface) InstallChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)

InstallChart provides a mock function for the type MockInterface

func (*MockInterface) InstallOrUpgradeChart

func (_mock *MockInterface) InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)

InstallOrUpgradeChart provides a mock function for the type MockInterface

func (*MockInterface) UninstallRelease

func (_mock *MockInterface) UninstallRelease(ctx context.Context, releaseName string, namespace string) error

UninstallRelease provides a mock function for the type MockInterface

type MockInterface_AddRepository_Call

type MockInterface_AddRepository_Call struct {
	*mock.Call
}

MockInterface_AddRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRepository'

func (*MockInterface_AddRepository_Call) Return

func (*MockInterface_AddRepository_Call) Run

func (*MockInterface_AddRepository_Call) RunAndReturn

type MockInterface_Expecter

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

func (*MockInterface_Expecter) AddRepository

func (_e *MockInterface_Expecter) AddRepository(ctx interface{}, entry interface{}) *MockInterface_AddRepository_Call

AddRepository is a helper method to define mock.On call

  • ctx context.Context
  • entry *RepositoryEntry

func (*MockInterface_Expecter) InstallChart

func (_e *MockInterface_Expecter) InstallChart(ctx interface{}, spec interface{}) *MockInterface_InstallChart_Call

InstallChart is a helper method to define mock.On call

  • ctx context.Context
  • spec *ChartSpec

func (*MockInterface_Expecter) InstallOrUpgradeChart

func (_e *MockInterface_Expecter) InstallOrUpgradeChart(ctx interface{}, spec interface{}) *MockInterface_InstallOrUpgradeChart_Call

InstallOrUpgradeChart is a helper method to define mock.On call

  • ctx context.Context
  • spec *ChartSpec

func (*MockInterface_Expecter) UninstallRelease

func (_e *MockInterface_Expecter) UninstallRelease(ctx interface{}, releaseName interface{}, namespace interface{}) *MockInterface_UninstallRelease_Call

UninstallRelease is a helper method to define mock.On call

  • ctx context.Context
  • releaseName string
  • namespace string

type MockInterface_InstallChart_Call

type MockInterface_InstallChart_Call struct {
	*mock.Call
}

MockInterface_InstallChart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallChart'

func (*MockInterface_InstallChart_Call) Return

func (*MockInterface_InstallChart_Call) Run

func (*MockInterface_InstallChart_Call) RunAndReturn

type MockInterface_InstallOrUpgradeChart_Call

type MockInterface_InstallOrUpgradeChart_Call struct {
	*mock.Call
}

MockInterface_InstallOrUpgradeChart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallOrUpgradeChart'

func (*MockInterface_InstallOrUpgradeChart_Call) Return

func (*MockInterface_InstallOrUpgradeChart_Call) Run

func (*MockInterface_InstallOrUpgradeChart_Call) RunAndReturn

type MockInterface_UninstallRelease_Call

type MockInterface_UninstallRelease_Call struct {
	*mock.Call
}

MockInterface_UninstallRelease_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UninstallRelease'

func (*MockInterface_UninstallRelease_Call) Return

func (*MockInterface_UninstallRelease_Call) Run

func (*MockInterface_UninstallRelease_Call) RunAndReturn

func (_c *MockInterface_UninstallRelease_Call) RunAndReturn(run func(ctx context.Context, releaseName string, namespace string) error) *MockInterface_UninstallRelease_Call

type ReleaseInfo

type ReleaseInfo struct {
	Name       string
	Namespace  string
	Revision   int
	Status     string
	Chart      string
	AppVersion string
	Updated    time.Time
	Notes      string
}

ReleaseInfo captures metadata about a Helm release after an operation.

type RepoConfig

type RepoConfig struct {
	// Name is the repository identifier used in Helm commands.
	Name string
	// URL is the Helm repository URL.
	URL string
	// RepoName is the human-readable name used in error messages.
	RepoName string
}

RepoConfig holds repository configuration for a Helm chart.

type RepositoryEntry

type RepositoryEntry struct {
	Name                  string
	URL                   string
	Username              string
	Password              string
	CertFile              string
	KeyFile               string
	CaFile                string
	InsecureSkipTLSverify bool
	PlainHTTP             bool
}

RepositoryEntry describes a Helm repository that should be added locally before performing chart operations.

Jump to

Keyboard shortcuts

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