kaqing 2.0.11__tar.gz → 2.0.12__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.
- {kaqing-2.0.11 → kaqing-2.0.12}/PKG-INFO +1 -1
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/deploy.py +2 -1
- kaqing-2.0.12/adam/commands/deploy/deploy_pg_agent.py +49 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/undeploy.py +2 -1
- kaqing-2.0.12/adam/commands/deploy/undeploy_pg_agent.py +45 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/postgres/postgres_session.py +30 -21
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/embedded_params.py +1 -1
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/pods.py +2 -2
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/repl_commands.py +3 -1
- kaqing-2.0.12/adam/version.py +5 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.11 → kaqing-2.0.12}/kaqing.egg-info/SOURCES.txt +2 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/setup.py +1 -1
- kaqing-2.0.11/adam/version.py +0 -5
- {kaqing-2.0.11 → kaqing-2.0.12}/README +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/app_session.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/apps.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/batch.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/check.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/disk.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/issue.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/memory.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/checks/status.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/cli.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/cli_group.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/column.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/columns.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/memory.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/app.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/app_ping.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/bash.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/cd.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/check.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/command.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/cp.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/cql_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/cqlsh.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/devices.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/exit.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/help.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/issues.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/login.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/logs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/ls.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/postgres/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/postgres/postgres.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/preview_table.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/repair.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/report.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/restart.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/shell.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_login.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/commands/watch.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/config.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/cassandra_clusters.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/cassandra_nodes.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/config_maps.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/custom_resources.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/deployment.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/ingresses.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/jobs.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/kube_context.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/secrets.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/service_accounts.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/services.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/statefulsets.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/k8s_utils/volumes.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/log.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/pod_exec_result.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/repl.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/repl_session.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/repl_state.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/__init__.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/idp.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/adam/utils.py +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.11 → kaqing-2.0.12}/setup.cfg +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
import click
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
|
+
from adam.commands.deploy.deploy_pg_agent import DeployPgAgent
|
4
5
|
from adam.commands.deploy.deploy_pod import DeployPod
|
5
6
|
from .deploy_frontend import DeployFrontend
|
6
7
|
from adam.repl_state import ReplState
|
@@ -40,7 +41,7 @@ class Deploy(Command):
|
|
40
41
|
Command.display_help()
|
41
42
|
|
42
43
|
def cmd_list():
|
43
|
-
return [DeployFrontend(), DeployPod()]
|
44
|
+
return [DeployFrontend(), DeployPod(), DeployPgAgent()]
|
44
45
|
|
45
46
|
def completion(self, state: ReplState):
|
46
47
|
if state.sts:
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from kubernetes import client
|
2
|
+
import yaml
|
3
|
+
|
4
|
+
from adam.commands.command import Command
|
5
|
+
from adam.commands.deploy.deploy_utils import creating, deploy_frontend, gen_labels
|
6
|
+
from adam.commands.postgres.postgres_session import PostgresSession
|
7
|
+
from adam.config import Config
|
8
|
+
from adam.k8s_utils.config_maps import ConfigMaps
|
9
|
+
from adam.k8s_utils.deployment import Deployments
|
10
|
+
from adam.k8s_utils.kube_context import KubeContext
|
11
|
+
from adam.k8s_utils.pods import Pods
|
12
|
+
from adam.k8s_utils.service_accounts import ServiceAccounts
|
13
|
+
from adam.k8s_utils.volumes import ConfigMapMount
|
14
|
+
from adam.repl_state import ReplState, RequiredState
|
15
|
+
from adam.utils import log2
|
16
|
+
|
17
|
+
class DeployPgAgent(Command):
|
18
|
+
COMMAND = 'deploy pg-agent'
|
19
|
+
|
20
|
+
# the singleton pattern
|
21
|
+
def __new__(cls, *args, **kwargs):
|
22
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DeployPgAgent, cls).__new__(cls)
|
23
|
+
|
24
|
+
return cls.instance
|
25
|
+
|
26
|
+
def __init__(self, successor: Command=None):
|
27
|
+
super().__init__(successor)
|
28
|
+
|
29
|
+
def command(self):
|
30
|
+
return DeployPgAgent.COMMAND
|
31
|
+
|
32
|
+
def required(self):
|
33
|
+
return RequiredState.NAMESPACE
|
34
|
+
|
35
|
+
def run(self, cmd: str, state: ReplState):
|
36
|
+
if not(args := self.args(cmd)):
|
37
|
+
return super().run(cmd, state)
|
38
|
+
|
39
|
+
state, args = self.apply_state(args, state)
|
40
|
+
if not self.validate_state(state):
|
41
|
+
return state
|
42
|
+
|
43
|
+
PostgresSession.deploy_pg_agent(Config().get('pg.agent.name', 'ops-pg-agent'), state.namespace)
|
44
|
+
|
45
|
+
def completion(self, state: ReplState):
|
46
|
+
return super().completion(state)
|
47
|
+
|
48
|
+
def help(self, _: ReplState):
|
49
|
+
return f'{DeployPgAgent.COMMAND}\t deploy postgres agent'
|
@@ -2,6 +2,7 @@ import click
|
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
4
|
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
5
|
+
from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
|
5
6
|
from adam.commands.deploy.undeploy_pod import UndeployPod
|
6
7
|
from adam.repl_state import ReplState
|
7
8
|
from adam.utils import lines_to_tabular, log, log2
|
@@ -40,7 +41,7 @@ class Undeploy(Command):
|
|
40
41
|
Command.display_help()
|
41
42
|
|
42
43
|
def cmd_list():
|
43
|
-
return [UndeployFrontend(), UndeployPod()]
|
44
|
+
return [UndeployFrontend(), UndeployPod(), UndeployPgAgent()]
|
44
45
|
|
45
46
|
def completion(self, state: ReplState):
|
46
47
|
if state.sts:
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from adam.commands.command import Command
|
2
|
+
from adam.commands.deploy.deploy_utils import undeploy_frontend, deleting
|
3
|
+
from adam.commands.postgres.postgres_session import PostgresSession
|
4
|
+
from adam.config import Config
|
5
|
+
from adam.k8s_utils.config_maps import ConfigMaps
|
6
|
+
from adam.k8s_utils.deployment import Deployments
|
7
|
+
from adam.k8s_utils.pods import Pods
|
8
|
+
from adam.k8s_utils.service_accounts import ServiceAccounts
|
9
|
+
from adam.repl_state import ReplState, RequiredState
|
10
|
+
|
11
|
+
class UndeployPgAgent(Command):
|
12
|
+
COMMAND = 'undeploy pg-agent'
|
13
|
+
|
14
|
+
# the singleton pattern
|
15
|
+
def __new__(cls, *args, **kwargs):
|
16
|
+
if not hasattr(cls, 'instance'): cls.instance = super(UndeployPgAgent, cls).__new__(cls)
|
17
|
+
|
18
|
+
return cls.instance
|
19
|
+
|
20
|
+
def __init__(self, successor: Command=None):
|
21
|
+
super().__init__(successor)
|
22
|
+
|
23
|
+
def command(self):
|
24
|
+
return UndeployPgAgent.COMMAND
|
25
|
+
|
26
|
+
def required(self):
|
27
|
+
return RequiredState.NAMESPACE
|
28
|
+
|
29
|
+
def run(self, cmd: str, state: ReplState):
|
30
|
+
if not(args := self.args(cmd)):
|
31
|
+
return super().run(cmd, state)
|
32
|
+
|
33
|
+
state, args = self.apply_state(args, state)
|
34
|
+
if not self.validate_state(state):
|
35
|
+
return state
|
36
|
+
|
37
|
+
PostgresSession.undeploy_pg_agent(Config().get('pg.agent.name', 'ops-pg-agent'), state.namespace)
|
38
|
+
|
39
|
+
return state
|
40
|
+
|
41
|
+
def completion(self, state: ReplState):
|
42
|
+
return super().completion(state)
|
43
|
+
|
44
|
+
def help(self, _: ReplState):
|
45
|
+
return f'{UndeployPgAgent.COMMAND}\t undeploy postgres agent'
|
@@ -156,29 +156,11 @@ class PostgresSession:
|
|
156
156
|
return r
|
157
157
|
else:
|
158
158
|
ns = self.namespace
|
159
|
-
pod_name = Config().get('pg.agent.name', 'ops')
|
159
|
+
pod_name = Config().get('pg.agent.name', 'ops-pg-agent')
|
160
160
|
|
161
161
|
if Config().get('pg.agent.just-in-time', False):
|
162
|
-
|
163
|
-
|
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
|
+
if not PostgresSession.deploy_pg_agent(pod_name, ns):
|
163
|
+
return
|
182
164
|
|
183
165
|
real_pod_name = pod_name
|
184
166
|
try:
|
@@ -196,6 +178,33 @@ class PostgresSession:
|
|
196
178
|
|
197
179
|
return Pods.exec(real_pod_name, pod_name, ns, cmd, show_out=show_out)
|
198
180
|
|
181
|
+
def deploy_pg_agent(pod_name: str, ns: str) -> str:
|
182
|
+
image = Config().get('pg.agent.image', 'seanahnsf/kaqing')
|
183
|
+
timeout = Config().get('pg.agent.timeout', 3600)
|
184
|
+
try:
|
185
|
+
Pods.create(ns, pod_name, image, ['sleep', f'{timeout}'], env={'NAMESPACE': ns}, sa_name='c3')
|
186
|
+
except Exception as e:
|
187
|
+
if e.status == 409:
|
188
|
+
if Pods.completed(ns, pod_name):
|
189
|
+
try:
|
190
|
+
Pods.delete(pod_name, ns)
|
191
|
+
Pods.create(ns, pod_name, image, ['sleep', f'{timeout}'], env={'NAMESPACE': ns}, sa_name='c3')
|
192
|
+
except Exception as e2:
|
193
|
+
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e2)
|
194
|
+
|
195
|
+
return
|
196
|
+
else:
|
197
|
+
log2("Exception when calling BatchV1Api->create_pod: %s\n" % e)
|
198
|
+
|
199
|
+
return
|
200
|
+
|
201
|
+
Pods.wait_for_running(ns, pod_name)
|
202
|
+
|
203
|
+
return pod_name
|
204
|
+
|
205
|
+
def undeploy_pg_agent(pod_name: str, ns: str):
|
206
|
+
Pods.delete(pod_name, ns, grace_period_seconds=0)
|
207
|
+
|
199
208
|
def endpoint(self):
|
200
209
|
if not self.conn_details:
|
201
210
|
self.conn_details = Secrets.get_data(self.namespace, self.host)
|
@@ -1,2 +1,2 @@
|
|
1
1
|
def config():
|
2
|
-
return {'app': {'console-endpoint': 'https://{host}/{env}/{app}/static/console/index.html', 'cr': {'cluster-regex': '(.*?-.*?)-.*', 'group': 'ops.c3.ai', 'v': 'v2', 'plural': 'c3cassandras'}, 'label': 'c3__app_id-0', 'login': {'admin-group': '{host}/C3.ClusterAdmin', 'ingress': '{app_id}-k8singr-appleader-001', 'timeout': 5, 'session-check-url': 'https://{host}/{env}/{app}/api/8/C3/userSessionToken', 'cache-creds': True, 'cache-username': True, 'url': 'https://{host}/{env}/{app}', 'another': "You're logged in to {has}. However, for this app, you need to log in to {need}.", 'token-server-url': 'http://localhost:{port}', 'password-max-length': 128}, 'strip': '0'}, 'bash': {'workers': 32}, 'cassandra': {'service-name': 'all-pods-service'}, 'cql': {'workers': 32, 'samples': 3, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-superuser', 'password-item': 'password'}}, 'checks': {'compactions-threshold': 250, 'cpu-busy-threshold': 98.0, 'cpu-threshold': 0.0, 'cassandra-data-path': '/c3/cassandra', 'root-disk-threshold': 50, 'cassandra-disk-threshold': 50, 'snapshot-size-cmd': "ls /c3/cassandra/data/data/*/*/snapshots | grep snapshots | sed 's/:$//g' | xargs -I {} du -sk {} | awk '{print $1}' | awk '{s+=$1} END {print s}'", 'snapshot-size-threshold': '40G', 'table-sizes-cmd': "ls -Al /c3/cassandra/data/data/ | awk '{print $9}' | sed 's/\\^r//g' | xargs -I {} du -sk /c3/cassandra/data/data/{}"}, 'get-host-id': {'workers': 32}, 'idps': {'ad': {'email-pattern': '.*@c3.ai', 'uri': 'https://login.microsoftonline.com/53ad779a-93e7-485c-ba20-ac8290d7252b/oauth2/v2.0/authorize?response_type=id_token&response_mode=form_post&client_id=00ff94a8-6b0a-4715-98e0-95490012d818&scope=openid+email+profile&redirect_uri=https%3A%2F%2Fplat.c3ci.cloud%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://login.microsoftonline.com/common/discovery/keys', 'contact': 'Please contact ted.tran@c3.ai.', 'whitelist-file': '/kaqing/members'}, 'okta': {'default': True, 'email-pattern': '.*@c3iot.com', 'uri': 'https://c3energy.okta.com/oauth2/v1/authorize?response_type=id_token&response_mode=form_post&client_id={client_id}&scope=openid+email+profile+groups&redirect_uri=https%3A%2F%2F{host}%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://c3energy.okta.com/oauth2/v1/keys'}}, 'issues': {'workers': 32}, 'logs': {'path': '/c3/cassandra/logs/system.log'}, 'medusa': {'restore-auto-complete': False}, 'nodetool': {'workers': 32, 'samples': 3, 'commands_in_line': 40}, 'pg': {'name-pattern': '^{namespace}.*-k8spg-.*', 'excludes': '.helm., -admin-secret', 'agent': {'name': 'ops', 'just-in-time': False, 'timeout': 86400, 'image': 'seanahnsf/kaqing'}, 'default-db': 'postgres', 'default-schema': 'postgres', 'secret': {'endpoint-key': 'postgres-db-endpoint', 'port-key': 'postgres-db-port', 'username-key': 'postgres-admin-username', 'password-key': 'postgres-admin-password'}}, 'pod': {'name': 'ops', 'image': 'seanahnsf/kaqing-cloud', 'sa': {'name': 'ops', 'proto': 'c3', 'additional-cluster-roles': 'c3aiops-k8ssandra-operator'}, 'label-selector': 'run=ops'}, 'preview': {'rows': 10}, 'processes': {'columns': 'pod,cpu,mem', 'header': 'POD_NAME,CPU,MEM/LIMIT'}, 'reaper': {'service-name': 'reaper-service', 'port-forward': {'timeout': 86400, 'local-port': 9001}, 'abort-runs-batch': 10, 'show-runs-batch': 100, 'pod': {'cluster-regex': '(.*?-.*?-.*?-.*?)-.*', 'label-selector': 'k8ssandra.io/reaper={cluster}-reaper'}, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-reaper-ui', 'password-item': 'password'}}, 'repair': {'log-path': '/home/cassrepair/logs/', 'image': 'ci-registry.c3iot.io/cloudops/cassrepair:2.0.13', 'secret': 'ciregistryc3iotio', 'env': {'interval': 24, 'timeout': 60, 'pr': False, 'runs': 1}}, 'repl': {'start-drive': 'a', 'auto-enter-app': 'c3/c3', 'auto-enter-only-cluster': True}, 'status': {'columns': 'status,address,load,tokens,owns,host_id,gossip,compactions', 'header': '--,Address,Load,Tokens,Owns,Host ID,GOSSIP,COMPACTIONS'}, 'storage': {'columns': 'pod,volume_root,volume_cassandra,snapshots,data,compactions', 'header': 'POD_NAME,VOLUME /,VOLUME CASS,SNAPSHOTS,DATA,COMPACTIONS'}, 'watch': {'auto': 'rollout', 'timeout': 3600, 'interval': 10}, 'debug': {'timings': False, 'exit-on-error': False, 'show-parallelism': False, 'show-out': False}}
|
2
|
+
return {'app': {'console-endpoint': 'https://{host}/{env}/{app}/static/console/index.html', 'cr': {'cluster-regex': '(.*?-.*?)-.*', 'group': 'ops.c3.ai', 'v': 'v2', 'plural': 'c3cassandras'}, 'label': 'c3__app_id-0', 'login': {'admin-group': '{host}/C3.ClusterAdmin', 'ingress': '{app_id}-k8singr-appleader-001', 'timeout': 5, 'session-check-url': 'https://{host}/{env}/{app}/api/8/C3/userSessionToken', 'cache-creds': True, 'cache-username': True, 'url': 'https://{host}/{env}/{app}', 'another': "You're logged in to {has}. However, for this app, you need to log in to {need}.", 'token-server-url': 'http://localhost:{port}', 'password-max-length': 128}, 'strip': '0'}, 'bash': {'workers': 32}, 'cassandra': {'service-name': 'all-pods-service'}, 'cql': {'workers': 32, 'samples': 3, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-superuser', 'password-item': 'password'}}, 'checks': {'compactions-threshold': 250, 'cpu-busy-threshold': 98.0, 'cpu-threshold': 0.0, 'cassandra-data-path': '/c3/cassandra', 'root-disk-threshold': 50, 'cassandra-disk-threshold': 50, 'snapshot-size-cmd': "ls /c3/cassandra/data/data/*/*/snapshots | grep snapshots | sed 's/:$//g' | xargs -I {} du -sk {} | awk '{print $1}' | awk '{s+=$1} END {print s}'", 'snapshot-size-threshold': '40G', 'table-sizes-cmd': "ls -Al /c3/cassandra/data/data/ | awk '{print $9}' | sed 's/\\^r//g' | xargs -I {} du -sk /c3/cassandra/data/data/{}"}, 'get-host-id': {'workers': 32}, 'idps': {'ad': {'email-pattern': '.*@c3.ai', 'uri': 'https://login.microsoftonline.com/53ad779a-93e7-485c-ba20-ac8290d7252b/oauth2/v2.0/authorize?response_type=id_token&response_mode=form_post&client_id=00ff94a8-6b0a-4715-98e0-95490012d818&scope=openid+email+profile&redirect_uri=https%3A%2F%2Fplat.c3ci.cloud%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://login.microsoftonline.com/common/discovery/keys', 'contact': 'Please contact ted.tran@c3.ai.', 'whitelist-file': '/kaqing/members'}, 'okta': {'default': True, 'email-pattern': '.*@c3iot.com', 'uri': 'https://c3energy.okta.com/oauth2/v1/authorize?response_type=id_token&response_mode=form_post&client_id={client_id}&scope=openid+email+profile+groups&redirect_uri=https%3A%2F%2F{host}%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://c3energy.okta.com/oauth2/v1/keys'}}, 'issues': {'workers': 32}, 'logs': {'path': '/c3/cassandra/logs/system.log'}, 'medusa': {'restore-auto-complete': False}, 'nodetool': {'workers': 32, 'samples': 3, 'commands_in_line': 40}, 'pg': {'name-pattern': '^{namespace}.*-k8spg-.*', 'excludes': '.helm., -admin-secret', 'agent': {'name': 'ops-pg-agent', 'just-in-time': False, 'timeout': 86400, 'image': 'seanahnsf/kaqing'}, 'default-db': 'postgres', 'default-schema': 'postgres', 'secret': {'endpoint-key': 'postgres-db-endpoint', 'port-key': 'postgres-db-port', 'username-key': 'postgres-admin-username', 'password-key': 'postgres-admin-password'}}, 'pod': {'name': 'ops', 'image': 'seanahnsf/kaqing-cloud', 'sa': {'name': 'ops', 'proto': 'c3', 'additional-cluster-roles': 'c3aiops-k8ssandra-operator'}, 'label-selector': 'run=ops'}, 'preview': {'rows': 10}, 'processes': {'columns': 'pod,cpu,mem', 'header': 'POD_NAME,CPU,MEM/LIMIT'}, 'reaper': {'service-name': 'reaper-service', 'port-forward': {'timeout': 86400, 'local-port': 9001}, 'abort-runs-batch': 10, 'show-runs-batch': 100, 'pod': {'cluster-regex': '(.*?-.*?-.*?-.*?)-.*', 'label-selector': 'k8ssandra.io/reaper={cluster}-reaper'}, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-reaper-ui', 'password-item': 'password'}}, 'repair': {'log-path': '/home/cassrepair/logs/', 'image': 'ci-registry.c3iot.io/cloudops/cassrepair:2.0.13', 'secret': 'ciregistryc3iotio', 'env': {'interval': 24, 'timeout': 60, 'pr': False, 'runs': 1}}, 'repl': {'start-drive': 'a', 'auto-enter-app': 'c3/c3', 'auto-enter-only-cluster': True}, 'status': {'columns': 'status,address,load,tokens,owns,host_id,gossip,compactions', 'header': '--,Address,Load,Tokens,Owns,Host ID,GOSSIP,COMPACTIONS'}, 'storage': {'columns': 'pod,volume_root,volume_cassandra,snapshots,data,compactions', 'header': 'POD_NAME,VOLUME /,VOLUME CASS,SNAPSHOTS,DATA,COMPACTIONS'}, 'watch': {'auto': 'rollout', 'timeout': 3600, 'interval': 10}, 'debug': {'timings': False, 'exit-on-error': False, 'show-parallelism': False, 'show-out': False}}
|
@@ -24,10 +24,10 @@ class Pods:
|
|
24
24
|
|
25
25
|
return _TEST_POD_EXEC_OUTS
|
26
26
|
|
27
|
-
def delete(pod_name: str, namespace: str):
|
27
|
+
def delete(pod_name: str, namespace: str, grace_period_seconds: int = None):
|
28
28
|
try:
|
29
29
|
v1 = client.CoreV1Api()
|
30
|
-
api_response = v1.delete_namespaced_pod(pod_name, namespace)
|
30
|
+
api_response = v1.delete_namespaced_pod(pod_name, namespace, grace_period_seconds=grace_period_seconds)
|
31
31
|
except Exception as e:
|
32
32
|
log2("Exception when calling CoreV1Api->delete_namespaced_pod: %s\n" % e)
|
33
33
|
|
@@ -4,9 +4,11 @@ from adam.commands.deploy.code_start import CodeStart
|
|
4
4
|
from adam.commands.deploy.code_stop import CodeStop
|
5
5
|
from adam.commands.deploy.deploy import Deploy
|
6
6
|
from adam.commands.deploy.deploy_frontend import DeployFrontend
|
7
|
+
from adam.commands.deploy.deploy_pg_agent import DeployPgAgent
|
7
8
|
from adam.commands.deploy.deploy_pod import DeployPod
|
8
9
|
from adam.commands.deploy.undeploy import Undeploy
|
9
10
|
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
11
|
+
from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
|
10
12
|
from adam.commands.deploy.undeploy_pod import UndeployPod
|
11
13
|
from adam.commands.shell import Shell
|
12
14
|
from adam.commands.show.show_app_queues import ShowAppQueues
|
@@ -78,7 +80,7 @@ class ReplCommands:
|
|
78
80
|
return Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
|
79
81
|
|
80
82
|
def tools() -> list[Command]:
|
81
|
-
return [Cqlsh(), Postgres(), Bash(), Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod()]
|
83
|
+
return [Cqlsh(), Postgres(), Bash(), Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod(), DeployPgAgent(), UndeployPgAgent()]
|
82
84
|
|
83
85
|
def app() -> list[Command]:
|
84
86
|
return [ShowAppActions(), ShowAppId(), ShowAppQueues(), AppPing(), App()]
|
@@ -85,10 +85,12 @@ adam/commands/deploy/code_stop.py
|
|
85
85
|
adam/commands/deploy/code_utils.py
|
86
86
|
adam/commands/deploy/deploy.py
|
87
87
|
adam/commands/deploy/deploy_frontend.py
|
88
|
+
adam/commands/deploy/deploy_pg_agent.py
|
88
89
|
adam/commands/deploy/deploy_pod.py
|
89
90
|
adam/commands/deploy/deploy_utils.py
|
90
91
|
adam/commands/deploy/undeploy.py
|
91
92
|
adam/commands/deploy/undeploy_frontend.py
|
93
|
+
adam/commands/deploy/undeploy_pg_agent.py
|
92
94
|
adam/commands/deploy/undeploy_pod.py
|
93
95
|
adam/commands/medusa/__init__.py
|
94
96
|
adam/commands/medusa/medusa.py
|
kaqing-2.0.11/adam/version.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|