Documentation
¶
Index ¶
- Constants
- Variables
- func NewCLISettings(namespace string) *cli.EnvSettings
- func NewDefaultHelmClient(fs FsHelper, resourceFetcher ResourceFetcher, helmLoaders HelmFactories) *defaultHelmClient
- func NewNamespaceClient(client v1.NamespaceInterface) *namespaceClient
- type ActionConfigFactory
- type ActionListFactory
- type ChartLoader
- type FsHelper
- type HelmClient
- type HelmFactories
- type HelmInstaller
- type HelmUninstaller
- type Installer
- type InstallerConfig
- type NamespaceCLient
- type ReleaseListRunner
- type ResourceFetcher
Constants ¶
View Source
const ( TempChartFilePermissions = os.FileMode(0644) TempChartPrefix = "temp-helm-chart" )
Variables ¶
View Source
var ( ReleaseAlreadyInstalledErr = func(name, namespace string) error { return eris.Errorf("The helm release you are trying to install (%s) appears"+ " to already exist in %s", name, namespace) } )
Functions ¶
func NewCLISettings ¶
func NewCLISettings(namespace string) *cli.EnvSettings
Build a Helm EnvSettings struct basically, abstracted cli.New() into our own function call because of the weirdness described in the big comment below
func NewDefaultHelmClient ¶
func NewDefaultHelmClient( fs FsHelper, resourceFetcher ResourceFetcher, helmLoaders HelmFactories) *defaultHelmClient
func NewNamespaceClient ¶
func NewNamespaceClient(client v1.NamespaceInterface) *namespaceClient
Types ¶
type ActionConfigFactory ¶
type ActionConfigFactory interface {
NewActionConfig(namespace string) (*action.Configuration, *cli.EnvSettings, error)
}
func NewActionConfigFactory ¶
func NewActionConfigFactory() ActionConfigFactory
type ActionListFactory ¶
type ActionListFactory interface {
ReleaseList(namespace string) (ReleaseListRunner, error)
}
Returns a ReleaseListRunner
func NewActionListFactory ¶
func NewActionListFactory(actionConfigFactory ActionConfigFactory) ActionListFactory
type ChartLoader ¶
slim interface on top of loader to avoid unnecessary FS calls
func NewChartLoader ¶
func NewChartLoader() ChartLoader
type FsHelper ¶
type FsHelper interface {
NewTempFile(dir, prefix string) (f afero.File, err error)
WriteFile(filename string, data []byte, perm os.FileMode) error
RemoveAll(path string) error
}
interface around needed afero functions
type HelmClient ¶
type HelmClient interface {
// Prepare an installation object that can then be .Run() with a chart object
NewInstall(namespace, releaseName string, dryRun bool) (HelmInstaller, *cli.EnvSettings, error)
// Prepare an un-installation object that can then be .Run() with a release name
NewUninstall(namespace string) (HelmUninstaller, error)
// List the already-existing releases in the given namespace
ReleaseList(namespace string) (ReleaseListRunner, error)
// Returns the Helm chart archive located at the given URI (can be either an http(s) address or a file path)
DownloadChart(chartArchiveUri string) (*chart.Chart, error)
// Returns true if the release with the given name exists in the given namespace
ReleaseExists(namespace, releaseName string) (releaseExists bool, err error)
}
This interface implements the Helm CLI actions. The implementation relies on the Helm 3 libraries.
func DefaultHelmClient ¶
func DefaultHelmClient() HelmClient
a HelmClient that talks to the kube api server and creates resources
type HelmFactories ¶
type HelmFactories struct {
ActionConfigFactory ActionConfigFactory
ActionListFactory ActionListFactory
ChartLoader ChartLoader
}
func NewHelmFactories ¶
func NewHelmFactories() HelmFactories
type HelmInstaller ¶
type HelmInstaller interface {
Run(chrt *chart.Chart, vals map[string]interface{}) (*release.Release, error)
}
an interface around Helm's action.Install struct
type HelmUninstaller ¶
type HelmUninstaller interface {
Run(name string) (*release.UninstallReleaseResponse, error)
}
an interface around Helm's action.Uninstall struct
type Installer ¶
type Installer interface {
Install(installerConfig *InstallerConfig) error
}
func MustInstaller ¶
func MustInstaller() Installer
func NewInstaller ¶
func NewInstaller(helmClient HelmClient, kubeNsClient NamespaceCLient, outputWriter io.Writer) Installer
visible for testing
type InstallerConfig ¶
type InstallerConfig struct {
DryRun bool
CreateNamespace bool
Verbose bool
InstallNamespace string
ReleaseName string
// the uri to the helm chart, can either be a local file or a valid http/https link
ReleaseUri string
ValuesFiles []string
ExtraValues map[string]interface{}
PreInstallMessage string
PostInstallMessage string
}
type NamespaceCLient ¶
type NamespaceCLient interface {
Create(ns *corev1.Namespace) (*corev1.Namespace, error)
Delete(name string, options *metav1.DeleteOptions) error
Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)
List(opts metav1.ListOptions) (*corev1.NamespaceList, error)
}
type ReleaseListRunner ¶
an interface around Helm's action.List struct
type ResourceFetcher ¶
type ResourceFetcher interface {
GetResource(uri string) (io.ReadCloser, error)
}
func NewDefaultResourceFetcher ¶
func NewDefaultResourceFetcher() ResourceFetcher
Click to show internal directories.
Click to hide internal directories.