Chart

class avionix.chart.ChartBuilder(chart_info, kubernetes_objects, output_directory=None, keep_chart=False, namespace=None)

Main builder object. Accepts kubernetes objects and generates the helm chart structure. Can also perform the installation onto the server

Parameters
  • chart_info (ChartInfo) – Contains all chart metadata and dependency info

  • kubernetes_objects (List[KubernetesBaseObject]) – A list of kubernetes objects

  • output_directory (Optional[str]) – A path to the directory in which to place the generated chart

  • keep_chart (bool) – Whether or not to keep the chart after installation

  • namespace (Optional[str]) – The namespace in which all chart components should be installed This allows the convenience of not passing the namespace option to both install and uninstall

add_dependency_repos()

Adds repos for all dependencies listed

generate_chart()

Generates the chart but does not install it on kubernetes

install_chart(options=None)

Generates and installs the helm chart onto kubernetes and handles all failures. It will also add the repos of all listed dependencies.

Note that the generated chart will be deleted if keep_chart is not set to true on ChartBuilder

WARNING: If the helm chart installation fails, the chart will be uninstalled, so if working with an existing chart, please use upgrade_chart instead

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

For example, to run an install with updated dependencies and with verbose logging: >>> self.helm_install({“dependency_update”: None, “v”: “info”})

property is_installed
Returns

True if chart with the given name is already installed in the chart builders namespace, else False

run_helm_install(options=None)

Runs helm install on the chart

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

Example

To run an install with updated dependencies and with verbose logging:

>>> self.run_helm_install({"dependency_update": None, "v": "info"})
run_helm_uninstall(options=None)

Runs helm uninstall

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

Example

>>> self.run_helm_uninstall(
>>>    {"dry-run": None,
>>>    "description": "My uninstall description"
>>>    }
>>> )
run_helm_upgrade(options=None)

Runs ‘helm upgrade’ on the chart

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

Example

>>> self.run_helm_upgrade(options={"atomic": None, "version": "2.0"})
uninstall_chart(options=None)

Uninstalls the chart if present, if not present, raises an error

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

Example

>>> self.uninstall_chart(
>>>    {"dry-run": None,
>>>    "description": "My uninstall description"
>>>    }
>>> )
upgrade_chart(options=None)

Generates and upgrades the helm chart

Parameters

options (Optional[Dict[str, Optional[str]]]) – A dictionary of command line arguments to pass to helm

Example

>>> self.upgrade_chart(options={"atomic": None, "version": "2.0"})
class avionix.chart.ChartDependency(name, version, repository, local_repo_name, values=None)

An object that is equivalent to listing a chart dependency in chart info in helm

You can also set the values.yaml through this configuration to set any values that need to be configured within dependencies

Parameters
  • name (str) – Name of chart

  • version (str) – The version of the chart

  • repository (str) – The url of the repository that this chart originates from

  • values (Optional[dict]) – A dictionary representing the yaml to be output in the values.yaml file for this dependency

  • values – Optional[dict]

class avionix.chart.ChartInfo(api_version, name, version, kube_version=None, description=None, type=None, key_words=None, home=None, sources=None, dependencies=None, maintainers=None, icon=None, app_version=None, deprecated=None, annotations=None)
Parameters
  • api_version (str) – The chart API version (required)

  • name (str) – The name of the chart (required)

  • version (str) – A SemVer 2 version (required)

  • kube_version (Optional[str]) – A SemVer range of compatible Kubernetes versions (optional)

  • description (Optional[str]) – A single-sentence description of this project (optional)

  • type (Optional[str]) – The type of the chart (optional)

  • key_words (Optional[List[str]]) – A list of keywords about this project (optional)

  • home (Optional[str]) – The URL of this projects home page (optional)

  • sources (Optional[List[str]]) – A list of URLs to source code for this project (optional)

  • dependencies (Optional[List[ChartDependency]]) – A list of the chart requirements (optional)

  • maintainers (Optional[List[ChartMaintainer]]) – A list of maintainers

  • icon (Optional[str]) – A URL to an SVG or PNG image to be used as an icon (optional).

  • app_version (Optional[str]) – The version of the app that this contains (optional). This needn’t be SemVer.

  • deprecated (Optional[bool]) – Whether this chart is deprecated (optional, boolean)

  • annotations (Optional[dict]) – A list of annotations keyed by name (optional).

class avionix.chart.ChartMaintainer(name, email=None, url=None)
Parameters
  • name (str) – The maintainers name (required for each maintainer)

  • email (Optional[str]) – The maintainers email (optional for each maintainer)

  • url (Optional[str]) – A URL for the maintainer (optional for each maintainer)