vantage6 5.0.0a35__py3-none-any.whl → 5.0.0a37__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 +9 -10
- vantage6/cli/algorithm/update.py +1 -1
- vantage6/cli/algostore/attach.py +1 -0
- vantage6/cli/algostore/files.py +3 -2
- vantage6/cli/algostore/list.py +0 -3
- vantage6/cli/algostore/new.py +3 -2
- vantage6/cli/algostore/start.py +14 -3
- vantage6/cli/algostore/stop.py +3 -0
- vantage6/cli/auth/attach.py +60 -0
- vantage6/cli/auth/files.py +16 -0
- vantage6/cli/auth/list.py +13 -0
- vantage6/cli/auth/new.py +81 -0
- vantage6/cli/auth/remove.py +31 -0
- vantage6/cli/auth/start.py +94 -0
- vantage6/cli/auth/stop.py +67 -0
- vantage6/cli/cli.py +56 -5
- vantage6/cli/common/decorator.py +24 -5
- vantage6/cli/common/new.py +27 -7
- vantage6/cli/common/start.py +49 -41
- vantage6/cli/common/stop.py +23 -5
- vantage6/cli/common/utils.py +25 -0
- vantage6/cli/config.py +10 -2
- vantage6/cli/{configuration_wizard.py → configuration_create.py} +28 -15
- vantage6/cli/configuration_manager.py +97 -17
- vantage6/cli/context/__init__.py +10 -5
- vantage6/cli/context/algorithm_store.py +11 -5
- vantage6/cli/context/auth.py +125 -0
- vantage6/cli/context/base_server.py +0 -4
- vantage6/cli/context/node.py +25 -8
- vantage6/cli/context/server.py +18 -6
- vantage6/cli/dev/clean.py +28 -0
- vantage6/cli/dev/common.py +34 -0
- vantage6/cli/dev/rebuild.py +39 -0
- vantage6/cli/dev/start.py +36 -0
- vantage6/cli/dev/stop.py +23 -0
- vantage6/cli/globals.py +5 -1
- vantage6/cli/node/common/__init__.py +26 -10
- vantage6/cli/node/list.py +5 -4
- vantage6/cli/node/new.py +13 -6
- vantage6/cli/node/set_api_key.py +1 -1
- vantage6/cli/node/start.py +19 -4
- vantage6/cli/node/stop.py +153 -7
- vantage6/cli/node/task_cleanup/__init__.py +153 -0
- vantage6/cli/node/version.py +5 -4
- vantage6/cli/prometheus/monitoring_manager.py +5 -3
- vantage6/cli/sandbox/config/base.py +101 -0
- vantage6/cli/sandbox/config/core.py +300 -0
- vantage6/cli/sandbox/config/node.py +314 -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 +173 -0
- vantage6/cli/sandbox/start.py +341 -0
- vantage6/cli/sandbox/stop.py +106 -0
- vantage6/cli/server/attach.py +1 -0
- vantage6/cli/server/common/__init__.py +6 -33
- vantage6/cli/server/import_.py +137 -119
- vantage6/cli/server/new.py +22 -7
- vantage6/cli/server/start.py +10 -1
- vantage6/cli/server/stop.py +2 -0
- vantage6/cli/template/auth_config.j2 +253 -0
- vantage6/cli/template/node_config.j2 +8 -8
- vantage6/cli/template/node_config_nonk8s.j2 +33 -0
- vantage6/cli/template/server_config.j2 +10 -7
- vantage6/cli/test/common/diagnostic_runner.py +5 -3
- vantage6/cli/use/namespace.py +2 -1
- vantage6/cli/utils.py +33 -1
- {vantage6-5.0.0a35.dist-info → vantage6-5.0.0a37.dist-info}/METADATA +4 -4
- vantage6-5.0.0a37.dist-info/RECORD +97 -0
- vantage6/cli/dev/create.py +0 -693
- vantage6/cli/dev/remove.py +0 -112
- vantage6/cli/rabbitmq/__init__.py +0 -0
- vantage6/cli/rabbitmq/definitions.py +0 -26
- vantage6/cli/rabbitmq/queue_manager.py +0 -218
- vantage6/cli/rabbitmq/rabbitmq.config +0 -8
- vantage6/cli/server/shell.py +0 -54
- vantage6-5.0.0a35.dist-info/RECORD +0 -75
- /vantage6/cli/{dev → sandbox}/data/km_dataset.csv +0 -0
- {vantage6-5.0.0a35.dist-info → vantage6-5.0.0a37.dist-info}/WHEEL +0 -0
- {vantage6-5.0.0a35.dist-info → vantage6-5.0.0a37.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
|
}
|
|
@@ -276,23 +275,23 @@ class Function:
|
|
|
276
275
|
else:
|
|
277
276
|
type_ = param.annotation
|
|
278
277
|
|
|
279
|
-
if type_
|
|
278
|
+
if type_ is str:
|
|
280
279
|
return AlgorithmArgumentType.STRING
|
|
281
|
-
elif type_
|
|
280
|
+
elif type_ is dict:
|
|
282
281
|
return AlgorithmArgumentType.JSON
|
|
283
|
-
elif type_
|
|
282
|
+
elif type_ is int:
|
|
284
283
|
return AlgorithmArgumentType.INTEGER
|
|
285
|
-
elif type_
|
|
284
|
+
elif type_ is float:
|
|
286
285
|
return AlgorithmArgumentType.FLOAT
|
|
287
|
-
elif type_
|
|
286
|
+
elif type_ is bool:
|
|
288
287
|
return AlgorithmArgumentType.BOOLEAN
|
|
289
|
-
elif type_
|
|
288
|
+
elif type_ is list:
|
|
290
289
|
return AlgorithmArgumentType.STRINGS
|
|
291
|
-
elif type_
|
|
290
|
+
elif type_ is list[str]:
|
|
292
291
|
return AlgorithmArgumentType.STRINGS
|
|
293
|
-
elif type_
|
|
292
|
+
elif type_ is list[int]:
|
|
294
293
|
return AlgorithmArgumentType.INTEGERS
|
|
295
|
-
elif type_
|
|
294
|
+
elif type_ is list[float]:
|
|
296
295
|
return AlgorithmArgumentType.FLOATS
|
|
297
296
|
else:
|
|
298
297
|
warning(
|
vantage6/cli/algorithm/update.py
CHANGED
vantage6/cli/algostore/attach.py
CHANGED
vantage6/cli/algostore/files.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
3
|
from vantage6.common import info
|
|
4
|
-
from vantage6.cli.context.server import ServerContext
|
|
5
|
-
from vantage6.cli.common.decorator import click_insert_context
|
|
6
4
|
from vantage6.common.globals import InstanceType
|
|
7
5
|
|
|
6
|
+
from vantage6.cli.common.decorator import click_insert_context
|
|
7
|
+
from vantage6.cli.context.server import ServerContext
|
|
8
|
+
|
|
8
9
|
|
|
9
10
|
@click.command()
|
|
10
11
|
@click_insert_context(type_=InstanceType.ALGORITHM_STORE)
|
vantage6/cli/algostore/list.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from vantage6.common.docker.addons import check_docker_running
|
|
4
3
|
from vantage6.common.globals import InstanceType
|
|
5
4
|
|
|
6
5
|
from vantage6.cli.common.utils import get_server_configuration_list
|
|
@@ -11,6 +10,4 @@ def cli_algo_store_configuration_list() -> None:
|
|
|
11
10
|
"""
|
|
12
11
|
Print the available server configurations.
|
|
13
12
|
"""
|
|
14
|
-
check_docker_running()
|
|
15
|
-
|
|
16
13
|
get_server_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
|
@@ -15,6 +15,7 @@ from vantage6.cli.common.start import (
|
|
|
15
15
|
from vantage6.cli.common.utils import (
|
|
16
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
21
|
from vantage6.cli.globals import ChartName
|
|
@@ -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")
|
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,60 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import error, info
|
|
4
|
+
from vantage6.common.globals import InstanceType
|
|
5
|
+
|
|
6
|
+
from vantage6.cli.common.utils import (
|
|
7
|
+
attach_logs,
|
|
8
|
+
find_running_service_names,
|
|
9
|
+
select_context_and_namespace,
|
|
10
|
+
select_running_service,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command()
|
|
15
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
16
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
17
|
+
@click.option(
|
|
18
|
+
"-n", "--name", default=None, help="Name of the auth service to attach to"
|
|
19
|
+
)
|
|
20
|
+
def cli_auth_attach(context: str, namespace: str, name: str) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Show the server logs in the current console.
|
|
23
|
+
"""
|
|
24
|
+
info("Attaching to auth logs...")
|
|
25
|
+
|
|
26
|
+
context, namespace = select_context_and_namespace(
|
|
27
|
+
context=context,
|
|
28
|
+
namespace=namespace,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
running_services = find_running_service_names(
|
|
32
|
+
instance_type=InstanceType.AUTH,
|
|
33
|
+
only_system_folders=False,
|
|
34
|
+
only_user_folders=False,
|
|
35
|
+
context=context,
|
|
36
|
+
namespace=namespace,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
if not running_services:
|
|
40
|
+
error("No running auth services found.")
|
|
41
|
+
return
|
|
42
|
+
|
|
43
|
+
if name:
|
|
44
|
+
# search for a running auth service started up either in user or system folders
|
|
45
|
+
svc_name_options = [
|
|
46
|
+
f"vantage6-{name}-user-auth",
|
|
47
|
+
f"vantage6-{name}-system-auth",
|
|
48
|
+
]
|
|
49
|
+
helm_name = next(
|
|
50
|
+
(svc for svc in svc_name_options if svc in running_services), None
|
|
51
|
+
)
|
|
52
|
+
if not helm_name:
|
|
53
|
+
error(f"No running auth service found for {name}.")
|
|
54
|
+
return
|
|
55
|
+
else:
|
|
56
|
+
helm_name = select_running_service(running_services, InstanceType.AUTH)
|
|
57
|
+
|
|
58
|
+
attach_logs(
|
|
59
|
+
f"app.kubernetes.io/instance={helm_name}",
|
|
60
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.common.globals import InstanceType
|
|
5
|
+
|
|
6
|
+
from vantage6.cli.common.decorator import click_insert_context
|
|
7
|
+
from vantage6.cli.context.auth import AuthContext
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.command()
|
|
11
|
+
@click_insert_context(type_=InstanceType.AUTH)
|
|
12
|
+
def cli_auth_files(ctx: AuthContext) -> None:
|
|
13
|
+
"""
|
|
14
|
+
List files that belong to a particular auth instance.
|
|
15
|
+
"""
|
|
16
|
+
info(f"Configuration file = {ctx.config_file}")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common.globals import InstanceType
|
|
4
|
+
|
|
5
|
+
from vantage6.cli.common.utils import get_server_configuration_list
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command()
|
|
9
|
+
def cli_auth_configuration_list() -> None:
|
|
10
|
+
"""
|
|
11
|
+
Print the available auth configurations.
|
|
12
|
+
"""
|
|
13
|
+
get_server_configuration_list(InstanceType.AUTH)
|
vantage6/cli/auth/new.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
import questionary as q
|
|
5
|
+
|
|
6
|
+
from vantage6.common.globals import (
|
|
7
|
+
InstanceType,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from vantage6.cli.common.new import new
|
|
11
|
+
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command()
|
|
15
|
+
@click.option(
|
|
16
|
+
"-n", "--name", default=None, help="name of the configuration you want to use."
|
|
17
|
+
)
|
|
18
|
+
@click.option(
|
|
19
|
+
"--system",
|
|
20
|
+
"system_folders",
|
|
21
|
+
flag_value=True,
|
|
22
|
+
help="Use system folders instead of user folders. This is the default",
|
|
23
|
+
)
|
|
24
|
+
@click.option(
|
|
25
|
+
"--user",
|
|
26
|
+
"system_folders",
|
|
27
|
+
flag_value=False,
|
|
28
|
+
default=DEFAULT_SERVER_SYSTEM_FOLDERS,
|
|
29
|
+
help="Use user folders instead of system folders",
|
|
30
|
+
)
|
|
31
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
32
|
+
@click.option(
|
|
33
|
+
"--namespace",
|
|
34
|
+
default=None,
|
|
35
|
+
help="Kubernetes namespace to use",
|
|
36
|
+
)
|
|
37
|
+
def cli_auth_new(
|
|
38
|
+
name: str,
|
|
39
|
+
system_folders: bool,
|
|
40
|
+
namespace: str,
|
|
41
|
+
context: str,
|
|
42
|
+
) -> None:
|
|
43
|
+
"""
|
|
44
|
+
Create a new server configuration.
|
|
45
|
+
"""
|
|
46
|
+
new(
|
|
47
|
+
config_producing_func=auth_configuration_questionaire,
|
|
48
|
+
config_producing_func_args=tuple(),
|
|
49
|
+
name=name,
|
|
50
|
+
system_folders=system_folders,
|
|
51
|
+
namespace=namespace,
|
|
52
|
+
context=context,
|
|
53
|
+
type_=InstanceType.AUTH,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def auth_configuration_questionaire() -> dict[str, Any]:
|
|
58
|
+
"""
|
|
59
|
+
Kubernetes-specific questionnaire to generate Helm values for the Keycloak helm
|
|
60
|
+
chart.
|
|
61
|
+
"""
|
|
62
|
+
config = {"keycloak": {}}
|
|
63
|
+
|
|
64
|
+
is_production = q.confirm(
|
|
65
|
+
"Do you want to use production settings? If not, the service will be configured"
|
|
66
|
+
" to be more suitable for development or testing purposes.",
|
|
67
|
+
default=True,
|
|
68
|
+
).unsafe_ask()
|
|
69
|
+
|
|
70
|
+
config["keycloak"]["production"] = is_production
|
|
71
|
+
|
|
72
|
+
if is_production:
|
|
73
|
+
ui_url = q.text(
|
|
74
|
+
"Please provide the URL of the UI. This is the URL that users will use to "
|
|
75
|
+
"log in to the service.",
|
|
76
|
+
default="https://ui.vantage6.ai",
|
|
77
|
+
).unsafe_ask()
|
|
78
|
+
# add http://localhost:7681 as that is used by the Python client
|
|
79
|
+
config["keycloak"]["redirectUris"] = [ui_url, "http://localhost:7681"]
|
|
80
|
+
|
|
81
|
+
return config
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common.globals import InstanceType
|
|
4
|
+
|
|
5
|
+
from vantage6.cli.common.decorator import click_insert_context
|
|
6
|
+
from vantage6.cli.common.remove import execute_remove
|
|
7
|
+
from vantage6.cli.context.auth import AuthContext
|
|
8
|
+
from vantage6.cli.globals import InfraComponentName
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click_insert_context(
|
|
13
|
+
type_=InstanceType.AUTH, include_name=True, include_system_folders=True
|
|
14
|
+
)
|
|
15
|
+
@click.option("-f", "--force", "force", flag_value=True)
|
|
16
|
+
def cli_auth_remove(
|
|
17
|
+
ctx: AuthContext, name: str, system_folders: bool, force: bool
|
|
18
|
+
) -> None:
|
|
19
|
+
"""
|
|
20
|
+
Function to remove a server.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
ctx : ServerContext
|
|
25
|
+
Server context object
|
|
26
|
+
force : bool
|
|
27
|
+
Whether to ask for confirmation before removing or not
|
|
28
|
+
"""
|
|
29
|
+
execute_remove(
|
|
30
|
+
ctx, InstanceType.AUTH, InfraComponentName.AUTH, name, system_folders, force
|
|
31
|
+
)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.common.globals import InstanceType, Ports
|
|
5
|
+
|
|
6
|
+
from vantage6.cli.common.decorator import click_insert_context
|
|
7
|
+
from vantage6.cli.common.start import (
|
|
8
|
+
helm_install,
|
|
9
|
+
prestart_checks,
|
|
10
|
+
start_port_forward,
|
|
11
|
+
)
|
|
12
|
+
from vantage6.cli.common.utils import (
|
|
13
|
+
attach_logs,
|
|
14
|
+
select_context_and_namespace,
|
|
15
|
+
)
|
|
16
|
+
from vantage6.cli.context.auth import AuthContext
|
|
17
|
+
from vantage6.cli.globals import ChartName
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@click.command()
|
|
21
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
22
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
23
|
+
@click.option("--ip", default=None, help="IP address to listen on")
|
|
24
|
+
@click.option(
|
|
25
|
+
"-p",
|
|
26
|
+
"--port",
|
|
27
|
+
default=None,
|
|
28
|
+
type=int,
|
|
29
|
+
help="Port to listen on for the auth service",
|
|
30
|
+
)
|
|
31
|
+
@click.option(
|
|
32
|
+
"--attach/--detach",
|
|
33
|
+
default=False,
|
|
34
|
+
help="Print server logs to the console after start",
|
|
35
|
+
)
|
|
36
|
+
@click.option("--local-chart-dir", default=None, help="Local chart directory to use")
|
|
37
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
38
|
+
@click_insert_context(
|
|
39
|
+
type_=InstanceType.AUTH,
|
|
40
|
+
include_name=True,
|
|
41
|
+
include_system_folders=True,
|
|
42
|
+
sandbox_param="sandbox",
|
|
43
|
+
)
|
|
44
|
+
def cli_auth_start(
|
|
45
|
+
ctx: AuthContext,
|
|
46
|
+
name: str,
|
|
47
|
+
system_folders: bool,
|
|
48
|
+
context: str,
|
|
49
|
+
namespace: str,
|
|
50
|
+
ip: str,
|
|
51
|
+
port: int,
|
|
52
|
+
attach: bool,
|
|
53
|
+
local_chart_dir: str,
|
|
54
|
+
) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Start the auth service.
|
|
57
|
+
"""
|
|
58
|
+
info("Starting authentication service...")
|
|
59
|
+
|
|
60
|
+
prestart_checks(ctx, InstanceType.AUTH, name, system_folders)
|
|
61
|
+
|
|
62
|
+
context, namespace = select_context_and_namespace(
|
|
63
|
+
context=context,
|
|
64
|
+
namespace=namespace,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# TODO: re-enable when we save the auth logs
|
|
68
|
+
# create_directory_if_not_exists(ctx.log_dir)
|
|
69
|
+
|
|
70
|
+
info("Starting auth service. This may take a few minutes...")
|
|
71
|
+
helm_install(
|
|
72
|
+
release_name=ctx.helm_release_name,
|
|
73
|
+
chart_name=ChartName.AUTH,
|
|
74
|
+
values_file=ctx.config_file,
|
|
75
|
+
context=context,
|
|
76
|
+
namespace=namespace,
|
|
77
|
+
local_chart_dir=local_chart_dir,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# port forward for auth service
|
|
81
|
+
info("Port forwarding for auth service")
|
|
82
|
+
start_port_forward(
|
|
83
|
+
service_name=f"{ctx.helm_release_name}-keycloak",
|
|
84
|
+
service_port=Ports.HTTP.value,
|
|
85
|
+
port=port or Ports.DEV_AUTH.value,
|
|
86
|
+
ip=ip,
|
|
87
|
+
context=context,
|
|
88
|
+
namespace=namespace,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
if attach:
|
|
92
|
+
attach_logs(
|
|
93
|
+
[f"app.kubernetes.io/instance={ctx.helm_release_name}"],
|
|
94
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.common.globals import InstanceType
|
|
5
|
+
|
|
6
|
+
from vantage6.cli.common.stop import execute_stop, helm_uninstall, stop_port_forward
|
|
7
|
+
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS, InfraComponentName
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.command()
|
|
11
|
+
@click.option("-n", "--name", default=None, help="Configuration name")
|
|
12
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
13
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
14
|
+
@click.option(
|
|
15
|
+
"--system",
|
|
16
|
+
"system_folders",
|
|
17
|
+
flag_value=True,
|
|
18
|
+
default=DEFAULT_SERVER_SYSTEM_FOLDERS,
|
|
19
|
+
help="Search for configuration in system folders instead of user folders. "
|
|
20
|
+
"This is the default.",
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"--user",
|
|
24
|
+
"system_folders",
|
|
25
|
+
flag_value=False,
|
|
26
|
+
help="Search for configuration in the user folders instead of system folders.",
|
|
27
|
+
)
|
|
28
|
+
@click.option("--sandbox/--no-sandbox", "sandbox", default=False)
|
|
29
|
+
def cli_auth_stop(
|
|
30
|
+
name: str,
|
|
31
|
+
context: str,
|
|
32
|
+
namespace: str,
|
|
33
|
+
system_folders: bool,
|
|
34
|
+
sandbox: bool,
|
|
35
|
+
):
|
|
36
|
+
"""
|
|
37
|
+
Stop a running auth service.
|
|
38
|
+
"""
|
|
39
|
+
execute_stop(
|
|
40
|
+
stop_function=_stop_auth,
|
|
41
|
+
instance_type=InstanceType.AUTH,
|
|
42
|
+
infra_component=InfraComponentName.AUTH,
|
|
43
|
+
stop_all=False,
|
|
44
|
+
to_stop=name,
|
|
45
|
+
namespace=namespace,
|
|
46
|
+
context=context,
|
|
47
|
+
system_folders=system_folders,
|
|
48
|
+
is_sandbox=sandbox,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _stop_auth(auth_name: str, namespace: str, context: str) -> None:
|
|
53
|
+
info(f"Stopping auth {auth_name}...")
|
|
54
|
+
|
|
55
|
+
# uninstall the helm release
|
|
56
|
+
helm_uninstall(
|
|
57
|
+
release_name=auth_name,
|
|
58
|
+
context=context,
|
|
59
|
+
namespace=namespace,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# stop the port forwarding for auth service
|
|
63
|
+
stop_port_forward(
|
|
64
|
+
service_name=f"{auth_name}-keycloak",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
info(f"Auth {auth_name} stopped successfully.")
|
vantage6/cli/cli.py
CHANGED
|
@@ -12,6 +12,17 @@ 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.auth.attach import cli_auth_attach
|
|
16
|
+
from vantage6.cli.auth.files import cli_auth_files
|
|
17
|
+
from vantage6.cli.auth.list import cli_auth_configuration_list
|
|
18
|
+
from vantage6.cli.auth.new import cli_auth_new
|
|
19
|
+
from vantage6.cli.auth.remove import cli_auth_remove
|
|
20
|
+
from vantage6.cli.auth.start import cli_auth_start
|
|
21
|
+
from vantage6.cli.auth.stop import cli_auth_stop
|
|
22
|
+
from vantage6.cli.dev.clean import cli_clean_dev_env
|
|
23
|
+
from vantage6.cli.dev.rebuild import cli_rebuild_dev_env
|
|
24
|
+
from vantage6.cli.dev.start import cli_start_dev_env
|
|
25
|
+
from vantage6.cli.dev.stop import cli_stop_dev_env
|
|
15
26
|
from vantage6.cli.globals import CLICommandName
|
|
16
27
|
from vantage6.cli.node.attach import cli_node_attach
|
|
17
28
|
from vantage6.cli.node.create_private_key import cli_node_create_private_key
|
|
@@ -24,13 +35,16 @@ from vantage6.cli.node.set_api_key import cli_node_set_api_key
|
|
|
24
35
|
from vantage6.cli.node.start import cli_node_start
|
|
25
36
|
from vantage6.cli.node.stop import cli_node_stop
|
|
26
37
|
from vantage6.cli.node.version import cli_node_version
|
|
38
|
+
from vantage6.cli.sandbox.new import cli_new_sandbox
|
|
39
|
+
from vantage6.cli.sandbox.remove import cli_sandbox_remove
|
|
40
|
+
from vantage6.cli.sandbox.start import cli_sandbox_start
|
|
41
|
+
from vantage6.cli.sandbox.stop import cli_sandbox_stop
|
|
27
42
|
from vantage6.cli.server.attach import cli_server_attach
|
|
28
43
|
from vantage6.cli.server.files import cli_server_files
|
|
29
44
|
from vantage6.cli.server.import_ import cli_server_import
|
|
30
45
|
from vantage6.cli.server.list import cli_server_configuration_list
|
|
31
46
|
from vantage6.cli.server.new import cli_server_new
|
|
32
47
|
from vantage6.cli.server.remove import cli_server_remove
|
|
33
|
-
from vantage6.cli.server.shell import cli_server_shell
|
|
34
48
|
from vantage6.cli.server.start import cli_server_start
|
|
35
49
|
from vantage6.cli.server.stop import cli_server_stop
|
|
36
50
|
from vantage6.cli.server.version import cli_server_version
|
|
@@ -57,7 +71,6 @@ cli_server.add_command(cli_server_import, name="import")
|
|
|
57
71
|
cli_server.add_command(cli_server_configuration_list, name="list")
|
|
58
72
|
cli_server.add_command(cli_server_new, name="new")
|
|
59
73
|
cli_server.add_command(cli_server_remove, name="remove")
|
|
60
|
-
cli_server.add_command(cli_server_shell, name="shell")
|
|
61
74
|
cli_server.add_command(cli_server_start, name="start")
|
|
62
75
|
cli_server.add_command(cli_server_stop, name="stop")
|
|
63
76
|
cli_server.add_command(cli_server_version, name="version")
|
|
@@ -85,17 +98,35 @@ cli_node.add_command(cli_node_stop, name="stop")
|
|
|
85
98
|
cli_node.add_command(cli_node_version, name="version")
|
|
86
99
|
|
|
87
100
|
|
|
101
|
+
# Define the sandbox group
|
|
102
|
+
@click.group(name=CLICommandName.SANDBOX.value)
|
|
103
|
+
def cli_sandbox() -> None:
|
|
104
|
+
"""
|
|
105
|
+
Setup and manage a sandbox environment.
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
cli_sandbox.add_command(cli_new_sandbox, name="new")
|
|
110
|
+
cli_sandbox.add_command(cli_sandbox_start, name="start")
|
|
111
|
+
cli_sandbox.add_command(cli_sandbox_stop, name="stop")
|
|
112
|
+
cli_sandbox.add_command(cli_sandbox_remove, name="remove")
|
|
113
|
+
|
|
114
|
+
|
|
88
115
|
# Define the dev group
|
|
89
116
|
@click.group(name=CLICommandName.DEV.value)
|
|
90
117
|
def cli_dev() -> None:
|
|
91
118
|
"""
|
|
92
|
-
|
|
119
|
+
Spin up a local development network.
|
|
93
120
|
|
|
94
|
-
|
|
121
|
+
In this environment, any code changes you make will be reflected in the running
|
|
122
|
+
services.
|
|
95
123
|
"""
|
|
96
124
|
|
|
97
125
|
|
|
98
|
-
|
|
126
|
+
cli_dev.add_command(cli_start_dev_env, name="start")
|
|
127
|
+
cli_dev.add_command(cli_stop_dev_env, name="stop")
|
|
128
|
+
cli_dev.add_command(cli_rebuild_dev_env, name="rebuild")
|
|
129
|
+
cli_dev.add_command(cli_clean_dev_env, name="clean")
|
|
99
130
|
|
|
100
131
|
|
|
101
132
|
# Define the algorithm group
|
|
@@ -146,6 +177,24 @@ cli_algo_store.add_command(cli_algo_store_configuration_list, name="list")
|
|
|
146
177
|
cli_algo_store.add_command(cli_algo_store_remove, name="remove")
|
|
147
178
|
|
|
148
179
|
|
|
180
|
+
# Define the auth group
|
|
181
|
+
@click.group(name=CLICommandName.AUTH.value)
|
|
182
|
+
def cli_auth() -> None:
|
|
183
|
+
"""
|
|
184
|
+
Manage your vantage6 authentication server instances.
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
# Define the commands for the auth group
|
|
189
|
+
cli_auth.add_command(cli_auth_new, name="new")
|
|
190
|
+
cli_auth.add_command(cli_auth_start, name="start")
|
|
191
|
+
cli_auth.add_command(cli_auth_stop, name="stop")
|
|
192
|
+
cli_auth.add_command(cli_auth_attach, name="attach")
|
|
193
|
+
cli_auth.add_command(cli_auth_files, name="files")
|
|
194
|
+
cli_auth.add_command(cli_auth_configuration_list, name="list")
|
|
195
|
+
cli_auth.add_command(cli_auth_remove, name="remove")
|
|
196
|
+
|
|
197
|
+
|
|
149
198
|
# Add the use group
|
|
150
199
|
@click.group(name=CLICommandName.USE.value)
|
|
151
200
|
def cli_use() -> None:
|
|
@@ -173,8 +222,10 @@ def cli_complete() -> None:
|
|
|
173
222
|
# Add the subcommands to the overall group
|
|
174
223
|
cli_complete.add_command(cli_node)
|
|
175
224
|
cli_complete.add_command(cli_server)
|
|
225
|
+
cli_complete.add_command(cli_sandbox)
|
|
176
226
|
cli_complete.add_command(cli_dev)
|
|
177
227
|
cli_complete.add_command(cli_algorithm)
|
|
178
228
|
cli_complete.add_command(cli_test)
|
|
179
229
|
cli_complete.add_command(cli_algo_store)
|
|
180
230
|
cli_complete.add_command(cli_use)
|
|
231
|
+
cli_complete.add_command(cli_auth)
|