Documentation ¶
Overview ¶
Package action contains the logic for each action that hypper can perform.
This is a library for calling top-level hypper actions like 'install', 'upgrade', or 'list'. Actions approximately match the command line invocations that the hypper CLI uses.
Index ¶
- Constants
- Variables
- func CheckDependencies(ch *helmChart.Chart, reqs []*helmChart.Dependency) error
- func CheckIfInstallable(ch *helmChart.Chart) error
- func GetName(chart *chart.Chart, nameTemplate string, args ...string) (string, error)
- func GetNameFromAnnot(annot map[string]string, defaultName string) string
- func GetNamespace(chart *chart.Chart, defaultNS string) string
- func GetNamespaceFromAnnot(annot map[string]string, defaultNS string) string
- func SetNamespace(x interface{}, chart *chart.Chart, targetNS string, setDefault bool)
- type Configuration
- type History
- type Install
- func (i *Install) BuildWorld(pkgdb *solver.PkgDB, repositories []*helmRepo.Entry, ...) (err error)
- func (i *Install) Chart(args []string) (string, error)
- func (i *Install) CreateDepRelsFromAnnot(p *pkg.Pkg, chartAnnot map[string]string, repoEntries map[string]chrtEntry, ...) (err error)
- func (i *Install) GetAllReleases() (releases []*release.Release, err error)
- func (i *Install) GetReleases() (releases []*release.Release, err error)
- func (i *Install) InstallPkg(p *pkg.Pkg, wantedPkg *pkg.Pkg, wantedChart *helmChart.Chart, ...) (*release.Release, error)
- func (i *Install) LoadChart(chartName, parentChartPath, repo, version string, settings *cli.EnvSettings, ...) (*helmChart.Chart, error)
- func (i *Install) NameAndChart(args []string) (string, string, error)
- func (i *Install) Run(strategy solver.SolverStrategy, wantedChrt *helmChart.Chart, ...) ([]*release.Release, error)
- type Lint
- type List
- type Pull
- type PullOpt
- type SharedDependency
- type Status
- type Uninstall
- type Upgrade
Constants ¶
const ( // OptionalDepsAll will use all the optional deps OptionalDepsAll optionalDepsStrategy = iota // OptionalDepsAsk will interactively prompt on each optional dep OptionalDepsAsk // OptionalDepsNone with skip all the optional deps OptionalDepsNone )
Variables ¶
var Timestamper = time.Now
Timestamper is a function capable of producing a timestamp.Timestamper.
By default, this is a time.Time function from the Helm time package. This can be overridden for testing though, so that timestamps are predictable.
Functions ¶
func CheckDependencies ¶
func CheckDependencies(ch *helmChart.Chart, reqs []*helmChart.Dependency) error
CheckDependencies checks the dependencies for a chart. by wrapping action.CheckDependencies
func CheckIfInstallable ¶ added in v0.1.0
checkIfInstallable validates if a chart can be installed
Application chart type is only installable
func GetNameFromAnnot ¶ added in v0.3.1
GetNameFromAnnot returns the release name that should be used based of annotations, or the passed default name
func GetNamespace ¶ added in v0.1.0
GetNamespace returns the namespace that should be used based of annotations, or the passed default namespace
func GetNamespaceFromAnnot ¶ added in v0.3.1
GetNamespaceFromAnnot returns the namespace that should be used based of annotations, or the passed default namespace
func SetNamespace ¶ added in v0.1.0
SetNamespace sets the Namespace that should be used based on annotations or fallback to default both on the action and on the storage. if setDefault is true then it will just set the default namespace This will read the chart annotations. If no annotations, it leave the existing ns in the action. targetNS can be either the default namespace (usually "default") or the namespace passed via cli flag
Types ¶
type Configuration ¶
type Configuration struct {
*action.Configuration
}
Configuration is a composite type of Helm's Configuration type
func (*Configuration) SetNamespace ¶
func (c *Configuration) SetNamespace(namespace string)
SetNamespace sets the namespace on the kubeclient
type History ¶ added in v0.0.2
History is the action for checking the release's ledger.
It provides the implementation of 'helm history'. It returns all the revisions for a specific release. To list up to one revision of every release in one specific, or in all, namespaces, see the List action.
func NewHistory ¶ added in v0.0.2
func NewHistory(cfg *Configuration) *History
NewHistory creates a new History object with the given configuration.
type Install ¶
type Install struct { *action.Install // Hypper specific: OptionalDeps optionalDepsStrategy NoCreateNamespace bool // Config stores the actionconfig so it can be retrieved and used again Config *Configuration }
Install is a composite type of Helm's Install type
func NewInstall ¶
func NewInstall(cfg *Configuration) *Install
NewInstall creates a new Install object with the given configuration, by wrapping action.NewInstall
func (*Install) BuildWorld ¶ added in v0.3.1
func (i *Install) BuildWorld(pkgdb *solver.PkgDB, repositories []*helmRepo.Entry, releases []*release.Release, toModify *pkg.Pkg, toModifyChart *helmChart.Chart, settings *cli.EnvSettings, logger log.Logger) (err error)
BuildWorld adds all known charts to the package database:
- For all the repos, it iterates through the chart entries and adds a package to the DB for each version of the chart.
- For all releases and wanted packages, it adds a package or updates a present package in the DB.
func (*Install) Chart ¶
Chart returns the chart that should be used.
This will read the flags and skip args if necessary.
func (*Install) CreateDepRelsFromAnnot ¶ added in v0.3.1
func (i *Install) CreateDepRelsFromAnnot(p *pkg.Pkg, chartAnnot map[string]string, repoEntries map[string]chrtEntry, pkgdb *solver.PkgDB, settings *cli.EnvSettings, logger log.Logger) (err error)
CreateDepRelsFromAnnot fills the p.DepRel and p.DepOptionalRel of a package, by unmarshalling and checking the Metadata.Annotations of the chart that corresponds to that package.
For local local charts (repository starts with `file://`), it will finish without doing anything if they are already present in the DB (have been processed), or recursively call itself to create deps from annot and add those charts to the DB.
func (*Install) GetAllReleases ¶ added in v0.3.1
GetAllReleases obtains the releases in all namespaces that we have access to.
func (*Install) GetReleases ¶ added in v0.3.1
GetReleases obtains the releases in the specific namespace that we are searching into.
func (*Install) InstallPkg ¶ added in v0.3.1
func (i *Install) InstallPkg(p *pkg.Pkg, wantedPkg *pkg.Pkg, wantedChart *helmChart.Chart, vals map[string]interface{}, lvl int, settings *cli.EnvSettings, logger log.Logger) (*release.Release, error)
InstallPkg installs the passed package by pulling its related chart. It takes care of using the desired namespace for it.
func (*Install) NameAndChart ¶
NameAndChart overloads Helm's NameAndChart. It always fails.
On Hypper, we need to read the chart annotations to know the correct release name. Therefore, it cannot happen in this function.
func (*Install) Run ¶
func (i *Install) Run(strategy solver.SolverStrategy, wantedChrt *helmChart.Chart, wantedChrtAbsPath string, vals map[string]interface{}, settings *cli.EnvSettings, logger log.Logger) ([]*release.Release, error)
Run executes the installation
If DryRun is set to true, this will prepare the release, but not install it. It returns a slice of releases deployed to the cluster.
It will create a DB of packages from all known charts in repos, releases and desired ones. Then, it will solve with the SAT solver, and if relevant, install the wanted chart and its dependencies. If dependencies are already satisfied, they will be silently skipped.
wantedChartAbsPath argument is needed for correctly evaluating `file://` repositories in shared dependency annotations. Like in Helm, these repositories can be relative to the parent chart path.
type Lint ¶ added in v0.1.0
type Lint struct {
*helmAction.Lint
}
Lint is a composite type of Helm's Lint type
func NewLint ¶ added in v0.1.0
func NewLint() *Lint
NewLint creates a new Lint object with the given configuration.
func (*Lint) Run ¶ added in v0.1.0
func (l *Lint) Run(paths []string, vals map[string]interface{}) *helmAction.LintResult
Run executes 'helm Lint' against the given chart and then runs the chart against hypper lint rules
type List ¶
List is a composite type of Helm's List type
func NewList ¶
func NewList(cfg *Configuration) *List
NewList constructs a new *List by embedding helm/pkg/action.List
type Pull ¶ added in v0.1.0
Pull is the action for checking a given release's information.
It provides the implementation of 'hypper pull'.
func NewPull ¶ added in v0.1.0
func NewPull(cfg *Configuration) *Pull
NewPull creates a new Pull object.
type SharedDependency ¶ added in v0.0.2
type SharedDependency struct { Configuration }Config *
SharedDependency is the action for building a given chart's shared dependency tree.
It provides the implementation of 'hypper shared-dependency' and its respective subcommands.
func NewSharedDependency ¶ added in v0.0.2
func NewSharedDependency(cfg *Configuration) *SharedDependency
NewSharedDependency creates a new SharedDependency object with the given configuration.
func (*SharedDependency) List ¶ added in v0.0.2
func (d *SharedDependency) List(chartpath string, settings *cli.EnvSettings, logger log.Logger) error
List executes 'hypper shared-dep list'.
func (*SharedDependency) SharedDependencyStatus ¶ added in v0.0.2
func (d *SharedDependency) SharedDependencyStatus(depChart *helmChart.Chart, depNS string, depVersion string) (string, error)
SharedDependencyStatus returns a string describing the status of a dependency viz a viz the releases in depNS context.
type Status ¶
Status is the action for checking the deployment status of releases.
It provides the implementation of 'helm status'.
func NewStatus ¶
func NewStatus(cfg *Configuration) *Status
NewStatus creates a new Status object with the given configuration.
type Uninstall ¶
type Uninstall struct { *action.Uninstall Config *Configuration }
Uninstall is a composite type of Helm's Uninstall type
func NewUninstall ¶
func NewUninstall(cfg *Configuration) *Uninstall
NewUninstall creates a new Uninstall by embedding action.Uninstall
type Upgrade ¶ added in v0.0.2
type Upgrade struct { *action.Upgrade Config *Configuration ReleaseName string }
Upgrade is a composite type of Helm's Upgrade type
func NewUpgrade ¶ added in v0.0.2
func NewUpgrade(cfg *Configuration) *Upgrade
NewUpgrade creates a new Upgrade object with the given configuration.