PhalanxClusterService#

class phalanx.services.cluster.PhalanxClusterService(kubernetes_storage)#

Bases: object

Kubernetes operations on a Phalanx cluster.

These operations are not in the EnviromentService because:

  • They do not necessarily correspond 1-1 to a Phalanx enviroment.

  • They are often part of tasks that involve multiple clusters, so passing an explicit context is less error prone, and allows the operations to be automated without having to manually change the kubectl current context.

For example, when recovering a GCP cluster from backups while the old cluster still exists, you will need to work with two clusters, both of which are associated with the same environment.

Parameters:

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

Methods Summary

resume_cronjobs()

Resume all CronJobs in all Phalanx apps.

scale_down_workloads()

Scale down (almost) all Phalanx workloads.

scale_up_workloads()

Scale up (almost) all Phalanx workloads to their previous counts.

suspend_cronjobs()

Suspend all CronJobs in all Phalanx apps.

Methods Documentation

resume_cronjobs()#

Resume all CronJobs in all Phalanx apps.

Return type:

None

scale_down_workloads()#

Scale down (almost) all Phalanx workloads.

During cluster rebuilds when there is an old and a new cluster, certain workloads can’t be running in both clusters at the same time, or else state external to the cluster could be corrupted.

We’ll leave ArgoCD running so the scaled-down cluster can still be inspected.

Raises:

InvalidScaleStateError – If the workload resource has a previous replica count annotation, but its current replica count is not zero.

Return type:

None

scale_up_workloads()#

Scale up (almost) all Phalanx workloads to their previous counts.

This is only intended to be run after a scale down operation.

Raises:

InvalidScaleStateError – If the workload resource has a previous replica count annotation, but its current replica count is not zero.

Return type:

None

suspend_cronjobs()#

Suspend all CronJobs in all Phalanx apps.

Return type:

None