ArgoCDStorage#
- class phalanx.storage.argocd.ArgoCDStorage(context=None)#
Bases:
objectInterface to Argo CD operations.
Calls the argocd command-line client. Used by the installer and for cluster recovery.
- Parameters:
context (
Optional[str], default:None) – The kubectl context to specify for all argocd commands. If this is None, then the current context will be used.
Methods Summary
create_environment(environment, ...)Manually create an Argo CD application.
list_applications(app_of_apps_name, exclude)List ArgoCD applications.
login(username, password)Authenticate to Argo CD.
set_helm_value(application, key, value)Set a helm value for an ArgoCD application.
set_project(application, project)Set the Argo CD project of an application.
sync(application, *[, timeout, kind])Sync all or part of a specific Argo CD application.
sync_all(app_of_apps_name, *[, timeout])Sync all or part of all Argo CD applications under an app of apps.
unset_helm_value(application, key)Unset a helm value for an ArgoCD application.
Methods Documentation
- create_environment(environment, app_of_apps_name, *, git_url, git_branch)#
Manually create an Argo CD application.
Used only by the installer for installing the app of apps to bootstrap the environment.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
- Return type:
- list_applications(app_of_apps_name, exclude)#
List ArgoCD applications.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
CommandTimedOutError – Raised if the command timed out. The timeout is also passed to Argo CD as an option, so normally the command should fail and raise
CommandFailedErrorinstead. This exception means the Argo CD timeout didn’t work for some reason.
- Return type:
- login(username, password)#
Authenticate to Argo CD.
Authenticates using username and password authentication with port forwarding. This normally must be done before any other Argo CD operations.
- Parameters:
username (
str) – Username for authentication. (Usually this will beadmin.)password (
SecretStr) – Password for that user.
- Raises:
CommandFailedError – Raised if Argo CD fails.
- Return type:
- set_helm_value(application, key, value)#
Set a helm value for an ArgoCD application.
This is only used in the cluster recovery process, where we want to change some helm values the first time we sync an application, after the app-of-apps has already been synced.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
- Return type:
- set_project(application, project)#
Set the Argo CD project of an application.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
- Return type:
- sync(application, *, timeout=datetime.timedelta(seconds=120), kind=None)#
Sync all or part of a specific Argo CD application.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
CommandTimedOutError – Raised if the command timed out. The timeout is also passed to Argo CD as an option, so normally the command should fail and raise
CommandFailedErrorinstead. This exception means the Argo CD timeout didn’t work for some reason.
- Return type:
- sync_all(app_of_apps_name, *, timeout=datetime.timedelta(seconds=30))#
Sync all or part of all Argo CD applications under an app of apps.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
CommandTimedOutError – Raised if the command timed out. The timeout is also passed to Argo CD as an option, so normally the command should fail and raise
CommandFailedErrorinstead. This exception means the Argo CD timeout didn’t work for some reason.
- Return type:
- unset_helm_value(application, key)#
Unset a helm value for an ArgoCD application.
This is only used in the cluster recovery process, where we want to change some helm values the first time we sync an application, after the app-of-apps has already been synced.
- Parameters:
- Raises:
CommandFailedError – Raised if Argo CD fails.
- Return type: