KubernetesStorage#
- class phalanx.storage.kubernetes.KubernetesStorage(context=None)#
Bases:
objectStorage layer for direct Kubernetes operations.
Used primarily by the installer. This uses kubectl directly rather than one of the Python Kubernetes libraries since it seemed simpler at the time.
- Parameters:
context (
Optional[str], default:None) – The kubectl context to specify for all kubectl commands. If this is None, then the current context will be used.
Methods Summary
create_namespace(namespace, *[, ignore_fail])Create a Kubernetes namespace.
create_vault_secret(name, namespace, credentials)Create a Kubernetes
Secretresource for Vault credentials.Get the current context (the default Kubernetes cluster).
Get the names of all CronJobs in all Phalanx apps.
restart(name, namespace)Restart a kubernetes workload and wait for it to be ready again.
resume_cronjobs(cronjobs)Resume all given cronjobs.
suspend_cronjobs(cronjobs)Suspend all given cronjobs.
wait_for_rollout(name, namespace)Wait for a Kubernetes rollout to complete.
Methods Documentation
- create_namespace(namespace, *, ignore_fail=False)#
Create a Kubernetes namespace.
- create_vault_secret(name, namespace, credentials)#
Create a Kubernetes
Secretresource for Vault credentials.- Parameters:
name (
str) – Name of the secret.namespace (
str) – Namespace of the secret.credentials (
VaultCredentials) – Vault credentials to store in the secret.
- Return type:
- get_current_context()#
Get the current context (the default Kubernetes cluster).
- Returns:
Name of the current Kubernetes context.
- Return type:
- get_phalanx_cronjobs()#
Get the names of all CronJobs in all Phalanx apps.
We say a CronJob is in a Phalanx app if it has an ArgoCD label.
- restart(name, namespace)#
Restart a kubernetes workload and wait for it to be ready again.
- resume_cronjobs(cronjobs)#
Resume all given cronjobs.
- suspend_cronjobs(cronjobs)#
Suspend all given cronjobs.
- wait_for_rollout(name, namespace)#
Wait for a Kubernetes rollout to complete.