RecoveryEnvironmentService#

class phalanx.services.recovery_environment.RecoveryEnvironmentService(*, config_storage, argocd_storage, kubernetes_storage, helm_storage, vault_storage, cluster_service)#

Bases: EnvironmentService

Phalanx environment operations only for use during cluster recovery.

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.

  • cluster_service (GKEPhalanxClusterService) – Service for doing Phalanx-specific Kubernetes manipulation.

Methods Summary

list_argocd_apps(environment_name, ...)

List ArgoCD applications.

recover(environment_name, vault_credentials)

Recover a Phalanx environment to another cluster with existing PVs.

Methods Documentation

list_argocd_apps(environment_name, vault_credentials)#

List ArgoCD applications.

We exclude some applications because ArgoCD doesn’t provision any resources in them, and most functionality that uses this method expects there to be resources in the app.

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

  • vault_credentials (VaultCredentials) – Credentials to use for Vault access. These will be used to get the ArgoCD password.

Return type:

ApplicationList

Returns:

  • ApplicationList – A list of any ArgoCD applications except for nublado-users.

  • ——-

recover(environment_name, vault_credentials, git_branch=None)#

Recover a Phalanx environment to another cluster with existing PVs.

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 (Optional[str], 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