HelmStorage#
- class phalanx.storage.helm.HelmStorage(config_storage)#
Bases:
object
Interface to Helm operations.
Provides an interface to use Helm to create and process templates and to use Helm to install charts in a Kubernetes cluster.
- Parameters:
config_storage (
ConfigStorage
) – Storage object for the Phalanx configuration.
Methods Summary
create
(application, starter)Use helm create to create a new application chart.
dependency_update
(application, *[, quiet])Download chart dependencies for an application.
lint_application
(application, environment, ...)Lint an application chart with Helm.
lint_environment
(environment)Lint the top-level chart for an environment with Helm.
repo_add
(url, *[, quiet])Add a Helm chart repository to Helm's cache.
repo_update
(*[, quiet])Update Helm's cache of upstream repository indices.
template_application
(application, ...)Expand an application chart into its Kubernetes resources.
template_environment
(environment)Expand the top-level chart into its Kubernetes resources.
Methods Documentation
- create(application, starter)#
Use helm create to create a new application chart.
- Parameters:
application (
str
) – Name of the new application.starter (
HelmStarter
) – Name of the Helm starter template to use.
- Return type:
- dependency_update(application, *, quiet=False)#
Download chart dependencies for an application.
Tell Helm to update any third-party chart dependencies for an application and store them in the
charts
subdirectory. This is a prerequisite for helm lint or helm template.Assumes that remote repositories have already been refreshed with
repo_update
and tells Helm to skip that.
- lint_application(application, environment, values)#
Lint an application chart with Helm.
Assumes that helm dependency update has already been run to download any third-party charts. Any output is sent to standard output and standard error, and if Helm fails, a failure message will be printed to standard error.
- Parameters:
- Returns:
Whether linting passed.
- Return type:
- lint_environment(environment)#
Lint the top-level chart for an environment with Helm.
Any output is sent to standard output and standard error, and if Helm fails, a failure message will be printed to standard error.
- repo_add(url, *, quiet=False)#
Add a Helm chart repository to Helm’s cache.
Used primarily to enable Helm linting and templating, since both require any third-party chart repositories be added first.
Annoyingly, Helm requires you to name repositories, but chart configurations don’t include repository names. Automating adding Helm repositories therefore requires making up a name. This uses some arbitrary heuristics that produce consistent names and hopefully won’t produce conflicts.
- Parameters:
- Raises:
ValueError – Raised if the Helm repository URL is invalid.
- Return type:
- repo_update(*, quiet=False)#
Update Helm’s cache of upstream repository indices.
- template_application(application, environment, values)#
Expand an application chart into its Kubernetes resources.
Runs helm template to expand a chart into its Kubernetes resources for a given environment. Assumes that helm dependency update has already been run to download any third-party charts. Any output to standard error is passed along.
- Parameters:
- Returns:
Kubernetes resources created by the chart.
- Return type:
- Raises:
HelmFailedError – Raised if Helm fails.
- template_environment(environment)#
Expand the top-level chart into its Kubernetes resources.
Runs helm template to expand the top-level chart into its Kubernetes resources for a given environment. Any output to standard error is passed along.
- Parameters:
environment (
str
) – Name of the environment for which to expand the chart.- Returns:
Kubernetes resources created by the chart.
- Return type:
- Raises:
HelmFailedError – Raised if Helm fails.