Factory#

class phalanx.factory.Factory(path)#

Bases: object

Factory to create Phalanx components.

Parameters:

path (Path) – Path to the root of the Phalanx configuration tree.

Methods Summary

create_application_service()

Create service for manipulating Phalanx applications.

create_config_storage()

Create storage layer for the Phalanx configuration.

create_environment_service()

Create service for manipulating Phalanx environments.

create_gke_phalanx_cluster_service(context)

Create a service for manipulating Kubernetes clusters directly.

create_gke_recovery_service(*, ...)

Create a service for recovering GKE Phalanx clusters from backups.

create_google_cloud_service(region, project, ...)

Create a service for accessing the Google Cloud API.

create_kubernetes_storage([context])

Create storage object for interacting with Kubernetes.

create_onepassword_storage()

Create storage object for interacting with 1Password.

create_recovery_environment_service(context)

Create service for help with recovering Phalanx environments.

create_secrets_service()

Create service for manipulating Phalanx secrets.

create_vault_service()

Create service for managing Vault tokens and policies.

Methods Documentation

create_application_service()#

Create service for manipulating Phalanx applications.

Returns:

Service for manipulating applications.

Return type:

ApplicationService

create_config_storage()#

Create storage layer for the Phalanx configuration.

Returns:

Storage service for loading the Phalanx configuration.

Return type:

ConfigStorage

create_environment_service()#

Create service for manipulating Phalanx environments.

Parameters:

context – The Kubernetes context to pass to all commands. If this is None, then the current context will be used.

Returns:

Service for manipulating environments.

Return type:

EnvironmentService

create_gke_phalanx_cluster_service(context)#

Create a service for manipulating Kubernetes clusters directly.

Parameters:

context (str) – The Kubernetes context to pass to all kubectl commands.

Returns:

A service object for manipulating resources in a Phalanx cluster.

Return type:

GKEPhalanxClusterService

create_gke_recovery_service(*, source_cluster, destination_cluster, git_branch, environment, vault_credentials, old_context, new_context, gke_project, gke_region, run_id)#

Create a service for recovering GKE Phalanx clusters from backups.

Returns:

A service object for doing cluster recovery.

Return type:

GKERecoveryService

Parameters:
create_google_cloud_service(region, project, phalanx_run_id)#

Create a service for accessing the Google Cloud API.

This service is scoped to running operations in a single region and project.

Parameters:
  • region (str) – The Google Cloud region to run comands against.

  • project (str) – The Google Cloud project to run comands against.

  • phalanx_run_id (str) – An identifier to put in the phalanx-run label on every Google Cloud resource that is created with this service. This is helpful in resuming backup and restore process after a Google Cloud operation fails (which does happen intermittently), and in cleaning up these resources later.

Returns:

A service object for manipulating Google Cloud resources.

Return type:

GoogleCloudService

create_kubernetes_storage(context=None)#

Create storage object for interacting with Kubernetes.

Parameters:

context (Optional[str], default: None) – The Kubernetes context to pass to all kubectl commands. If this is None, then commands will be run against the current context in the kube config file.

Returns:

Storage object for interacting with Kubernetes.

Return type:

KubernetesStorage

create_onepassword_storage()#

Create storage object for interacting with 1Password.

Returns:

Storage object for interacting with 1Password.

Return type:

OnepasswordStorage

create_recovery_environment_service(context)#

Create service for help with recovering Phalanx environments.

Parameters:

context (str) – The Kubernetes context to pass to all commands.

Returns:

Service for helping to recover environments.

Return type:

RecoveryEnvironmentService

create_secrets_service()#

Create service for manipulating Phalanx secrets.

Returns:

Service for manipulating secrets.

Return type:

SecretsService

create_vault_service()#

Create service for managing Vault tokens and policies.

Returns:

Service for managing Vault tokens and policies.

Return type:

VaultService