ApplicationService#
- class phalanx.services.application.ApplicationService(path, config_storage, helm_storage)#
Bases:
object
Service for manipulating Phalanx applications.
- Parameters:
path (
Path
) – Root path to the Phalanx directory structure.config_storage (
ConfigStorage
) – Storage object for the Phalanx configuration.helm_storage (
HelmStorage
) – Interface to Helm actions.
Methods Summary
add_helm_repositories
([applications, quiet])Add all Helm repositories used by any application to Helm's cache.
create
(name, starter, description)Create configuration for a new application.
lint
(app_names, env_name)Lint an application with Helm.
lint_all
(*[, only_changes_from_branch])Lint all applications with Helm.
template
(app_name, env_name)Expand the templates of an application chart.
Methods Documentation
- add_helm_repositories(applications=None, *, quiet=False)#
Add all Helm repositories used by any application to Helm’s cache.
To perform other Helm operations, such as downloading third-party charts in order to run helm lint, all third-party Helm chart repositories have to be added to Helm’s cache. This does that for every application in the Phalanx configuration.
Consistent names for the Helm repositories are used so that this command can be run repeatedly.
- Parameters:
- Returns:
Whether any Helm repositories were added. If there were none, the caller should not call helm update, because it fails if there are no repositories.
- Return type:
- create(name, starter, description)#
Create configuration for a new application.
- Parameters:
name (
str
) – Name of the application.starter (
HelmStarter
) – Name of the Helm starter to use as the template for the application.description (
str
) – Short description of the application.
- Raises:
ApplicationExistsError – Raised if the application being created already exists.
- Return type:
- lint(app_names, env_name)#
Lint an application with Helm.
Registers any required Helm repositories, refreshes them, downloads dependencies, and runs helm lint on the application chart, configured for the given environment.
- lint_all(*, only_changes_from_branch=None)#
Lint all applications with Helm.
Registers any required Helm repositories, refreshes them, downloads dependencies, and runs helm lint on every combination of application chart and configured environment.
- Parameters:
only_changes_from_branch (
str
|None
, default:None
) – If given, only lint application and environment pairs that may have been affected by Git changes relative to the given branch. In other words, assume all application chart configurations identical to the given branch are uninteresting, and only lint the ones that have changed.- Returns:
Whether linting passed.
- Return type:
- template(app_name, env_name)#
Expand the templates of an application chart.
Run helm template for an application chart, passing in the appropriate parameters for that environment.
- Parameters:
- Returns:
Output from helm template.
- Return type:
- Raises:
HelmFailedError – Raised if Helm fails.