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
- func InstallOrUpgradeChart(ctx context.Context, client Interface, repoConfig RepoConfig, ...) error
- type ChartConfig
- type ChartSpec
- type Client
- func (c *Client) AddRepository(ctx context.Context, entry *RepositoryEntry) error
- func (c *Client) InstallChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
- func (c *Client) InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
- func (c *Client) UninstallRelease(ctx context.Context, releaseName, namespace string) error
- type Interface
- type MockInterface
- func (_mock *MockInterface) AddRepository(ctx context.Context, entry *RepositoryEntry) error
- func (_m *MockInterface) EXPECT() *MockInterface_Expecter
- func (_mock *MockInterface) InstallChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
- func (_mock *MockInterface) InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)
- func (_mock *MockInterface) UninstallRelease(ctx context.Context, releaseName string, namespace string) error
- type MockInterface_AddRepository_Call
- func (_c *MockInterface_AddRepository_Call) Return(err error) *MockInterface_AddRepository_Call
- func (_c *MockInterface_AddRepository_Call) Run(run func(ctx context.Context, entry *RepositoryEntry)) *MockInterface_AddRepository_Call
- func (_c *MockInterface_AddRepository_Call) RunAndReturn(run func(ctx context.Context, entry *RepositoryEntry) error) *MockInterface_AddRepository_Call
- type MockInterface_Expecter
- func (_e *MockInterface_Expecter) AddRepository(ctx interface{}, entry interface{}) *MockInterface_AddRepository_Call
- func (_e *MockInterface_Expecter) InstallChart(ctx interface{}, spec interface{}) *MockInterface_InstallChart_Call
- func (_e *MockInterface_Expecter) InstallOrUpgradeChart(ctx interface{}, spec interface{}) *MockInterface_InstallOrUpgradeChart_Call
- func (_e *MockInterface_Expecter) UninstallRelease(ctx interface{}, releaseName interface{}, namespace interface{}) *MockInterface_UninstallRelease_Call
- type MockInterface_InstallChart_Call
- func (_c *MockInterface_InstallChart_Call) Return(releaseInfo *ReleaseInfo, err error) *MockInterface_InstallChart_Call
- func (_c *MockInterface_InstallChart_Call) Run(run func(ctx context.Context, spec *ChartSpec)) *MockInterface_InstallChart_Call
- func (_c *MockInterface_InstallChart_Call) RunAndReturn(run func(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)) *MockInterface_InstallChart_Call
- type MockInterface_InstallOrUpgradeChart_Call
- func (_c *MockInterface_InstallOrUpgradeChart_Call) Return(releaseInfo *ReleaseInfo, err error) *MockInterface_InstallOrUpgradeChart_Call
- func (_c *MockInterface_InstallOrUpgradeChart_Call) Run(run func(ctx context.Context, spec *ChartSpec)) *MockInterface_InstallOrUpgradeChart_Call
- func (_c *MockInterface_InstallOrUpgradeChart_Call) RunAndReturn(run func(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)) *MockInterface_InstallOrUpgradeChart_Call
- type MockInterface_UninstallRelease_Call
- func (_c *MockInterface_UninstallRelease_Call) Return(err error) *MockInterface_UninstallRelease_Call
- func (_c *MockInterface_UninstallRelease_Call) Run(run func(ctx context.Context, releaseName string, namespace string)) *MockInterface_UninstallRelease_Call
- func (_c *MockInterface_UninstallRelease_Call) RunAndReturn(run func(ctx context.Context, releaseName string, namespace string) error) *MockInterface_UninstallRelease_Call
- type ReleaseInfo
- type RepoConfig
- type RepositoryEntry
Constants ¶
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 (*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 ¶
InstallChart installs a Helm chart using the provided specification.
func (*Client) InstallOrUpgradeChart ¶
InstallOrUpgradeChart upgrades a Helm chart when present and installs it otherwise.
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 ¶
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 ¶
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 (_c *MockInterface_AddRepository_Call) Return(err error) *MockInterface_AddRepository_Call
func (*MockInterface_AddRepository_Call) Run ¶
func (_c *MockInterface_AddRepository_Call) Run(run func(ctx context.Context, entry *RepositoryEntry)) *MockInterface_AddRepository_Call
func (*MockInterface_AddRepository_Call) RunAndReturn ¶
func (_c *MockInterface_AddRepository_Call) RunAndReturn(run func(ctx context.Context, entry *RepositoryEntry) error) *MockInterface_AddRepository_Call
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 ¶
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 (_c *MockInterface_InstallChart_Call) Return(releaseInfo *ReleaseInfo, err error) *MockInterface_InstallChart_Call
func (*MockInterface_InstallChart_Call) Run ¶
func (_c *MockInterface_InstallChart_Call) Run(run func(ctx context.Context, spec *ChartSpec)) *MockInterface_InstallChart_Call
func (*MockInterface_InstallChart_Call) RunAndReturn ¶
func (_c *MockInterface_InstallChart_Call) RunAndReturn(run func(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)) *MockInterface_InstallChart_Call
type MockInterface_InstallOrUpgradeChart_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 (_c *MockInterface_InstallOrUpgradeChart_Call) Return(releaseInfo *ReleaseInfo, err error) *MockInterface_InstallOrUpgradeChart_Call
func (*MockInterface_InstallOrUpgradeChart_Call) Run ¶
func (_c *MockInterface_InstallOrUpgradeChart_Call) Run(run func(ctx context.Context, spec *ChartSpec)) *MockInterface_InstallOrUpgradeChart_Call
func (*MockInterface_InstallOrUpgradeChart_Call) RunAndReturn ¶
func (_c *MockInterface_InstallOrUpgradeChart_Call) RunAndReturn(run func(ctx context.Context, spec *ChartSpec) (*ReleaseInfo, error)) *MockInterface_InstallOrUpgradeChart_Call
type MockInterface_UninstallRelease_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 (_c *MockInterface_UninstallRelease_Call) Return(err error) *MockInterface_UninstallRelease_Call
func (*MockInterface_UninstallRelease_Call) Run ¶
func (_c *MockInterface_UninstallRelease_Call) Run(run func(ctx context.Context, releaseName string, namespace string)) *MockInterface_UninstallRelease_Call
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.