kaqing 1.98.86__tar.gz → 1.98.88__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kaqing might be problematic. Click here for more details.
- {kaqing-1.98.86 → kaqing-1.98.88}/PKG-INFO +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/app_session.py +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/batch.py +15 -15
- {kaqing-1.98.86/adam/commands/frontend → kaqing-1.98.88/adam/commands/deploy}/code_start.py +1 -1
- {kaqing-1.98.86/adam/commands/frontend → kaqing-1.98.88/adam/commands/deploy}/code_stop.py +1 -1
- kaqing-1.98.86/adam/commands/frontend/setup.py → kaqing-1.98.88/adam/commands/deploy/deploy.py +11 -10
- kaqing-1.98.86/adam/commands/frontend/setup_frontend.py → kaqing-1.98.88/adam/commands/deploy/deploy_frontend.py +11 -15
- kaqing-1.98.88/adam/commands/deploy/deploy_pod.py +68 -0
- kaqing-1.98.88/adam/commands/deploy/deploy_utils.py +26 -0
- kaqing-1.98.86/adam/commands/frontend/teardown.py → kaqing-1.98.88/adam/commands/deploy/undeploy.py +12 -11
- kaqing-1.98.86/adam/commands/frontend/teardown_frontend.py → kaqing-1.98.88/adam/commands/deploy/undeploy_frontend.py +9 -8
- kaqing-1.98.88/adam/commands/deploy/undeploy_pod.py +54 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/postgres/postgres_session.py +61 -54
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/user_entry.py +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/embedded_params.py +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/pods.py +21 -6
- kaqing-1.98.88/adam/k8s_utils/service_accounts.py +169 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/repl_commands.py +10 -8
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/authenticator.py +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/authn_ad.py +4 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/authn_okta.py +5 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/idp.py +3 -3
- kaqing-1.98.88/adam/version.py +5 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-1.98.86 → kaqing-1.98.88}/kaqing.egg-info/SOURCES.txt +12 -8
- {kaqing-1.98.86 → kaqing-1.98.88}/setup.py +1 -1
- kaqing-1.98.86/adam/version.py +0 -5
- {kaqing-1.98.86 → kaqing-1.98.88}/README +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/apps.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/check.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/check_context.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/check_result.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/check_utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/compactionstats.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/cpu.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/disk.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/gossip.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/issue.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/memory.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/checks/status.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/cli.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/cli_group.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/column.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/columns.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/compactions.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/cpu.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/dir_data.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/gossip.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/host_id.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/memory.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_address.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_load.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_owns.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_status.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_tokens.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/node_utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/pod_name.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/columns/volume_root.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/app.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/app_ping.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/bash.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/cd.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/check.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/cli_commands.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/command.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/command_helpers.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/commands_utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/cp.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/cql_utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/cqlsh.py +0 -0
- {kaqing-1.98.86/adam/commands/frontend → kaqing-1.98.88/adam/commands/deploy}/__init__.py +0 -0
- {kaqing-1.98.86/adam/commands/frontend → kaqing-1.98.88/adam/commands/deploy}/code_utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/devices.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/exit.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/help.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/issues.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/login.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/logs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/ls.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/nodetool.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/param_get.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/param_set.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/postgres/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/postgres/postgres.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/preview_table.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/pwd.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/repair.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/report.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/restart.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/rollout.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_adam.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_commands.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_login.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_params.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_processes.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/show/show_storage.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/commands/watch.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/config.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/embedded_apps.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/cassandra_clusters.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/cassandra_nodes.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/custom_resources.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/ingresses.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/jobs.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/kube_context.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/secrets.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/services.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/statefulsets.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/k8s_utils/volumes.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/log.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/pod_exec_result.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/repl.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/repl_session.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/repl_state.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/__init__.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/cred_cache.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/id_token.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/idp_login.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/idp_session.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/sso/sso_config.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/adam/utils.py +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-1.98.86 → kaqing-1.98.88}/setup.cfg +0 -0
|
@@ -88,7 +88,7 @@ class AppSession:
|
|
|
88
88
|
if not forced and self.app_login:
|
|
89
89
|
return self.app_login
|
|
90
90
|
|
|
91
|
-
idp_login: IdpLogin = Idp.login(self.host, idp_uri=idp_uri, forced=forced, use_token_from_env=use_token_from_env, use_cached_creds=use_cached_creds)
|
|
91
|
+
idp_login: IdpLogin = Idp.login(self.host, idp_uri=idp_uri, forced=forced, use_token_from_env=use_token_from_env, use_cached_creds=use_cached_creds, verify=False)
|
|
92
92
|
if not idp_login:
|
|
93
93
|
log2(f"Invalid username/password.")
|
|
94
94
|
|
|
@@ -6,8 +6,8 @@ from adam.commands.cp import ClipboardCopy, CopyCommandHelper
|
|
|
6
6
|
from adam.commands.command import Command
|
|
7
7
|
from adam.commands.command_helpers import ClusterCommandHelper, ClusterOrPodCommandHelper, PodCommandHelper
|
|
8
8
|
from adam.commands.cqlsh import CqlCommandHelper, Cqlsh
|
|
9
|
-
from adam.commands.
|
|
10
|
-
from adam.commands.
|
|
9
|
+
from adam.commands.deploy.deploy import Deploy, DeployCommandHelper
|
|
10
|
+
from adam.commands.deploy.undeploy import Undeploy, UndeployCommandHelper
|
|
11
11
|
from adam.commands.issues import Issues
|
|
12
12
|
from adam.commands.login import Login
|
|
13
13
|
from adam.commands.logs import Logs
|
|
@@ -77,6 +77,16 @@ def cql(kubeconfig: str, config: str, param: list[str], cluster: str, namespace:
|
|
|
77
77
|
run_command(Cqlsh(), kubeconfig, config, param, cluster, namespace, pod, extra_args)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=DeployCommandHelper, help='Setup.')
|
|
81
|
+
@click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
|
|
82
|
+
@click.option('--config', default='params.yaml', metavar='path', help='path to kaqing parameters file')
|
|
83
|
+
@click.option('--param', '-v', multiple=True, metavar='<key>=<value>', help='parameter override')
|
|
84
|
+
@click.option('--namespace', '-n', required=False, metavar='namespace', help='Kubernetes namespace')
|
|
85
|
+
@click.argument('extra_args', nargs=-1, metavar='<pod>', type=click.UNPROCESSED)
|
|
86
|
+
def deploy(kubeconfig: str, config: str, param: list[str], namespace: str, extra_args):
|
|
87
|
+
run_command(Deploy(), kubeconfig, config, param, None, namespace, None, extra_args)
|
|
88
|
+
|
|
89
|
+
|
|
80
90
|
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=ClusterOrPodCommandHelper, help="Print Qing's issues.")
|
|
81
91
|
@click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
|
|
82
92
|
@click.option('--config', default='params.yaml', metavar='path', help='path to kaqing parameters file')
|
|
@@ -229,16 +239,6 @@ def rollout(kubeconfig: str, config: str, param: list[str], cluster: str, namesp
|
|
|
229
239
|
run_command(RollOut(), kubeconfig, config, param, cluster, namespace, None, extra_args)
|
|
230
240
|
|
|
231
241
|
|
|
232
|
-
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=SetupCommandHelper, help='Setup.')
|
|
233
|
-
@click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
|
|
234
|
-
@click.option('--config', default='params.yaml', metavar='path', help='path to kaqing parameters file')
|
|
235
|
-
@click.option('--param', '-v', multiple=True, metavar='<key>=<value>', help='parameter override')
|
|
236
|
-
@click.option('--namespace', '-n', required=False, metavar='namespace', help='Kubernetes namespace')
|
|
237
|
-
@click.argument('extra_args', nargs=-1, metavar='<pod>', type=click.UNPROCESSED)
|
|
238
|
-
def setup(kubeconfig: str, config: str, param: list[str], namespace: str, extra_args):
|
|
239
|
-
run_command(Setup(), kubeconfig, config, param, None, namespace, None, extra_args)
|
|
240
|
-
|
|
241
|
-
|
|
242
242
|
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=ShowCommandHelper, help='Show configuration or kubectl commands.')
|
|
243
243
|
@click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
|
|
244
244
|
@click.option('--config', default='params.yaml', metavar='path', help='path to kaqing parameters file')
|
|
@@ -251,14 +251,14 @@ def show(kubeconfig: str, config: str, param: list[str], cluster: str, namespace
|
|
|
251
251
|
run_command(Show(), kubeconfig, config, param, cluster, namespace, pod, extra_args)
|
|
252
252
|
|
|
253
253
|
|
|
254
|
-
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=
|
|
254
|
+
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=UndeployCommandHelper, help='Undeploy.')
|
|
255
255
|
@click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
|
|
256
256
|
@click.option('--config', default='params.yaml', metavar='path', help='path to kaqing parameters file')
|
|
257
257
|
@click.option('--param', '-v', multiple=True, metavar='<key>=<value>', help='parameter override')
|
|
258
258
|
@click.option('--namespace', '-n', required=False, metavar='namespace', help='Kubernetes namespace')
|
|
259
259
|
@click.argument('extra_args', nargs=-1, metavar='<pod>', type=click.UNPROCESSED)
|
|
260
|
-
def
|
|
261
|
-
run_command(
|
|
260
|
+
def undeploy(kubeconfig: str, config: str, param: list[str], namespace: str, extra_args):
|
|
261
|
+
run_command(Undeploy(), kubeconfig, config, param, None, namespace, None, extra_args)
|
|
262
262
|
|
|
263
263
|
|
|
264
264
|
@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=PodCommandHelper, help='Get cassandra log.')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from adam.commands.command import Command
|
|
2
|
-
from adam.commands.
|
|
2
|
+
from adam.commands.deploy.code_utils import start_user_code, stop_user_codes
|
|
3
3
|
from adam.repl_state import ReplState, RequiredState
|
|
4
4
|
from adam.utils import log2
|
|
5
5
|
|
kaqing-1.98.86/adam/commands/frontend/setup.py → kaqing-1.98.88/adam/commands/deploy/deploy.py
RENAMED
|
@@ -2,17 +2,18 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from adam.commands.command import Command
|
|
4
4
|
from adam.commands.command_helpers import ClusterCommandHelper
|
|
5
|
-
from .
|
|
5
|
+
from adam.commands.deploy.deploy_pod import DeployPod
|
|
6
|
+
from .deploy_frontend import DeployFrontend
|
|
6
7
|
from adam.repl_state import ReplState
|
|
7
8
|
from adam.utils import lines_to_tabular, log, log2
|
|
8
9
|
|
|
9
|
-
class
|
|
10
|
-
COMMAND = '
|
|
10
|
+
class Deploy(Command):
|
|
11
|
+
COMMAND = 'deploy'
|
|
11
12
|
reaper_login = None
|
|
12
13
|
|
|
13
14
|
# the singleton pattern
|
|
14
15
|
def __new__(cls, *args, **kwargs):
|
|
15
|
-
if not hasattr(cls, 'instance'): cls.instance = super(
|
|
16
|
+
if not hasattr(cls, 'instance'): cls.instance = super(Deploy, cls).__new__(cls)
|
|
16
17
|
|
|
17
18
|
return cls.instance
|
|
18
19
|
|
|
@@ -20,7 +21,7 @@ class Setup(Command):
|
|
|
20
21
|
super().__init__(successor)
|
|
21
22
|
|
|
22
23
|
def command(self):
|
|
23
|
-
return
|
|
24
|
+
return Deploy.COMMAND
|
|
24
25
|
|
|
25
26
|
def run(self, cmd: str, state: ReplState):
|
|
26
27
|
if not(args := self.args(cmd)):
|
|
@@ -29,18 +30,18 @@ class Setup(Command):
|
|
|
29
30
|
state, args = self.apply_state(args, state)
|
|
30
31
|
|
|
31
32
|
if state.in_repl:
|
|
32
|
-
log(lines_to_tabular([c.help(ReplState()) for c in
|
|
33
|
+
log(lines_to_tabular([c.help(ReplState()) for c in Deploy.cmd_list()], separator=':'))
|
|
33
34
|
|
|
34
35
|
return 'command-missing'
|
|
35
36
|
else:
|
|
36
37
|
# head with the Chain of Responsibility pattern
|
|
37
|
-
cmds = Command.chain(
|
|
38
|
+
cmds = Command.chain(Deploy.cmd_list())
|
|
38
39
|
if not cmds.run(cmd, state):
|
|
39
40
|
log2('* Command is missing.')
|
|
40
41
|
Command.display_help()
|
|
41
42
|
|
|
42
43
|
def cmd_list():
|
|
43
|
-
return [
|
|
44
|
+
return [DeployFrontend(), DeployPod()]
|
|
44
45
|
|
|
45
46
|
def completion(self, state: ReplState):
|
|
46
47
|
if state.sts:
|
|
@@ -51,10 +52,10 @@ class Setup(Command):
|
|
|
51
52
|
def help(self, _: ReplState):
|
|
52
53
|
return None
|
|
53
54
|
|
|
54
|
-
class
|
|
55
|
+
class DeployCommandHelper(click.Command):
|
|
55
56
|
def get_help(self, ctx: click.Context):
|
|
56
57
|
log(super().get_help(ctx))
|
|
57
58
|
log()
|
|
58
59
|
log('Sub-Commands:')
|
|
59
60
|
|
|
60
|
-
log(lines_to_tabular([c.help(ReplState()).replace(f'{
|
|
61
|
+
log(lines_to_tabular([c.help(ReplState()).replace(f'{Deploy.COMMAND} ', ' ', 1) for c in Deploy.cmd_list()], separator=':'))
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
from adam.app_session import AppSession
|
|
2
2
|
from adam.commands.command import Command
|
|
3
|
+
from adam.commands.deploy.deploy_utils import deploy_frontend
|
|
4
|
+
from adam.config import Config
|
|
3
5
|
from adam.k8s_utils.ingresses import Ingresses
|
|
4
6
|
from adam.k8s_utils.services import Services
|
|
5
7
|
from adam.repl_state import ReplState, RequiredState
|
|
6
8
|
from adam.utils import log2
|
|
7
9
|
|
|
8
|
-
class
|
|
9
|
-
COMMAND = '
|
|
10
|
+
class DeployFrontend(Command):
|
|
11
|
+
COMMAND = 'deploy frontend'
|
|
10
12
|
|
|
11
13
|
# the singleton pattern
|
|
12
14
|
def __new__(cls, *args, **kwargs):
|
|
13
|
-
if not hasattr(cls, 'instance'): cls.instance = super(
|
|
15
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DeployFrontend, cls).__new__(cls)
|
|
14
16
|
|
|
15
17
|
return cls.instance
|
|
16
18
|
|
|
@@ -18,7 +20,7 @@ class SetupFrontend(Command):
|
|
|
18
20
|
super().__init__(successor)
|
|
19
21
|
|
|
20
22
|
def command(self):
|
|
21
|
-
return
|
|
23
|
+
return DeployFrontend.COMMAND
|
|
22
24
|
|
|
23
25
|
def required(self):
|
|
24
26
|
return RequiredState.NAMESPACE
|
|
@@ -33,19 +35,13 @@ class SetupFrontend(Command):
|
|
|
33
35
|
|
|
34
36
|
log2('This will support c3/c3 only for demo.')
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
pod_name = Config().get('pod.name', 'ops')
|
|
39
|
+
label_selector = Config().get('pod.label-selector', 'run=ops')
|
|
37
40
|
try:
|
|
38
|
-
|
|
39
|
-
port = 7678
|
|
40
|
-
Services.create_service(name, state.namespace, port, {"run": "ops"})
|
|
41
|
-
Ingresses.create_ingress(name, state.namespace, app_session.host, '/c3/c3/ops($|/)', port, annotations={
|
|
42
|
-
'kubernetes.io/ingress.class': 'nginx',
|
|
43
|
-
'nginx.ingress.kubernetes.io/use-regex': 'true',
|
|
44
|
-
'nginx.ingress.kubernetes.io/rewrite-target': '/'
|
|
45
|
-
})
|
|
41
|
+
deploy_frontend(pod_name, state.namespace, label_selector)
|
|
46
42
|
except Exception as e:
|
|
47
43
|
if e.status == 409:
|
|
48
|
-
log2(f"Error: '{
|
|
44
|
+
log2(f"Error: '{pod_name}' already exists in namespace '{state.namespace}'.")
|
|
49
45
|
else:
|
|
50
46
|
log2(f"Error creating ingress or service: {e}")
|
|
51
47
|
|
|
@@ -55,4 +51,4 @@ class SetupFrontend(Command):
|
|
|
55
51
|
return super().completion(state)
|
|
56
52
|
|
|
57
53
|
def help(self, _: ReplState):
|
|
58
|
-
return f'{
|
|
54
|
+
return f'{DeployFrontend.COMMAND}\t deploy frontend'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from kubernetes import client
|
|
2
|
+
|
|
3
|
+
from adam.commands.command import Command
|
|
4
|
+
from adam.commands.deploy.deploy_utils import deploy_frontend, gen_labels
|
|
5
|
+
from adam.config import Config
|
|
6
|
+
from adam.k8s_utils.ingresses import Ingresses
|
|
7
|
+
from adam.k8s_utils.kube_context import KubeContext
|
|
8
|
+
from adam.k8s_utils.pods import Pods
|
|
9
|
+
from adam.k8s_utils.service_accounts import ServiceAccounts
|
|
10
|
+
from adam.k8s_utils.services import Services
|
|
11
|
+
from adam.repl_state import ReplState, RequiredState
|
|
12
|
+
from adam.utils import log2
|
|
13
|
+
|
|
14
|
+
class DeployPod(Command):
|
|
15
|
+
COMMAND = 'deploy pod'
|
|
16
|
+
|
|
17
|
+
# the singleton pattern
|
|
18
|
+
def __new__(cls, *args, **kwargs):
|
|
19
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DeployPod, cls).__new__(cls)
|
|
20
|
+
|
|
21
|
+
return cls.instance
|
|
22
|
+
|
|
23
|
+
def __init__(self, successor: Command=None):
|
|
24
|
+
super().__init__(successor)
|
|
25
|
+
|
|
26
|
+
def command(self):
|
|
27
|
+
return DeployPod.COMMAND
|
|
28
|
+
|
|
29
|
+
def required(self):
|
|
30
|
+
return RequiredState.NAMESPACE
|
|
31
|
+
|
|
32
|
+
def run(self, cmd: str, state: ReplState):
|
|
33
|
+
if not(args := self.args(cmd)):
|
|
34
|
+
return super().run(cmd, state)
|
|
35
|
+
|
|
36
|
+
state, args = self.apply_state(args, state)
|
|
37
|
+
if not self.validate_state(state):
|
|
38
|
+
return state
|
|
39
|
+
|
|
40
|
+
if KubeContext.in_cluster():
|
|
41
|
+
log2('This is doable only from outside of the Kubernetes cluster.')
|
|
42
|
+
return state
|
|
43
|
+
|
|
44
|
+
sa_name = Config().get('pod.sa.name', 'ops')
|
|
45
|
+
sa_proto = Config().get('pod.sa.proto', 'c3')
|
|
46
|
+
additional_cluster_roles = Config().get('pod.sa.additional-cluster-roles', 'c3aiops-k8ssandra-operator').split(',')
|
|
47
|
+
label_selector = Config().get('pod.label-selector', 'run=ops')
|
|
48
|
+
labels = gen_labels(label_selector)
|
|
49
|
+
ServiceAccounts.replicate(sa_name, state.namespace, sa_proto, labels=labels, add_cluster_roles=additional_cluster_roles)
|
|
50
|
+
|
|
51
|
+
pod_name = Config().get('pod.name', 'ops')
|
|
52
|
+
image = Config().get('pod.image', 'seanahnsf/kaqing')
|
|
53
|
+
security_context = client.V1SecurityContext(
|
|
54
|
+
capabilities=client.V1Capabilities(
|
|
55
|
+
add=["SYS_PTRACE"]
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
Pods.create(state.namespace, pod_name, image, env={'NAMESPACE': state.namespace}, container_security_context=security_context, labels=labels, sa_name=sa_name)
|
|
59
|
+
|
|
60
|
+
deploy_frontend(pod_name, state.namespace, label_selector)
|
|
61
|
+
|
|
62
|
+
return state
|
|
63
|
+
|
|
64
|
+
def completion(self, state: ReplState):
|
|
65
|
+
return super().completion(state)
|
|
66
|
+
|
|
67
|
+
def help(self, _: ReplState):
|
|
68
|
+
return f'{DeployPod.COMMAND}\t deploy pod'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from adam.app_session import AppSession
|
|
2
|
+
from adam.k8s_utils.ingresses import Ingresses
|
|
3
|
+
from adam.k8s_utils.services import Services
|
|
4
|
+
from adam.utils import log2
|
|
5
|
+
|
|
6
|
+
def deploy_frontend(name: str, namespace: str, label_selector: str):
|
|
7
|
+
app_session: AppSession = AppSession.create('c3', 'c3', namespace)
|
|
8
|
+
port = 7678
|
|
9
|
+
labels = gen_labels(label_selector)
|
|
10
|
+
Services.create_service(name, namespace, port, labels, labels=labels)
|
|
11
|
+
# Services.create_service(name, namespace, port, {"run": "ops"})
|
|
12
|
+
Ingresses.create_ingress(name, namespace, app_session.host, '/c3/c3/ops($|/)', port, annotations={
|
|
13
|
+
'kubernetes.io/ingress.class': 'nginx',
|
|
14
|
+
'nginx.ingress.kubernetes.io/use-regex': 'true',
|
|
15
|
+
'nginx.ingress.kubernetes.io/rewrite-target': '/'
|
|
16
|
+
}, labels=labels)
|
|
17
|
+
|
|
18
|
+
log2(f'Ops pod is available at https://{app_session.host}/c3/c3/ops')
|
|
19
|
+
|
|
20
|
+
def undeploy_frontend(namespace: str, label_selector: str):
|
|
21
|
+
Ingresses.delete_ingresses(namespace, label_selector=label_selector)
|
|
22
|
+
Services.delete_services(namespace, label_selector=label_selector)
|
|
23
|
+
|
|
24
|
+
def gen_labels(label_selector: str):
|
|
25
|
+
kv = label_selector.split('=')
|
|
26
|
+
return {kv[0]: kv[1]}
|
kaqing-1.98.86/adam/commands/frontend/teardown.py → kaqing-1.98.88/adam/commands/deploy/undeploy.py
RENAMED
|
@@ -2,18 +2,19 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from adam.commands.command import Command
|
|
4
4
|
from adam.commands.command_helpers import ClusterCommandHelper
|
|
5
|
-
from adam.commands.
|
|
6
|
-
from .
|
|
5
|
+
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
|
6
|
+
from adam.commands.deploy.undeploy_pod import UndeployPod
|
|
7
|
+
from .deploy_frontend import DeployFrontend
|
|
7
8
|
from adam.repl_state import ReplState
|
|
8
9
|
from adam.utils import lines_to_tabular, log, log2
|
|
9
10
|
|
|
10
|
-
class
|
|
11
|
-
COMMAND = '
|
|
11
|
+
class Undeploy(Command):
|
|
12
|
+
COMMAND = 'undeploy'
|
|
12
13
|
reaper_login = None
|
|
13
14
|
|
|
14
15
|
# the singleton pattern
|
|
15
16
|
def __new__(cls, *args, **kwargs):
|
|
16
|
-
if not hasattr(cls, 'instance'): cls.instance = super(
|
|
17
|
+
if not hasattr(cls, 'instance'): cls.instance = super(Undeploy, cls).__new__(cls)
|
|
17
18
|
|
|
18
19
|
return cls.instance
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ class TearDown(Command):
|
|
|
21
22
|
super().__init__(successor)
|
|
22
23
|
|
|
23
24
|
def command(self):
|
|
24
|
-
return
|
|
25
|
+
return Undeploy.COMMAND
|
|
25
26
|
|
|
26
27
|
def run(self, cmd: str, state: ReplState):
|
|
27
28
|
if not(args := self.args(cmd)):
|
|
@@ -30,18 +31,18 @@ class TearDown(Command):
|
|
|
30
31
|
state, args = self.apply_state(args, state)
|
|
31
32
|
|
|
32
33
|
if state.in_repl:
|
|
33
|
-
log(lines_to_tabular([c.help(ReplState()) for c in
|
|
34
|
+
log(lines_to_tabular([c.help(ReplState()) for c in Undeploy.cmd_list()], separator=':'))
|
|
34
35
|
|
|
35
36
|
return 'command-missing'
|
|
36
37
|
else:
|
|
37
38
|
# head with the Chain of Responsibility pattern
|
|
38
|
-
cmds = Command.chain(
|
|
39
|
+
cmds = Command.chain(Undeploy.cmd_list())
|
|
39
40
|
if not cmds.run(cmd, state):
|
|
40
41
|
log2('* Command is missing.')
|
|
41
42
|
Command.display_help()
|
|
42
43
|
|
|
43
44
|
def cmd_list():
|
|
44
|
-
return [
|
|
45
|
+
return [UndeployFrontend(), UndeployPod()]
|
|
45
46
|
|
|
46
47
|
def completion(self, state: ReplState):
|
|
47
48
|
if state.sts:
|
|
@@ -52,10 +53,10 @@ class TearDown(Command):
|
|
|
52
53
|
def help(self, _: ReplState):
|
|
53
54
|
return None
|
|
54
55
|
|
|
55
|
-
class
|
|
56
|
+
class UndeployCommandHelper(click.Command):
|
|
56
57
|
def get_help(self, ctx: click.Context):
|
|
57
58
|
log(super().get_help(ctx))
|
|
58
59
|
log()
|
|
59
60
|
log('Sub-Commands:')
|
|
60
61
|
|
|
61
|
-
log(lines_to_tabular([c.help(ReplState()).replace(f'{
|
|
62
|
+
log(lines_to_tabular([c.help(ReplState()).replace(f'{Undeploy.COMMAND} ', ' ', 1) for c in Undeploy.cmd_list()], separator=':'))
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
from adam.commands.command import Command
|
|
2
|
+
from adam.commands.deploy.deploy_utils import undeploy_frontend
|
|
3
|
+
from adam.config import Config
|
|
2
4
|
from adam.k8s_utils.ingresses import Ingresses
|
|
3
5
|
from adam.k8s_utils.services import Services
|
|
4
6
|
from adam.repl_state import ReplState, RequiredState
|
|
5
7
|
|
|
6
|
-
class
|
|
7
|
-
COMMAND = '
|
|
8
|
+
class UndeployFrontend(Command):
|
|
9
|
+
COMMAND = 'undeploy frontend'
|
|
8
10
|
|
|
9
11
|
# the singleton pattern
|
|
10
12
|
def __new__(cls, *args, **kwargs):
|
|
11
|
-
if not hasattr(cls, 'instance'): cls.instance = super(
|
|
13
|
+
if not hasattr(cls, 'instance'): cls.instance = super(UndeployFrontend, cls).__new__(cls)
|
|
12
14
|
|
|
13
15
|
return cls.instance
|
|
14
16
|
|
|
@@ -16,7 +18,7 @@ class TearDownFrontend(Command):
|
|
|
16
18
|
super().__init__(successor)
|
|
17
19
|
|
|
18
20
|
def command(self):
|
|
19
|
-
return
|
|
21
|
+
return UndeployFrontend.COMMAND
|
|
20
22
|
|
|
21
23
|
def required(self):
|
|
22
24
|
return RequiredState.NAMESPACE
|
|
@@ -29,9 +31,8 @@ class TearDownFrontend(Command):
|
|
|
29
31
|
if not self.validate_state(state):
|
|
30
32
|
return state
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Services.delete_service(name, state.namespace)
|
|
34
|
+
label_selector = Config().get('pod.label-selector', 'run=ops')
|
|
35
|
+
undeploy_frontend(state.namespace, label_selector)
|
|
35
36
|
|
|
36
37
|
return state
|
|
37
38
|
|
|
@@ -39,4 +40,4 @@ class TearDownFrontend(Command):
|
|
|
39
40
|
return super().completion(state)
|
|
40
41
|
|
|
41
42
|
def help(self, _: ReplState):
|
|
42
|
-
return f'{
|
|
43
|
+
return f'{UndeployFrontend.COMMAND}\t undeploy frontend'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from adam.app_session import AppSession
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.commands.deploy.deploy_utils import deploy_frontend, undeploy_frontend
|
|
4
|
+
from adam.config import Config
|
|
5
|
+
from adam.k8s_utils.ingresses import Ingresses
|
|
6
|
+
from adam.k8s_utils.kube_context import KubeContext
|
|
7
|
+
from adam.k8s_utils.pods import Pods
|
|
8
|
+
from adam.k8s_utils.service_accounts import ServiceAccounts
|
|
9
|
+
from adam.k8s_utils.services import Services
|
|
10
|
+
from adam.repl_state import ReplState, RequiredState
|
|
11
|
+
from adam.utils import log2
|
|
12
|
+
|
|
13
|
+
class UndeployPod(Command):
|
|
14
|
+
COMMAND = 'undeploy pod'
|
|
15
|
+
|
|
16
|
+
# the singleton pattern
|
|
17
|
+
def __new__(cls, *args, **kwargs):
|
|
18
|
+
if not hasattr(cls, 'instance'): cls.instance = super(UndeployPod, cls).__new__(cls)
|
|
19
|
+
|
|
20
|
+
return cls.instance
|
|
21
|
+
|
|
22
|
+
def __init__(self, successor: Command=None):
|
|
23
|
+
super().__init__(successor)
|
|
24
|
+
|
|
25
|
+
def command(self):
|
|
26
|
+
return UndeployPod.COMMAND
|
|
27
|
+
|
|
28
|
+
def required(self):
|
|
29
|
+
return RequiredState.NAMESPACE
|
|
30
|
+
|
|
31
|
+
def run(self, cmd: str, state: ReplState):
|
|
32
|
+
if not(args := self.args(cmd)):
|
|
33
|
+
return super().run(cmd, state)
|
|
34
|
+
|
|
35
|
+
state, args = self.apply_state(args, state)
|
|
36
|
+
if not self.validate_state(state):
|
|
37
|
+
return state
|
|
38
|
+
|
|
39
|
+
if KubeContext.in_cluster():
|
|
40
|
+
log2('This is doable only from outside of the Kubernetes cluster.')
|
|
41
|
+
return state
|
|
42
|
+
|
|
43
|
+
label_selector = Config().get('pod.label-selector', 'run=ops')
|
|
44
|
+
undeploy_frontend(state.namespace, label_selector)
|
|
45
|
+
Pods.delete_with_selector(state.namespace, label_selector)
|
|
46
|
+
ServiceAccounts.delete(state.namespace, label_selector=label_selector)
|
|
47
|
+
|
|
48
|
+
return state
|
|
49
|
+
|
|
50
|
+
def completion(self, state: ReplState):
|
|
51
|
+
return super().completion(state)
|
|
52
|
+
|
|
53
|
+
def help(self, _: ReplState):
|
|
54
|
+
return f'{UndeployPod.COMMAND}\t undeploy pod'
|
|
@@ -93,23 +93,23 @@ class PostgresSession:
|
|
|
93
93
|
# template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
|
|
94
94
|
# | | | | | | | postgres=CTc/postgres
|
|
95
95
|
# (48 rows)
|
|
96
|
-
r
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
if r := self.run_sql('\l', show_out=False):
|
|
97
|
+
s = 0
|
|
98
|
+
for line in r.stdout.split('\n'):
|
|
99
|
+
line: str = line.strip(' \r')
|
|
100
|
+
if s == 0:
|
|
101
|
+
if 'List of databases' in line:
|
|
102
|
+
s = 1
|
|
103
|
+
elif s == 1:
|
|
104
|
+
if 'Name' in line and 'Owner' in line and 'Encoding' in line:
|
|
105
|
+
s = 2
|
|
106
|
+
elif s == 2:
|
|
107
|
+
if line.startswith('---------'):
|
|
108
|
+
s = 3
|
|
109
|
+
elif s == 3:
|
|
110
|
+
groups = re.match(r'^\s*(\S*)\s*\|\s*(\S*)\s*\|.*', line)
|
|
111
|
+
if groups and groups[1] != '|':
|
|
112
|
+
dbs.append({'name': groups[1], 'owner': groups[2]})
|
|
113
113
|
|
|
114
114
|
return dbs
|
|
115
115
|
|
|
@@ -120,23 +120,23 @@ class PostgresSession:
|
|
|
120
120
|
# ----------+------------------------------------------------------------+-------+---------------
|
|
121
121
|
# postgres | c3_2_admin_aclpriv | table | postgres
|
|
122
122
|
# postgres | c3_2_admin_aclpriv_a | table | postgres
|
|
123
|
-
r
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
123
|
+
if r := self.run_sql('\dt', show_out=False):
|
|
124
|
+
s = 0
|
|
125
|
+
for line in r.stdout.split('\n'):
|
|
126
|
+
line: str = line.strip(' \r')
|
|
127
|
+
if s == 0:
|
|
128
|
+
if 'List of relations' in line:
|
|
129
|
+
s = 1
|
|
130
|
+
elif s == 1:
|
|
131
|
+
if 'Schema' in line and 'Name' in line and 'Type' in line:
|
|
132
|
+
s = 2
|
|
133
|
+
elif s == 2:
|
|
134
|
+
if line.startswith('---------'):
|
|
135
|
+
s = 3
|
|
136
|
+
elif s == 3:
|
|
137
|
+
groups = re.match(r'^\s*(\S*)\s*\|\s*(\S*)\s*\|.*', line)
|
|
138
|
+
if groups and groups[1] != '|':
|
|
139
|
+
dbs.append({'schema': groups[1], 'name': groups[2]})
|
|
140
140
|
|
|
141
141
|
return dbs
|
|
142
142
|
|
|
@@ -156,28 +156,35 @@ class PostgresSession:
|
|
|
156
156
|
return r
|
|
157
157
|
else:
|
|
158
158
|
ns = self.namespace
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
pod_name = Config().get('pg.agent.name', 'ops')
|
|
160
|
+
|
|
161
|
+
if Config().get('pg.agent.just-in-time', False):
|
|
162
|
+
image = Config().get('pg.agent.image', 'seanahnsf/kaqing')
|
|
163
|
+
timeout = Config().get('pg.agent.timeout', 3600)
|
|
164
|
+
try:
|
|
165
|
+
Pods.create(ns, pod_name, image, ['sleep', f'{timeout}'], env={'NAMESPACE': ns}, sa_name='c3')
|
|
166
|
+
except Exception as e:
|
|
167
|
+
if e.status == 409:
|
|
168
|
+
if Pods.completed(ns, pod_name):
|
|
169
|
+
try:
|
|
170
|
+
Pods.delete(pod_name, ns)
|
|
171
|
+
Pods.create(ns, pod_name, image, ['sleep', f'{timeout}'], env={'NAMESPACE': ns}, sa_name='c3')
|
|
172
|
+
except Exception as e2:
|
|
173
|
+
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e2)
|
|
174
|
+
|
|
175
|
+
return
|
|
176
|
+
else:
|
|
177
|
+
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e)
|
|
178
|
+
|
|
179
|
+
return
|
|
180
|
+
|
|
181
|
+
Pods.wait_for_running(ns, pod_name)
|
|
162
182
|
|
|
163
183
|
try:
|
|
164
|
-
Pods.
|
|
165
|
-
except
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
try:
|
|
169
|
-
Pods.delete(pod_name, ns)
|
|
170
|
-
Pods.create(ns, pod_name, image, ['sleep', f'{timeout}'], env={'NAMESPACE': ns}, sa_name='c3')
|
|
171
|
-
except Exception as e2:
|
|
172
|
-
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e2)
|
|
173
|
-
|
|
174
|
-
return
|
|
175
|
-
else:
|
|
176
|
-
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e)
|
|
177
|
-
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
Pods.wait_for_running(ns, pod_name)
|
|
184
|
+
Pods.get(ns, pod_name)
|
|
185
|
+
except:
|
|
186
|
+
log2(f"Could not locate {pod_name} pod.")
|
|
187
|
+
return None
|
|
181
188
|
|
|
182
189
|
cmd = f'PGPASSWORD="{self.password()}" psql -h {self.endpoint()} -p {self.port()} -U {self.username()} {db} --pset pager=off -c "{sql}"'
|
|
183
190
|
|
|
@@ -8,7 +8,7 @@ import threading
|
|
|
8
8
|
import traceback
|
|
9
9
|
|
|
10
10
|
from adam import log
|
|
11
|
-
from adam.commands.
|
|
11
|
+
from adam.commands.deploy.code_utils import get_available_port
|
|
12
12
|
from adam.config import Config
|
|
13
13
|
from adam.sso.idp import Idp
|
|
14
14
|
from adam.app_session import AppSession, IdpLogin
|