Documentation ¶
Index ¶
- Constants
- func NewInClusterHelmClient(_, tillerAddr string, _ *rest.Config, _ kubernetes.Interface) (helm.Interface, error)
- func NewInClusterK8sClientset(k8sJWTPath string, enableK8sTracing bool) (*kubernetes.Clientset, *rest.Config, error)
- func NewKubecfgContextK8sClientset(kubecfgpath, kubectx string) (*kubernetes.Clientset, *rest.Config, error)
- func NewTunneledHelmClient(tillerNS, _ string, rcfg *rest.Config, kc kubernetes.Interface) (helm.Interface, error)
- type ChartInstaller
- func NewChartInstaller(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, ...) (*ChartInstaller, error)
- func NewChartInstallerWithClientsetFromContext(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, ...) (*ChartInstaller, error)
- func NewChartInstallerWithoutK8sClient(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, ...) (*ChartInstaller, error)
- func (ci ChartInstaller) BuildAndInstallCharts(ctx context.Context, newenv *EnvInfo, cl ChartLocations) (err error)
- func (ci ChartInstaller) BuildAndInstallChartsIntoExisting(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, ...) error
- func (ci ChartInstaller) BuildAndUpgradeCharts(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, ...) error
- func (ci ChartInstaller) Cleanup(ctx context.Context, objMaxAge time.Duration)
- func (ci ChartInstaller) DeleteNamespace(ctx context.Context, k8senv *models.KubernetesEnvironment) error
- func (ci ChartInstaller) GenerateCharts(ctx context.Context, ns string, newenv *EnvInfo, cloc ChartLocations) (out []metahelm.Chart, err error)
- type ChartLocation
- type ChartLocations
- type EnvInfo
- type FakeInstaller
- func (fi *FakeInstaller) BuildAndInstallCharts(ctx context.Context, newenv *EnvInfo, chartsLocation ChartLocations) error
- func (fi FakeInstaller) BuildAndInstallChartsIntoExisting(ctx context.Context, newenv *EnvInfo, k8senv *models.KubernetesEnvironment, ...) error
- func (fi FakeInstaller) BuildAndUpgradeCharts(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, ...) error
- func (fi FakeInstaller) DeleteNamespace(ctx context.Context, k8senv *models.KubernetesEnvironment) error
- type HelmClientFactoryFunc
- type Installer
- type K8sClientFactoryFunc
- type LogFunc
- type TillerConfig
Constants ¶
const ( DefaultTillerImage = "gcr.io/kubernetes-helm/tiller:v2.16.7" DefaultTillerPort = 44134 DefaultTillerDeploymentName = "tiller-deploy" DefaultTillerServerConnectRetryDelay = 10 * time.Second DefaultTillerServerConnectRetries = 40 )
Defaults for Tiller configuration options, if not specified otherwise
Variables ¶
This section is empty.
Functions ¶
func NewInClusterHelmClient ¶
func NewInClusterHelmClient(_, tillerAddr string, _ *rest.Config, _ kubernetes.Interface) (helm.Interface, error)
NewInClusterHelmClient is a HelmClientFactoryFunc that returns a Helm client configured for use within the k8s cluster
func NewTunneledHelmClient ¶
func NewTunneledHelmClient(tillerNS, _ string, rcfg *rest.Config, kc kubernetes.Interface) (helm.Interface, error)
NewTunneledHelmClient is a HelmClientFactoryFunc that returns a Helm client configured for use with a localhost tunnel to the k8s cluster
Types ¶
type ChartInstaller ¶
type ChartInstaller struct {
// contains filtered or unexported fields
}
ChartInstaller is an object that manages namespaces and install/upgrades/deletes metahelm chart graphs
func NewChartInstaller ¶
func NewChartInstaller(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, mc metrics.Collector, k8sGroupBindings map[string]string, k8sRepoWhitelist []string, k8sSecretInjs map[string]config.K8sSecret, tcfg TillerConfig, k8sJWTPath string, enableK8sTracing bool) (*ChartInstaller, error)
NewChartInstaller returns a ChartInstaller configured with an in-cluster K8s clientset
func NewChartInstallerWithClientsetFromContext ¶
func NewChartInstallerWithClientsetFromContext(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, mc metrics.Collector, k8sGroupBindings map[string]string, k8sRepoWhitelist []string, k8sSecretInjs map[string]config.K8sSecret, tcfg TillerConfig, kubeconfigpath, kubectx string) (*ChartInstaller, error)
NewChartInstallerWithClientsetFromContext returns a ChartInstaller configured with a K8s clientset from the current kubeconfig context
func NewChartInstallerWithoutK8sClient ¶
func NewChartInstallerWithoutK8sClient(ib images.Builder, dl persistence.DataLayer, fs billy.Filesystem, mc metrics.Collector, k8sGroupBindings map[string]string, k8sRepoWhitelist []string, k8sSecretInjs map[string]config.K8sSecret) (*ChartInstaller, error)
NewChartInstallerWithoutK8sClient returns a ChartInstaller without a k8s client, for use in testing/CLI.
func (ChartInstaller) BuildAndInstallCharts ¶
func (ci ChartInstaller) BuildAndInstallCharts(ctx context.Context, newenv *EnvInfo, cl ChartLocations) (err error)
BuildAndInstallCharts builds images for the environment while simultaneously installing the associated helm charts, returning the k8s namespace or error
func (ChartInstaller) BuildAndInstallChartsIntoExisting ¶
func (ci ChartInstaller) BuildAndInstallChartsIntoExisting(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error
func (ChartInstaller) BuildAndUpgradeCharts ¶
func (ci ChartInstaller) BuildAndUpgradeCharts(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error
func (ChartInstaller) Cleanup ¶
func (ci ChartInstaller) Cleanup(ctx context.Context, objMaxAge time.Duration)
Cleanup runs various processes to clean up. For example, it removes orphaned k8s resources older than objMaxAge. It is intended to be run periodically via a cronjob.
func (ChartInstaller) DeleteNamespace ¶
func (ci ChartInstaller) DeleteNamespace(ctx context.Context, k8senv *models.KubernetesEnvironment) error
DeleteNamespace deletes the kubernetes namespace and removes k8senv from the database if they exist
func (ChartInstaller) GenerateCharts ¶
func (ci ChartInstaller) GenerateCharts(ctx context.Context, ns string, newenv *EnvInfo, cloc ChartLocations) (out []metahelm.Chart, err error)
GenerateCharts processes the fetched charts, adds and merges overrides and returns metahelm Charts ready to be installed/upgraded
type ChartLocation ¶
type ChartLocation struct {
ChartPath, VarFilePath string
}
ChartLocation models the local filesystem path for the chart and the associated vars file
func (*ChartLocation) MergeVars ¶
func (cl *ChartLocation) MergeVars(fs billy.Filesystem, overrides map[string]string) ([]byte, error)
mergeVars merges overrides with the variables defined in the file at VarFilePath and returns the merged YAML stream
type ChartLocations ¶
type ChartLocations map[string]ChartLocation
ChartLocations is a map of repo name to ChartLocation
type EnvInfo ¶
type EnvInfo struct { Env *models.QAEnvironment RC *models.RepoConfig Releases map[string]string // map of repo to release name }
EnvInfo models all the data required to create a new environment or upgrade an existing one
type FakeInstaller ¶
type FakeInstaller struct { // ChartInstallFunc is called for each repo in chartLocations. Return an error to abort. ChartInstallFunc func(repo string, location ChartLocation) error ChartUpgradeFunc func(repo string, k8senv *models.KubernetesEnvironment, location ChartLocation) error DL persistence.DataLayer KC kubernetes.Interface HelmReleases []string }
FakeInstaller satisfies the Installer interface but does nothing
func (*FakeInstaller) BuildAndInstallCharts ¶
func (fi *FakeInstaller) BuildAndInstallCharts(ctx context.Context, newenv *EnvInfo, chartsLocation ChartLocations) error
func (FakeInstaller) BuildAndInstallChartsIntoExisting ¶
func (fi FakeInstaller) BuildAndInstallChartsIntoExisting(ctx context.Context, newenv *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error
func (FakeInstaller) BuildAndUpgradeCharts ¶
func (fi FakeInstaller) BuildAndUpgradeCharts(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error
func (FakeInstaller) DeleteNamespace ¶
func (fi FakeInstaller) DeleteNamespace(ctx context.Context, k8senv *models.KubernetesEnvironment) error
type HelmClientFactoryFunc ¶
type Installer ¶
type Installer interface { BuildAndInstallCharts(ctx context.Context, newenv *EnvInfo, cl ChartLocations) error BuildAndInstallChartsIntoExisting(ctx context.Context, newenv *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error BuildAndUpgradeCharts(ctx context.Context, env *EnvInfo, k8senv *models.KubernetesEnvironment, cl ChartLocations) error DeleteNamespace(ctx context.Context, k8senv *models.KubernetesEnvironment) error }
Installer describes an object that installs Helm charts and manages image builds
type K8sClientFactoryFunc ¶
type LogFunc ¶
type LogFunc func(string, ...interface{})
LogFunc is a function that logs a formatted string somewhere
type TillerConfig ¶
type TillerConfig struct { ServerConnectRetries uint ServerConnectRetryDelay time.Duration DeploymentName string Port uint Image string }
TillerConfig models the configuration parameters for Helm Tiller in namespaces
func (TillerConfig) SetDefaults ¶
func (tcfg TillerConfig) SetDefaults() TillerConfig
SetDefaults returns a TillerConfig with empty value fields filled in with defaults