GoogleCloudService#

class phalanx.services.google_cloud.GoogleCloudService(storage, phalanx_run_id)#

Bases: object

Operations for working with Google Cloud resources.

All operations must happen in the same Google Cloud region and project.

Anything that uses this should assume all authentication has already been done and that the Google Cloud Python SDK can find whatever it needs to send authenticated requests.

If you’re running locally, gcloud auth application-default login should work.

Parameters:
  • storage (GoogleCloudAPIStorage) – Storage object for interacting with the google cloud API.

  • 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.

Methods Summary

backup_and_restore_pvcs(source_cluster, ...)

Backup a GKE cluster and restore the PVCs and PVs to another.

cleanup_run()

Delete Google Cloud resources labeled with this phalanx run id.

get_cert_manager_firewall_rule()

Get details about a Google Cloud Firewall rule.

get_cluster(cluster)

Get details about a GKE cluster.

list_static_ip_addresses()

List all of the provisioned static IP addresses.

Methods Documentation

backup_and_restore_pvcs(source_cluster, destination_cluster)#

Backup a GKE cluster and restore the PVCs and PVs to another.

Parameters:
  • source_cluster (str) – The name of the GKE cluster to back up.

  • destination_cluster (str) – The name of the GKE cluster to restore the backup to.

Return type:

None

cleanup_run()#

Delete Google Cloud resources labeled with this phalanx run id.

Return type:

None

get_cert_manager_firewall_rule()#

Get details about a Google Cloud Firewall rule.

Returns:

Information about that Google Cloud Firewall rule.

Return type:

google.cloud.compute_v1beta.types.Firewall

get_cluster(cluster)#

Get details about a GKE cluster.

Parameters:

cluster (str) – The unqualified name of a GKE cluster, like ‘roundtable-dev’

Returns:

Information about that GKE cluster.

Return type:

google.cloud.container_v1.types.Cluster

list_static_ip_addresses()#

List all of the provisioned static IP addresses.

Return type:

list[Address]