vantage6 5.0.0a36__py3-none-any.whl → 5.0.0a38__py3-none-any.whl
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 vantage6 might be problematic. Click here for more details.
- vantage6/cli/algorithm/generate_algorithm_json.py +0 -1
- vantage6/cli/algostore/attach.py +28 -3
- vantage6/cli/algostore/list.py +2 -2
- vantage6/cli/algostore/new.py +3 -2
- vantage6/cli/algostore/start.py +25 -6
- vantage6/cli/algostore/stop.py +3 -0
- vantage6/cli/algostore/version.py +62 -0
- vantage6/cli/auth/attach.py +1 -1
- vantage6/cli/auth/list.py +2 -2
- vantage6/cli/auth/new.py +3 -2
- vantage6/cli/auth/remove.py +58 -0
- vantage6/cli/auth/start.py +27 -9
- vantage6/cli/auth/stop.py +3 -0
- vantage6/cli/cli.py +21 -0
- vantage6/cli/common/attach.py +114 -0
- vantage6/cli/common/decorator.py +25 -4
- vantage6/cli/common/list.py +68 -0
- vantage6/cli/common/new.py +27 -7
- vantage6/cli/common/remove.py +18 -0
- vantage6/cli/common/start.py +48 -40
- vantage6/cli/common/stop.py +16 -4
- vantage6/cli/common/utils.py +65 -74
- vantage6/cli/common/version.py +82 -0
- vantage6/cli/config.py +10 -2
- vantage6/cli/{configuration_wizard.py → configuration_create.py} +22 -14
- vantage6/cli/configuration_manager.py +70 -21
- vantage6/cli/context/__init__.py +10 -5
- vantage6/cli/context/algorithm_store.py +13 -7
- vantage6/cli/context/auth.py +23 -5
- vantage6/cli/context/node.py +25 -8
- vantage6/cli/context/server.py +18 -6
- vantage6/cli/globals.py +1 -0
- vantage6/cli/node/attach.py +27 -3
- vantage6/cli/node/common/__init__.py +26 -10
- vantage6/cli/node/common/task_cleanup.py +153 -0
- vantage6/cli/node/list.py +3 -44
- vantage6/cli/node/new.py +13 -6
- vantage6/cli/node/set_api_key.py +1 -1
- vantage6/cli/node/start.py +30 -7
- vantage6/cli/node/stop.py +151 -7
- vantage6/cli/node/version.py +96 -33
- vantage6/cli/sandbox/config/base.py +109 -0
- vantage6/cli/sandbox/config/core.py +300 -0
- vantage6/cli/sandbox/config/node.py +311 -0
- vantage6/cli/sandbox/data/km_dataset.csv +2401 -0
- vantage6/cli/sandbox/data/olympic_athletes_2016.csv +2425 -0
- vantage6/cli/sandbox/new.py +207 -0
- vantage6/cli/sandbox/populate/__init__.py +173 -0
- vantage6/cli/sandbox/populate/helpers/connect_store.py +203 -0
- vantage6/cli/sandbox/populate/helpers/delete_fixtures.py +67 -0
- vantage6/cli/sandbox/populate/helpers/load_fixtures.py +476 -0
- vantage6/cli/sandbox/populate/helpers/utils.py +35 -0
- vantage6/cli/sandbox/remove.py +155 -0
- vantage6/cli/sandbox/start.py +349 -0
- vantage6/cli/sandbox/stop.py +106 -0
- vantage6/cli/server/attach.py +28 -3
- vantage6/cli/server/common/__init__.py +5 -6
- vantage6/cli/server/import_.py +137 -119
- vantage6/cli/server/list.py +2 -2
- vantage6/cli/server/new.py +5 -3
- vantage6/cli/server/start.py +21 -4
- vantage6/cli/server/stop.py +2 -0
- vantage6/cli/server/version.py +31 -18
- vantage6/cli/template/algo_store_config.j2 +3 -0
- vantage6/cli/template/auth_config.j2 +24 -1
- vantage6/cli/template/node_config.j2 +2 -0
- vantage6/cli/template/server_config.j2 +10 -7
- vantage6/cli/use/context.py +8 -1
- vantage6/cli/use/namespace.py +10 -7
- vantage6/cli/utils.py +33 -1
- vantage6/cli/utils_kubernetes.py +270 -0
- {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/METADATA +4 -4
- vantage6-5.0.0a38.dist-info/RECORD +102 -0
- vantage6/cli/rabbitmq/__init__.py +0 -0
- vantage6/cli/rabbitmq/definitions.py +0 -26
- vantage6/cli/rabbitmq/queue_manager.py +0 -220
- vantage6/cli/rabbitmq/rabbitmq.config +0 -8
- vantage6-5.0.0a36.dist-info/RECORD +0 -86
- {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/WHEEL +0 -0
- {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/entry_points.txt +0 -0
|
@@ -215,7 +215,6 @@ class Function:
|
|
|
215
215
|
"display_name": self._pretty_print_name(name),
|
|
216
216
|
"description": self._extract_parameter_description(name),
|
|
217
217
|
"type": type_.value if type_ else None,
|
|
218
|
-
"required": param.default == inspect.Parameter.empty,
|
|
219
218
|
"has_default_value": param.default != inspect.Parameter.empty,
|
|
220
219
|
"is_frontend_only": False,
|
|
221
220
|
}
|
vantage6/cli/algostore/attach.py
CHANGED
|
@@ -2,13 +2,38 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from vantage6.common import info
|
|
4
4
|
|
|
5
|
-
from vantage6.cli.common.
|
|
5
|
+
from vantage6.cli.common.attach import attach_logs
|
|
6
|
+
from vantage6.cli.context import InstanceType
|
|
7
|
+
from vantage6.cli.globals import InfraComponentName
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
@click.command()
|
|
9
|
-
|
|
11
|
+
@click.option("-n", "--name", default=None, help="Name of the configuration")
|
|
12
|
+
@click.option("--system", "system_folders", flag_value=True, help="Use system folders")
|
|
13
|
+
@click.option("--user", "system_folders", flag_value=False, help="Use user folders")
|
|
14
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
15
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
16
|
+
@click.option(
|
|
17
|
+
"--sandbox", "is_sandbox", flag_value=True, help="Attach to a sandbox environment"
|
|
18
|
+
)
|
|
19
|
+
def cli_algo_store_attach(
|
|
20
|
+
name: str | None,
|
|
21
|
+
system_folders: bool,
|
|
22
|
+
context: str,
|
|
23
|
+
namespace: str,
|
|
24
|
+
is_sandbox: bool,
|
|
25
|
+
) -> None:
|
|
10
26
|
"""
|
|
11
27
|
Show the store logs in the current console.
|
|
12
28
|
"""
|
|
13
29
|
info("Attaching to store logs...")
|
|
14
|
-
attach_logs(
|
|
30
|
+
attach_logs(
|
|
31
|
+
name,
|
|
32
|
+
instance_type=InstanceType.ALGORITHM_STORE,
|
|
33
|
+
infra_component=InfraComponentName.ALGORITHM_STORE,
|
|
34
|
+
system_folders=system_folders,
|
|
35
|
+
context=context,
|
|
36
|
+
namespace=namespace,
|
|
37
|
+
is_sandbox=is_sandbox,
|
|
38
|
+
additional_labels="component=store-server",
|
|
39
|
+
)
|
vantage6/cli/algostore/list.py
CHANGED
|
@@ -2,7 +2,7 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from vantage6.common.globals import InstanceType
|
|
4
4
|
|
|
5
|
-
from vantage6.cli.common.
|
|
5
|
+
from vantage6.cli.common.list import get_configuration_list
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@click.command()
|
|
@@ -10,4 +10,4 @@ def cli_algo_store_configuration_list() -> None:
|
|
|
10
10
|
"""
|
|
11
11
|
Print the available server configurations.
|
|
12
12
|
"""
|
|
13
|
-
|
|
13
|
+
get_configuration_list(InstanceType.ALGORITHM_STORE)
|
vantage6/cli/algostore/new.py
CHANGED
|
@@ -8,7 +8,7 @@ from vantage6.common.globals import (
|
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
from vantage6.cli.common.new import new
|
|
11
|
-
from vantage6.cli.
|
|
11
|
+
from vantage6.cli.configuration_create import add_common_server_config
|
|
12
12
|
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
13
13
|
|
|
14
14
|
|
|
@@ -43,7 +43,8 @@ def cli_algo_store_new(
|
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
45
|
new(
|
|
46
|
-
|
|
46
|
+
config_producing_func=algo_store_configuration_questionaire,
|
|
47
|
+
config_producing_func_args=(name,),
|
|
47
48
|
name=name,
|
|
48
49
|
system_folders=system_folders,
|
|
49
50
|
namespace=namespace,
|
vantage6/cli/algostore/start.py
CHANGED
|
@@ -6,6 +6,7 @@ from vantage6.common.globals import (
|
|
|
6
6
|
Ports,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
+
from vantage6.cli.common.attach import attach_logs
|
|
9
10
|
from vantage6.cli.common.decorator import click_insert_context
|
|
10
11
|
from vantage6.cli.common.start import (
|
|
11
12
|
helm_install,
|
|
@@ -13,11 +14,11 @@ from vantage6.cli.common.start import (
|
|
|
13
14
|
start_port_forward,
|
|
14
15
|
)
|
|
15
16
|
from vantage6.cli.common.utils import (
|
|
16
|
-
attach_logs,
|
|
17
17
|
create_directory_if_not_exists,
|
|
18
|
+
select_context_and_namespace,
|
|
18
19
|
)
|
|
19
20
|
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
20
|
-
from vantage6.cli.globals import ChartName
|
|
21
|
+
from vantage6.cli.globals import ChartName, InfraComponentName
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
@click.command()
|
|
@@ -30,8 +31,13 @@ from vantage6.cli.globals import ChartName
|
|
|
30
31
|
default=False,
|
|
31
32
|
help="Print server logs to the console after start",
|
|
32
33
|
)
|
|
34
|
+
@click.option("--local-chart-dir", default=None, help="Local chart directory to use")
|
|
35
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
33
36
|
@click_insert_context(
|
|
34
|
-
InstanceType.ALGORITHM_STORE,
|
|
37
|
+
InstanceType.ALGORITHM_STORE,
|
|
38
|
+
include_name=True,
|
|
39
|
+
include_system_folders=True,
|
|
40
|
+
sandbox_param="sandbox",
|
|
35
41
|
)
|
|
36
42
|
def cli_algo_store_start(
|
|
37
43
|
ctx: AlgorithmStoreContext,
|
|
@@ -42,14 +48,18 @@ def cli_algo_store_start(
|
|
|
42
48
|
ip: str,
|
|
43
49
|
port: int,
|
|
44
50
|
attach: bool,
|
|
51
|
+
local_chart_dir: str,
|
|
45
52
|
) -> None:
|
|
46
53
|
"""
|
|
47
54
|
Start the algorithm store.
|
|
48
55
|
"""
|
|
49
56
|
info("Starting algorithm store...")
|
|
50
57
|
|
|
51
|
-
prestart_checks(
|
|
52
|
-
|
|
58
|
+
prestart_checks(ctx, InstanceType.ALGORITHM_STORE, name, system_folders)
|
|
59
|
+
|
|
60
|
+
context, namespace = select_context_and_namespace(
|
|
61
|
+
context=context,
|
|
62
|
+
namespace=namespace,
|
|
53
63
|
)
|
|
54
64
|
|
|
55
65
|
create_directory_if_not_exists(ctx.log_dir)
|
|
@@ -60,6 +70,7 @@ def cli_algo_store_start(
|
|
|
60
70
|
values_file=ctx.config_file,
|
|
61
71
|
context=context,
|
|
62
72
|
namespace=namespace,
|
|
73
|
+
local_chart_dir=local_chart_dir,
|
|
63
74
|
)
|
|
64
75
|
|
|
65
76
|
info("Port forwarding for algorithm store")
|
|
@@ -73,4 +84,12 @@ def cli_algo_store_start(
|
|
|
73
84
|
)
|
|
74
85
|
|
|
75
86
|
if attach:
|
|
76
|
-
attach_logs(
|
|
87
|
+
attach_logs(
|
|
88
|
+
name,
|
|
89
|
+
instance_type=InstanceType.ALGORITHM_STORE,
|
|
90
|
+
infra_component=InfraComponentName.ALGORITHM_STORE,
|
|
91
|
+
system_folders=system_folders,
|
|
92
|
+
context=context,
|
|
93
|
+
namespace=namespace,
|
|
94
|
+
is_sandbox=ctx.is_sandbox,
|
|
95
|
+
)
|
vantage6/cli/algostore/stop.py
CHANGED
|
@@ -25,6 +25,7 @@ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS, InfraComponentNa
|
|
|
25
25
|
flag_value=False,
|
|
26
26
|
help="Search for configuration in the user folders instead of system folders.",
|
|
27
27
|
)
|
|
28
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
28
29
|
@click.option("--all", "all_stores", flag_value=True, help="Stop all algorithm stores")
|
|
29
30
|
def cli_algo_store_stop(
|
|
30
31
|
name: str,
|
|
@@ -32,6 +33,7 @@ def cli_algo_store_stop(
|
|
|
32
33
|
namespace: str,
|
|
33
34
|
system_folders: bool,
|
|
34
35
|
all_stores: bool,
|
|
36
|
+
sandbox: bool,
|
|
35
37
|
):
|
|
36
38
|
"""
|
|
37
39
|
Stop one or all running algorithm store(s).
|
|
@@ -45,6 +47,7 @@ def cli_algo_store_stop(
|
|
|
45
47
|
namespace=namespace,
|
|
46
48
|
context=context,
|
|
47
49
|
system_folders=system_folders,
|
|
50
|
+
is_sandbox=sandbox,
|
|
48
51
|
)
|
|
49
52
|
|
|
50
53
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import requests
|
|
3
|
+
|
|
4
|
+
from vantage6.common import error, info
|
|
5
|
+
from vantage6.common.globals import (
|
|
6
|
+
DEFAULT_API_PATH,
|
|
7
|
+
HTTP_LOCALHOST,
|
|
8
|
+
InstanceType,
|
|
9
|
+
Ports,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from vantage6.cli import __version__
|
|
13
|
+
from vantage6.cli.common.version import get_and_select_ctx
|
|
14
|
+
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@click.command()
|
|
18
|
+
@click.option("-n", "--name", default=None, help="Configuration name")
|
|
19
|
+
@click.option("--system", "system_folders", flag_value=True)
|
|
20
|
+
@click.option(
|
|
21
|
+
"--user", "system_folders", flag_value=False, default=DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
22
|
+
)
|
|
23
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
24
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
25
|
+
@click.option(
|
|
26
|
+
"--sandbox", "is_sandbox", flag_value=True, help="Is this a sandbox environment?"
|
|
27
|
+
)
|
|
28
|
+
def cli_algo_store_version(
|
|
29
|
+
name: str, system_folders: bool, context: str, namespace: str, is_sandbox: bool
|
|
30
|
+
) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Print the version of the vantage6 algorithm store.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
ctx = get_and_select_ctx(
|
|
36
|
+
InstanceType.ALGORITHM_STORE,
|
|
37
|
+
name,
|
|
38
|
+
system_folders,
|
|
39
|
+
context,
|
|
40
|
+
namespace,
|
|
41
|
+
is_sandbox,
|
|
42
|
+
)
|
|
43
|
+
store_config = ctx.config.get("store", {})
|
|
44
|
+
|
|
45
|
+
port = store_config.get("port", Ports.DEV_ALGO_STORE.value)
|
|
46
|
+
api_path = store_config.get("api_path", DEFAULT_API_PATH)
|
|
47
|
+
if not port:
|
|
48
|
+
error("No port found in algorithm store configuration.")
|
|
49
|
+
return
|
|
50
|
+
if not api_path:
|
|
51
|
+
error("No API path found in algorithm store configuration.")
|
|
52
|
+
return
|
|
53
|
+
|
|
54
|
+
response = requests.get(f"{HTTP_LOCALHOST}:{port}{api_path}/version")
|
|
55
|
+
if response.status_code != 200:
|
|
56
|
+
error("Failed to get algorithm store version.")
|
|
57
|
+
return
|
|
58
|
+
algorithm_store_version = response.json().get("version", "")
|
|
59
|
+
|
|
60
|
+
info("")
|
|
61
|
+
info(f"Algorithm store version: {algorithm_store_version}")
|
|
62
|
+
info(f"CLI version: {__version__}")
|
vantage6/cli/auth/attach.py
CHANGED
|
@@ -3,8 +3,8 @@ import click
|
|
|
3
3
|
from vantage6.common import error, info
|
|
4
4
|
from vantage6.common.globals import InstanceType
|
|
5
5
|
|
|
6
|
+
from vantage6.cli.common.attach import attach_logs
|
|
6
7
|
from vantage6.cli.common.utils import (
|
|
7
|
-
attach_logs,
|
|
8
8
|
find_running_service_names,
|
|
9
9
|
select_context_and_namespace,
|
|
10
10
|
select_running_service,
|
vantage6/cli/auth/list.py
CHANGED
|
@@ -2,7 +2,7 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from vantage6.common.globals import InstanceType
|
|
4
4
|
|
|
5
|
-
from vantage6.cli.common.
|
|
5
|
+
from vantage6.cli.common.list import get_configuration_list
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@click.command()
|
|
@@ -10,4 +10,4 @@ def cli_auth_configuration_list() -> None:
|
|
|
10
10
|
"""
|
|
11
11
|
Print the available auth configurations.
|
|
12
12
|
"""
|
|
13
|
-
|
|
13
|
+
get_configuration_list(InstanceType.AUTH)
|
vantage6/cli/auth/new.py
CHANGED
|
@@ -44,7 +44,8 @@ def cli_auth_new(
|
|
|
44
44
|
Create a new server configuration.
|
|
45
45
|
"""
|
|
46
46
|
new(
|
|
47
|
-
|
|
47
|
+
config_producing_func=auth_configuration_questionaire,
|
|
48
|
+
config_producing_func_args=tuple(),
|
|
48
49
|
name=name,
|
|
49
50
|
system_folders=system_folders,
|
|
50
51
|
namespace=namespace,
|
|
@@ -53,7 +54,7 @@ def cli_auth_new(
|
|
|
53
54
|
)
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def auth_configuration_questionaire(
|
|
57
|
+
def auth_configuration_questionaire() -> dict[str, Any]:
|
|
57
58
|
"""
|
|
58
59
|
Kubernetes-specific questionnaire to generate Helm values for the Keycloak helm
|
|
59
60
|
chart.
|
vantage6/cli/auth/remove.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
+
from vantage6.common import info, warning
|
|
3
4
|
from vantage6.common.globals import InstanceType
|
|
4
5
|
|
|
5
6
|
from vantage6.cli.common.decorator import click_insert_context
|
|
6
7
|
from vantage6.cli.common.remove import execute_remove
|
|
7
8
|
from vantage6.cli.context.auth import AuthContext
|
|
8
9
|
from vantage6.cli.globals import InfraComponentName
|
|
10
|
+
from vantage6.cli.utils_kubernetes import get_core_api_with_ssl_handling
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
@click.command()
|
|
@@ -23,9 +25,65 @@ def cli_auth_remove(
|
|
|
23
25
|
----------
|
|
24
26
|
ctx : ServerContext
|
|
25
27
|
Server context object
|
|
28
|
+
name : str
|
|
29
|
+
Name of the auth server
|
|
30
|
+
system_folders : bool
|
|
31
|
+
Whether to use system folders or user folders
|
|
26
32
|
force : bool
|
|
27
33
|
Whether to ask for confirmation before removing or not
|
|
28
34
|
"""
|
|
35
|
+
auth_remove(ctx, name, system_folders, force)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# this new function is just here so that it can be called from the sandbox remove
|
|
39
|
+
# command
|
|
40
|
+
def auth_remove(ctx: AuthContext, name: str, system_folders: bool, force: bool) -> None:
|
|
41
|
+
# Best-effort cleanup of Keycloak PVCs and their bound PVs after uninstall
|
|
42
|
+
try:
|
|
43
|
+
_cleanup_auth_volumes(ctx)
|
|
44
|
+
except Exception as e:
|
|
45
|
+
# Cleanup is best-effort; do not fail the remove command if cleanup fails
|
|
46
|
+
warning(f"Failed to cleanup auth volumes: {e}")
|
|
47
|
+
|
|
29
48
|
execute_remove(
|
|
30
49
|
ctx, InstanceType.AUTH, InfraComponentName.AUTH, name, system_folders, force
|
|
31
50
|
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _cleanup_auth_volumes(ctx: AuthContext) -> None:
|
|
54
|
+
core_api = get_core_api_with_ssl_handling()
|
|
55
|
+
|
|
56
|
+
# Label used by the auth chart to tag its resources
|
|
57
|
+
label_selector = f"app.kubernetes.io/instance={ctx.helm_release_name}"
|
|
58
|
+
|
|
59
|
+
# Collect PVCs across all namespaces that belong to this release
|
|
60
|
+
pvcs = core_api.list_persistent_volume_claim_for_all_namespaces(
|
|
61
|
+
label_selector=label_selector
|
|
62
|
+
).items
|
|
63
|
+
|
|
64
|
+
# Track PV names bound to these PVCs
|
|
65
|
+
pv_names = {
|
|
66
|
+
pvc.spec.volume_name for pvc in pvcs if pvc.spec and pvc.spec.volume_name
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Delete PVCs first (namespaced)
|
|
70
|
+
for pvc in pvcs:
|
|
71
|
+
ns = pvc.metadata.namespace
|
|
72
|
+
name_ = pvc.metadata.name
|
|
73
|
+
try:
|
|
74
|
+
info(f"Deleting persistent volume claim {name_} in namespace {ns}")
|
|
75
|
+
core_api.delete_namespaced_persistent_volume_claim(name=name_, namespace=ns)
|
|
76
|
+
except Exception as e:
|
|
77
|
+
# Ignore failures; continue attempting other deletions
|
|
78
|
+
warning(
|
|
79
|
+
f"Failed to delete persistent volume claim {name_} in namespace {ns}: "
|
|
80
|
+
f"{e}"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Delete PVs that were bound to those PVCs (cluster-scoped)
|
|
84
|
+
for pv_name in pv_names:
|
|
85
|
+
try:
|
|
86
|
+
info(f"Deleting persistent volume: {pv_name}")
|
|
87
|
+
core_api.delete_persistent_volume(name=pv_name)
|
|
88
|
+
except Exception as e:
|
|
89
|
+
warning(f"Failed to delete persistent volume {pv_name}: {e}")
|
vantage6/cli/auth/start.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from vantage6.common import info
|
|
3
|
+
from vantage6.common import info, warning
|
|
4
4
|
from vantage6.common.globals import InstanceType, Ports
|
|
5
5
|
|
|
6
6
|
from vantage6.cli.common.decorator import click_insert_context
|
|
@@ -9,9 +9,7 @@ from vantage6.cli.common.start import (
|
|
|
9
9
|
prestart_checks,
|
|
10
10
|
start_port_forward,
|
|
11
11
|
)
|
|
12
|
-
from vantage6.cli.common.utils import
|
|
13
|
-
attach_logs,
|
|
14
|
-
)
|
|
12
|
+
from vantage6.cli.common.utils import select_context_and_namespace
|
|
15
13
|
from vantage6.cli.context.auth import AuthContext
|
|
16
14
|
from vantage6.cli.globals import ChartName
|
|
17
15
|
|
|
@@ -32,8 +30,13 @@ from vantage6.cli.globals import ChartName
|
|
|
32
30
|
default=False,
|
|
33
31
|
help="Print server logs to the console after start",
|
|
34
32
|
)
|
|
33
|
+
@click.option("--local-chart-dir", default=None, help="Local chart directory to use")
|
|
34
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
35
35
|
@click_insert_context(
|
|
36
|
-
type_=InstanceType.AUTH,
|
|
36
|
+
type_=InstanceType.AUTH,
|
|
37
|
+
include_name=True,
|
|
38
|
+
include_system_folders=True,
|
|
39
|
+
sandbox_param="sandbox",
|
|
37
40
|
)
|
|
38
41
|
def cli_auth_start(
|
|
39
42
|
ctx: AuthContext,
|
|
@@ -44,23 +47,31 @@ def cli_auth_start(
|
|
|
44
47
|
ip: str,
|
|
45
48
|
port: int,
|
|
46
49
|
attach: bool,
|
|
50
|
+
local_chart_dir: str,
|
|
47
51
|
) -> None:
|
|
48
52
|
"""
|
|
49
53
|
Start the auth service.
|
|
50
54
|
"""
|
|
51
55
|
info("Starting authentication service...")
|
|
52
56
|
|
|
53
|
-
prestart_checks(ctx, InstanceType.AUTH, name, system_folders
|
|
57
|
+
prestart_checks(ctx, InstanceType.AUTH, name, system_folders)
|
|
58
|
+
|
|
59
|
+
context, namespace = select_context_and_namespace(
|
|
60
|
+
context=context,
|
|
61
|
+
namespace=namespace,
|
|
62
|
+
)
|
|
54
63
|
|
|
55
64
|
# TODO: re-enable when we save the auth logs
|
|
56
65
|
# create_directory_if_not_exists(ctx.log_dir)
|
|
57
66
|
|
|
67
|
+
info("Starting auth service. This may take a few minutes...")
|
|
58
68
|
helm_install(
|
|
59
69
|
release_name=ctx.helm_release_name,
|
|
60
70
|
chart_name=ChartName.AUTH,
|
|
61
71
|
values_file=ctx.config_file,
|
|
62
72
|
context=context,
|
|
63
73
|
namespace=namespace,
|
|
74
|
+
local_chart_dir=local_chart_dir,
|
|
64
75
|
)
|
|
65
76
|
|
|
66
77
|
# port forward for auth service
|
|
@@ -75,6 +86,13 @@ def cli_auth_start(
|
|
|
75
86
|
)
|
|
76
87
|
|
|
77
88
|
if attach:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
warning("Attaching to auth logs is not supported yet.")
|
|
90
|
+
# attach_logs(
|
|
91
|
+
# name,
|
|
92
|
+
# instance_type=InstanceType.AUTH,
|
|
93
|
+
# infra_component=InfraComponentName.AUTH,
|
|
94
|
+
# system_folders=system_folders,
|
|
95
|
+
# context=context,
|
|
96
|
+
# namespace=namespace,
|
|
97
|
+
# is_sandbox=ctx.is_sandbox,
|
|
98
|
+
# )
|
vantage6/cli/auth/stop.py
CHANGED
|
@@ -25,11 +25,13 @@ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS, InfraComponentNa
|
|
|
25
25
|
flag_value=False,
|
|
26
26
|
help="Search for configuration in the user folders instead of system folders.",
|
|
27
27
|
)
|
|
28
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
28
29
|
def cli_auth_stop(
|
|
29
30
|
name: str,
|
|
30
31
|
context: str,
|
|
31
32
|
namespace: str,
|
|
32
33
|
system_folders: bool,
|
|
34
|
+
sandbox: bool,
|
|
33
35
|
):
|
|
34
36
|
"""
|
|
35
37
|
Stop a running auth service.
|
|
@@ -43,6 +45,7 @@ def cli_auth_stop(
|
|
|
43
45
|
namespace=namespace,
|
|
44
46
|
context=context,
|
|
45
47
|
system_folders=system_folders,
|
|
48
|
+
is_sandbox=sandbox,
|
|
46
49
|
)
|
|
47
50
|
|
|
48
51
|
|
vantage6/cli/cli.py
CHANGED
|
@@ -12,6 +12,7 @@ from vantage6.cli.algostore.new import cli_algo_store_new
|
|
|
12
12
|
from vantage6.cli.algostore.remove import cli_algo_store_remove
|
|
13
13
|
from vantage6.cli.algostore.start import cli_algo_store_start
|
|
14
14
|
from vantage6.cli.algostore.stop import cli_algo_store_stop
|
|
15
|
+
from vantage6.cli.algostore.version import cli_algo_store_version
|
|
15
16
|
from vantage6.cli.auth.attach import cli_auth_attach
|
|
16
17
|
from vantage6.cli.auth.files import cli_auth_files
|
|
17
18
|
from vantage6.cli.auth.list import cli_auth_configuration_list
|
|
@@ -35,6 +36,10 @@ from vantage6.cli.node.set_api_key import cli_node_set_api_key
|
|
|
35
36
|
from vantage6.cli.node.start import cli_node_start
|
|
36
37
|
from vantage6.cli.node.stop import cli_node_stop
|
|
37
38
|
from vantage6.cli.node.version import cli_node_version
|
|
39
|
+
from vantage6.cli.sandbox.new import cli_new_sandbox
|
|
40
|
+
from vantage6.cli.sandbox.remove import cli_sandbox_remove
|
|
41
|
+
from vantage6.cli.sandbox.start import cli_sandbox_start
|
|
42
|
+
from vantage6.cli.sandbox.stop import cli_sandbox_stop
|
|
38
43
|
from vantage6.cli.server.attach import cli_server_attach
|
|
39
44
|
from vantage6.cli.server.files import cli_server_files
|
|
40
45
|
from vantage6.cli.server.import_ import cli_server_import
|
|
@@ -94,6 +99,20 @@ cli_node.add_command(cli_node_stop, name="stop")
|
|
|
94
99
|
cli_node.add_command(cli_node_version, name="version")
|
|
95
100
|
|
|
96
101
|
|
|
102
|
+
# Define the sandbox group
|
|
103
|
+
@click.group(name=CLICommandName.SANDBOX.value)
|
|
104
|
+
def cli_sandbox() -> None:
|
|
105
|
+
"""
|
|
106
|
+
Setup and manage a sandbox environment.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
cli_sandbox.add_command(cli_new_sandbox, name="new")
|
|
111
|
+
cli_sandbox.add_command(cli_sandbox_start, name="start")
|
|
112
|
+
cli_sandbox.add_command(cli_sandbox_stop, name="stop")
|
|
113
|
+
cli_sandbox.add_command(cli_sandbox_remove, name="remove")
|
|
114
|
+
|
|
115
|
+
|
|
97
116
|
# Define the dev group
|
|
98
117
|
@click.group(name=CLICommandName.DEV.value)
|
|
99
118
|
def cli_dev() -> None:
|
|
@@ -157,6 +176,7 @@ cli_algo_store.add_command(cli_algo_store_stop, name="stop")
|
|
|
157
176
|
cli_algo_store.add_command(cli_algo_store_files, name="files")
|
|
158
177
|
cli_algo_store.add_command(cli_algo_store_configuration_list, name="list")
|
|
159
178
|
cli_algo_store.add_command(cli_algo_store_remove, name="remove")
|
|
179
|
+
cli_algo_store.add_command(cli_algo_store_version, name="version")
|
|
160
180
|
|
|
161
181
|
|
|
162
182
|
# Define the auth group
|
|
@@ -204,6 +224,7 @@ def cli_complete() -> None:
|
|
|
204
224
|
# Add the subcommands to the overall group
|
|
205
225
|
cli_complete.add_command(cli_node)
|
|
206
226
|
cli_complete.add_command(cli_server)
|
|
227
|
+
cli_complete.add_command(cli_sandbox)
|
|
207
228
|
cli_complete.add_command(cli_dev)
|
|
208
229
|
cli_complete.add_command(cli_algorithm)
|
|
209
230
|
cli_complete.add_command(cli_test)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from subprocess import Popen
|
|
2
|
+
|
|
3
|
+
from vantage6.common import Fore, Style, error
|
|
4
|
+
from vantage6.common.globals import InstanceType
|
|
5
|
+
|
|
6
|
+
from vantage6.cli.common.utils import (
|
|
7
|
+
extract_name_and_is_sandbox,
|
|
8
|
+
find_running_service_names,
|
|
9
|
+
select_context_and_namespace,
|
|
10
|
+
select_running_service,
|
|
11
|
+
)
|
|
12
|
+
from vantage6.cli.context import get_context
|
|
13
|
+
from vantage6.cli.globals import InfraComponentName
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def attach_logs(
|
|
17
|
+
name: str | None,
|
|
18
|
+
instance_type: InstanceType,
|
|
19
|
+
infra_component: InfraComponentName,
|
|
20
|
+
context: str,
|
|
21
|
+
namespace: str,
|
|
22
|
+
system_folders: bool,
|
|
23
|
+
is_sandbox: bool = False,
|
|
24
|
+
additional_labels: str | None = None,
|
|
25
|
+
) -> None:
|
|
26
|
+
"""
|
|
27
|
+
Attach to the logs of the given labels.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
name : str | None
|
|
32
|
+
The name of the service to attach to. If None, the user will be asked to
|
|
33
|
+
select a service.
|
|
34
|
+
instance_type : InstanceType
|
|
35
|
+
The instance type of the service.
|
|
36
|
+
infra_component : InfraComponentName
|
|
37
|
+
The infra component of the service.
|
|
38
|
+
system_folders : bool
|
|
39
|
+
Whether to use system folders.
|
|
40
|
+
context : str
|
|
41
|
+
The context of the service.
|
|
42
|
+
namespace : str
|
|
43
|
+
The namespace of the service.
|
|
44
|
+
is_sandbox : bool
|
|
45
|
+
Whether the configuration is a sandbox configuration, by default False
|
|
46
|
+
additional_labels : str | None
|
|
47
|
+
Additional labels to filter the logs by.
|
|
48
|
+
"""
|
|
49
|
+
context, namespace = select_context_and_namespace(
|
|
50
|
+
context=context,
|
|
51
|
+
namespace=namespace,
|
|
52
|
+
)
|
|
53
|
+
running_services = find_running_service_names(
|
|
54
|
+
instance_type=instance_type,
|
|
55
|
+
only_system_folders=system_folders,
|
|
56
|
+
only_user_folders=not system_folders,
|
|
57
|
+
context=context,
|
|
58
|
+
namespace=namespace,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if not running_services:
|
|
62
|
+
error(f"No running {infra_component.value}s found.")
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
if not name:
|
|
66
|
+
helm_name = select_running_service(running_services, instance_type)
|
|
67
|
+
else:
|
|
68
|
+
name, is_sandbox = extract_name_and_is_sandbox(name, is_sandbox)
|
|
69
|
+
ctx = get_context(instance_type, name, system_folders, is_sandbox=is_sandbox)
|
|
70
|
+
helm_name = ctx.helm_release_name
|
|
71
|
+
|
|
72
|
+
if helm_name in running_services:
|
|
73
|
+
_attach_logs(helm_name, namespace, context, additional_labels)
|
|
74
|
+
else:
|
|
75
|
+
error(f"{Fore.RED}{helm_name}{Style.RESET_ALL} is not running?!")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _attach_logs(
|
|
79
|
+
service: str, namespace: str, context: str, additional_labels: str | None = None
|
|
80
|
+
) -> None:
|
|
81
|
+
"""
|
|
82
|
+
Attach to the logs of the given service.
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
service : str
|
|
87
|
+
The name of the service to attach to.
|
|
88
|
+
namespace : str
|
|
89
|
+
The namespace of the service.
|
|
90
|
+
context : str
|
|
91
|
+
The context of the service.
|
|
92
|
+
additional_labels : str | None
|
|
93
|
+
Additional labels to filter the logs by.
|
|
94
|
+
"""
|
|
95
|
+
labels = f"release={service}"
|
|
96
|
+
if additional_labels:
|
|
97
|
+
labels += f",{additional_labels}"
|
|
98
|
+
# Stream logs from all pods that belong to this Helm release, within the
|
|
99
|
+
# provided namespace and context. Using label selection ensures we attach
|
|
100
|
+
# to pods rather than higher-level resources.
|
|
101
|
+
command = [
|
|
102
|
+
"kubectl",
|
|
103
|
+
"--context",
|
|
104
|
+
context,
|
|
105
|
+
"-n",
|
|
106
|
+
namespace,
|
|
107
|
+
"logs",
|
|
108
|
+
"--follow",
|
|
109
|
+
"--selector",
|
|
110
|
+
labels,
|
|
111
|
+
"--all-containers=true",
|
|
112
|
+
]
|
|
113
|
+
process = Popen(command, stdout=None, stderr=None)
|
|
114
|
+
process.wait()
|