EnvironmentService

class phalanx.services.environment.EnvironmentService(*, config_storage, argocd_storage, kubernetes_storage, helm_storage, vault_storage)

Bases: object

Service for manipulating Phalanx environments.

Parameters:
  • config_storage (ConfigStorage) – Storage object for the Phalanx configuration.

  • argocd_storage (ArgoCDStorage) – Interface to Argo CD actions.

  • kubernetes_storage (KubernetesStorage) – Interface to direct Kubernetes object manipulation.

  • helm_storage (HelmStorage) – Interface to Helm actions.

  • vault_storage (VaultStorage) – Factory class for Vault clients.

Methods Summary

install(environment_name, vault_credentials)

Install a Phalanx environment.

lint([environment])

Lint the Helm chart for environments.

template(environment_name)

Expand the templates of the top-level chart.

Methods Documentation

install(environment_name, vault_credentials, git_branch=None)

Install a Phalanx environment.

Parameters:
  • environment_name (str) – Environment to install.

  • vault_credentials (VaultCredentials) – Credentials to use for Vault access. These will be installed in the cluster as a Secret used by vault-secrets-operator.

  • git_branch (str | None, default: None) – Git branch to point Argo CD at. If not given, defaults to the current branch.

Raises:
  • CommandFailedError – Raised if one of the underlying commands fails.

  • ValueError – Raised if appOfAppsName is not set in the environment configuration.

  • VaultNotFoundError – Raised if a necessary secret was not found in Vault.

Return type:

None

lint(environment=None)

Lint the Helm chart for environments.

Parameters:

environment (str | None, default: None) – If given, lint only the specified environment.

Returns:

Whether linting passed.

Return type:

bool

template(environment_name)

Expand the templates of the top-level chart.

Run helm template for a top-level chart, passing in the appropriate parameters for the given environment.

Parameters:

environment_name (str) – Environment for which to expand the top-level chart.

Returns:

Output from helm template.

Return type:

str

Raises: