vantage6 5.0.0a35__tar.gz → 5.0.0a36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vantage6 might be problematic. Click here for more details.

Files changed (97) hide show
  1. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/PKG-INFO +3 -3
  2. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/pyproject.toml +5 -4
  3. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algorithm/generate_algorithm_json.py +9 -9
  4. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/attach.py +1 -0
  5. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/files.py +3 -2
  6. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/list.py +0 -3
  7. vantage6-5.0.0a36/vantage6/cli/auth/attach.py +60 -0
  8. vantage6-5.0.0a36/vantage6/cli/auth/files.py +16 -0
  9. vantage6-5.0.0a36/vantage6/cli/auth/list.py +13 -0
  10. vantage6-5.0.0a36/vantage6/cli/auth/new.py +80 -0
  11. vantage6-5.0.0a36/vantage6/cli/auth/remove.py +31 -0
  12. vantage6-5.0.0a36/vantage6/cli/auth/start.py +80 -0
  13. vantage6-5.0.0a36/vantage6/cli/auth/stop.py +64 -0
  14. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/cli.py +37 -5
  15. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/start.py +1 -1
  16. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/utils.py +2 -0
  17. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/configuration_manager.py +31 -0
  18. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/configuration_wizard.py +6 -1
  19. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/context/__init__.py +3 -0
  20. vantage6-5.0.0a36/vantage6/cli/context/auth.py +107 -0
  21. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/context/base_server.py +0 -4
  22. vantage6-5.0.0a36/vantage6/cli/dev/clean.py +28 -0
  23. vantage6-5.0.0a36/vantage6/cli/dev/common.py +34 -0
  24. vantage6-5.0.0a36/vantage6/cli/dev/rebuild.py +39 -0
  25. vantage6-5.0.0a36/vantage6/cli/dev/start.py +36 -0
  26. vantage6-5.0.0a36/vantage6/cli/dev/stop.py +23 -0
  27. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/globals.py +4 -1
  28. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/list.py +5 -4
  29. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/version.py +5 -4
  30. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/prometheus/monitoring_manager.py +5 -3
  31. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/queue_manager.py +13 -11
  32. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/attach.py +1 -0
  33. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/common/__init__.py +1 -27
  34. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/import_.py +1 -1
  35. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/new.py +17 -4
  36. vantage6-5.0.0a36/vantage6/cli/template/auth_config.j2 +230 -0
  37. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/template/node_config.j2 +8 -8
  38. vantage6-5.0.0a36/vantage6/cli/template/node_config_nonk8s.j2 +33 -0
  39. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/common/diagnostic_runner.py +5 -3
  40. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/use/namespace.py +2 -1
  41. vantage6-5.0.0a35/vantage6/cli/dev/create.py +0 -693
  42. vantage6-5.0.0a35/vantage6/cli/dev/data/km_dataset.csv +0 -2401
  43. vantage6-5.0.0a35/vantage6/cli/dev/remove.py +0 -112
  44. vantage6-5.0.0a35/vantage6/cli/server/shell.py +0 -54
  45. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/.gitignore +0 -0
  46. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/Makefile +0 -0
  47. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/README.md +0 -0
  48. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/__init__.py +0 -0
  49. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/test_client_script.py +0 -0
  50. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/test_example.py +0 -0
  51. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/test_node_cli.py +0 -0
  52. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/test_server_cli.py +0 -0
  53. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/tests_cli/test_wizard.py +0 -0
  54. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/__init__.py +0 -0
  55. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algorithm/create.py +0 -0
  56. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algorithm/update.py +1 -1
  57. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/new.py +0 -0
  58. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/remove.py +0 -0
  59. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/start.py +0 -0
  60. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/algostore/stop.py +0 -0
  61. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/decorator.py +0 -0
  62. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/new.py +0 -0
  63. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/remove.py +0 -0
  64. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/common/stop.py +0 -0
  65. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/config.py +0 -0
  66. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/context/algorithm_store.py +0 -0
  67. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/context/node.py +0 -0
  68. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/context/server.py +0 -0
  69. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/attach.py +0 -0
  70. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/common/__init__.py +0 -0
  71. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/create_private_key.py +0 -0
  72. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/files.py +0 -0
  73. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/new.py +0 -0
  74. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/remove.py +0 -0
  75. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/restart.py +0 -0
  76. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/set_api_key.py +0 -0
  77. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/start.py +0 -0
  78. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/node/stop.py +0 -0
  79. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/prometheus/prometheus.yml +0 -0
  80. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/__init__.py +0 -0
  81. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/definitions.py +0 -0
  82. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  83. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/files.py +0 -0
  84. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/list.py +0 -0
  85. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/remove.py +0 -0
  86. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/start.py +0 -0
  87. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/stop.py +0 -0
  88. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/server/version.py +0 -0
  89. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/template/algo_store_config.j2 +0 -0
  90. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/template/server_config.j2 +0 -0
  91. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  92. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  93. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/client_script.py +0 -0
  94. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/feature_tester.py +0 -0
  95. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/test/integration_test.py +0 -0
  96. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/use/context.py +0 -0
  97. {vantage6-5.0.0a35 → vantage6-5.0.0a36}/vantage6/cli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 5.0.0a35
3
+ Version: 5.0.0a36
4
4
  Summary: vantage6 command line interface
5
5
  Author: Vantage6 Team
6
6
  Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
@@ -18,8 +18,8 @@ Requires-Dist: questionary==1.10.0
18
18
  Requires-Dist: rich==13.5.2
19
19
  Requires-Dist: schema==0.7.5
20
20
  Requires-Dist: sqlalchemy==2.0.37
21
- Requires-Dist: vantage6-client==5.0.0a35
22
- Requires-Dist: vantage6-common==5.0.0a35
21
+ Requires-Dist: vantage6-client==5.0.0a36
22
+ Requires-Dist: vantage6-common==5.0.0a36
23
23
  Provides-Extra: dev
24
24
  Requires-Dist: black; extra == 'dev'
25
25
  Requires-Dist: coverage==7.10.2; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vantage6"
7
- version = "5.0.0a35"
7
+ version = "5.0.0a36"
8
8
  description = "vantage6 command line interface"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -29,8 +29,8 @@ dependencies = [
29
29
  "rich==13.5.2",
30
30
  "schema==0.7.5",
31
31
  "sqlalchemy==2.0.37",
32
- "vantage6-common==5.0.0a35",
33
- "vantage6-client==5.0.0a35",
32
+ "vantage6-common==5.0.0a36",
33
+ "vantage6-client==5.0.0a36",
34
34
  ]
35
35
 
36
36
  [project.optional-dependencies]
@@ -56,9 +56,10 @@ where = ["vantage6/cli"]
56
56
  "vantage6/cli/" = [
57
57
  "rabbimq/rabbitmq.config",
58
58
  "template/node_config.j2",
59
+ "template/node_config_nonk8s.j2",
59
60
  "template/server_config.j2",
60
- "template/server_import_config.j2",
61
61
  "template/algo_store_config.j2",
62
+ "template/auth_config.j2",
62
63
  "dev/data/olympic_athletes_2016.csv",
63
64
  "dev/data/km_dataset.csv",
64
65
  "prometheus/prometheus.yml",
@@ -276,23 +276,23 @@ class Function:
276
276
  else:
277
277
  type_ = param.annotation
278
278
 
279
- if type_ == str:
279
+ if type_ is str:
280
280
  return AlgorithmArgumentType.STRING
281
- elif type_ == dict:
281
+ elif type_ is dict:
282
282
  return AlgorithmArgumentType.JSON
283
- elif type_ == int:
283
+ elif type_ is int:
284
284
  return AlgorithmArgumentType.INTEGER
285
- elif type_ == float:
285
+ elif type_ is float:
286
286
  return AlgorithmArgumentType.FLOAT
287
- elif type_ == bool:
287
+ elif type_ is bool:
288
288
  return AlgorithmArgumentType.BOOLEAN
289
- elif type_ == list:
289
+ elif type_ is list:
290
290
  return AlgorithmArgumentType.STRINGS
291
- elif type_ == list[str]:
291
+ elif type_ is list[str]:
292
292
  return AlgorithmArgumentType.STRINGS
293
- elif type_ == list[int]:
293
+ elif type_ is list[int]:
294
294
  return AlgorithmArgumentType.INTEGERS
295
- elif type_ == list[float]:
295
+ elif type_ is list[float]:
296
296
  return AlgorithmArgumentType.FLOATS
297
297
  else:
298
298
  warning(
@@ -1,6 +1,7 @@
1
1
  import click
2
2
 
3
3
  from vantage6.common import info
4
+
4
5
  from vantage6.cli.common.utils import attach_logs
5
6
 
6
7
 
@@ -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)
@@ -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)
@@ -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)
@@ -0,0 +1,80 @@
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
+ questionnaire_function=auth_configuration_questionaire,
48
+ name=name,
49
+ system_folders=system_folders,
50
+ namespace=namespace,
51
+ context=context,
52
+ type_=InstanceType.AUTH,
53
+ )
54
+
55
+
56
+ def auth_configuration_questionaire(instance_name: str) -> dict[str, Any]:
57
+ """
58
+ Kubernetes-specific questionnaire to generate Helm values for the Keycloak helm
59
+ chart.
60
+ """
61
+ config = {"keycloak": {}}
62
+
63
+ is_production = q.confirm(
64
+ "Do you want to use production settings? If not, the service will be configured"
65
+ " to be more suitable for development or testing purposes.",
66
+ default=True,
67
+ ).unsafe_ask()
68
+
69
+ config["keycloak"]["production"] = is_production
70
+
71
+ if is_production:
72
+ ui_url = q.text(
73
+ "Please provide the URL of the UI. This is the URL that users will use to "
74
+ "log in to the service.",
75
+ default="https://ui.vantage6.ai",
76
+ ).unsafe_ask()
77
+ # add http://localhost:7681 as that is used by the Python client
78
+ config["keycloak"]["redirectUris"] = [ui_url, "http://localhost:7681"]
79
+
80
+ 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,80 @@
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
+ )
15
+ from vantage6.cli.context.auth import AuthContext
16
+ from vantage6.cli.globals import ChartName
17
+
18
+
19
+ @click.command()
20
+ @click.option("--context", default=None, help="Kubernetes context to use")
21
+ @click.option("--namespace", default=None, help="Kubernetes namespace to use")
22
+ @click.option("--ip", default=None, help="IP address to listen on")
23
+ @click.option(
24
+ "-p",
25
+ "--port",
26
+ default=None,
27
+ type=int,
28
+ help="Port to listen on for the auth service",
29
+ )
30
+ @click.option(
31
+ "--attach/--detach",
32
+ default=False,
33
+ help="Print server logs to the console after start",
34
+ )
35
+ @click_insert_context(
36
+ type_=InstanceType.AUTH, include_name=True, include_system_folders=True
37
+ )
38
+ def cli_auth_start(
39
+ ctx: AuthContext,
40
+ name: str,
41
+ system_folders: bool,
42
+ context: str,
43
+ namespace: str,
44
+ ip: str,
45
+ port: int,
46
+ attach: bool,
47
+ ) -> None:
48
+ """
49
+ Start the auth service.
50
+ """
51
+ info("Starting authentication service...")
52
+
53
+ prestart_checks(ctx, InstanceType.AUTH, name, system_folders, context, namespace)
54
+
55
+ # TODO: re-enable when we save the auth logs
56
+ # create_directory_if_not_exists(ctx.log_dir)
57
+
58
+ helm_install(
59
+ release_name=ctx.helm_release_name,
60
+ chart_name=ChartName.AUTH,
61
+ values_file=ctx.config_file,
62
+ context=context,
63
+ namespace=namespace,
64
+ )
65
+
66
+ # port forward for auth service
67
+ info("Port forwarding for auth service")
68
+ start_port_forward(
69
+ service_name=f"{ctx.helm_release_name}-keycloak",
70
+ service_port=Ports.HTTP.value,
71
+ port=port or Ports.DEV_AUTH.value,
72
+ ip=ip,
73
+ context=context,
74
+ namespace=namespace,
75
+ )
76
+
77
+ if attach:
78
+ attach_logs(
79
+ f"app.kubernetes.io/instance={ctx.helm_release_name}",
80
+ )
@@ -0,0 +1,64 @@
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
+ def cli_auth_stop(
29
+ name: str,
30
+ context: str,
31
+ namespace: str,
32
+ system_folders: bool,
33
+ ):
34
+ """
35
+ Stop a running auth service.
36
+ """
37
+ execute_stop(
38
+ stop_function=_stop_auth,
39
+ instance_type=InstanceType.AUTH,
40
+ infra_component=InfraComponentName.AUTH,
41
+ stop_all=False,
42
+ to_stop=name,
43
+ namespace=namespace,
44
+ context=context,
45
+ system_folders=system_folders,
46
+ )
47
+
48
+
49
+ def _stop_auth(auth_name: str, namespace: str, context: str) -> None:
50
+ info(f"Stopping auth {auth_name}...")
51
+
52
+ # uninstall the helm release
53
+ helm_uninstall(
54
+ release_name=auth_name,
55
+ context=context,
56
+ namespace=namespace,
57
+ )
58
+
59
+ # stop the port forwarding for auth service
60
+ stop_port_forward(
61
+ service_name=f"{auth_name}-keycloak",
62
+ )
63
+
64
+ info(f"Auth {auth_name} stopped successfully.")
@@ -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
@@ -30,7 +41,6 @@ from vantage6.cli.server.import_ import cli_server_import
30
41
  from vantage6.cli.server.list import cli_server_configuration_list
31
42
  from vantage6.cli.server.new import cli_server_new
32
43
  from vantage6.cli.server.remove import cli_server_remove
33
- from vantage6.cli.server.shell import cli_server_shell
34
44
  from vantage6.cli.server.start import cli_server_start
35
45
  from vantage6.cli.server.stop import cli_server_stop
36
46
  from vantage6.cli.server.version import cli_server_version
@@ -57,7 +67,6 @@ cli_server.add_command(cli_server_import, name="import")
57
67
  cli_server.add_command(cli_server_configuration_list, name="list")
58
68
  cli_server.add_command(cli_server_new, name="new")
59
69
  cli_server.add_command(cli_server_remove, name="remove")
60
- cli_server.add_command(cli_server_shell, name="shell")
61
70
  cli_server.add_command(cli_server_start, name="start")
62
71
  cli_server.add_command(cli_server_stop, name="stop")
63
72
  cli_server.add_command(cli_server_version, name="version")
@@ -89,13 +98,17 @@ cli_node.add_command(cli_node_version, name="version")
89
98
  @click.group(name=CLICommandName.DEV.value)
90
99
  def cli_dev() -> None:
91
100
  """
92
- Quickly manage a test network with a server and several nodes.
101
+ Spin up a local development network.
93
102
 
94
- These commands are helpful for local testing of your vantage6 environment.
103
+ In this environment, any code changes you make will be reflected in the running
104
+ services.
95
105
  """
96
106
 
97
107
 
98
- # TODO add commands for the dev group
108
+ cli_dev.add_command(cli_start_dev_env, name="start")
109
+ cli_dev.add_command(cli_stop_dev_env, name="stop")
110
+ cli_dev.add_command(cli_rebuild_dev_env, name="rebuild")
111
+ cli_dev.add_command(cli_clean_dev_env, name="clean")
99
112
 
100
113
 
101
114
  # Define the algorithm group
@@ -146,6 +159,24 @@ cli_algo_store.add_command(cli_algo_store_configuration_list, name="list")
146
159
  cli_algo_store.add_command(cli_algo_store_remove, name="remove")
147
160
 
148
161
 
162
+ # Define the auth group
163
+ @click.group(name=CLICommandName.AUTH.value)
164
+ def cli_auth() -> None:
165
+ """
166
+ Manage your vantage6 authentication server instances.
167
+ """
168
+
169
+
170
+ # Define the commands for the auth group
171
+ cli_auth.add_command(cli_auth_new, name="new")
172
+ cli_auth.add_command(cli_auth_start, name="start")
173
+ cli_auth.add_command(cli_auth_stop, name="stop")
174
+ cli_auth.add_command(cli_auth_attach, name="attach")
175
+ cli_auth.add_command(cli_auth_files, name="files")
176
+ cli_auth.add_command(cli_auth_configuration_list, name="list")
177
+ cli_auth.add_command(cli_auth_remove, name="remove")
178
+
179
+
149
180
  # Add the use group
150
181
  @click.group(name=CLICommandName.USE.value)
151
182
  def cli_use() -> None:
@@ -178,3 +209,4 @@ cli_complete.add_command(cli_algorithm)
178
209
  cli_complete.add_command(cli_test)
179
210
  cli_complete.add_command(cli_algo_store)
180
211
  cli_complete.add_command(cli_use)
212
+ cli_complete.add_command(cli_auth)
@@ -200,7 +200,7 @@ def helm_install(
200
200
  )
201
201
  info(
202
202
  f"Successfully installed release '{release_name}' using chart "
203
- f"'{chart_name}'."
203
+ f"'{chart_name.value}'."
204
204
  )
205
205
  except subprocess.CalledProcessError:
206
206
  error(f"Failed to install release '{release_name}'.")
@@ -380,6 +380,8 @@ def get_main_cli_command_name(instance_type: InstanceType) -> str:
380
380
  return CLICommandName.ALGORITHM_STORE.value
381
381
  elif instance_type == InstanceType.NODE:
382
382
  return CLICommandName.NODE.value
383
+ elif instance_type == InstanceType.AUTH:
384
+ return CLICommandName.AUTH.value
383
385
  else:
384
386
  raise ValueError(f"Invalid instance type: {instance_type}")
385
387
 
@@ -6,6 +6,7 @@ from vantage6.common.configuration_manager import Configuration, ConfigurationMa
6
6
 
7
7
  from vantage6.cli.globals import (
8
8
  ALGO_STORE_TEMPLATE_FILE,
9
+ AUTH_TEMPLATE_FILE,
9
10
  NODE_TEMPLATE_FILE,
10
11
  SERVER_TEMPLATE_FILE,
11
12
  )
@@ -47,6 +48,8 @@ class NodeConfiguration(Configuration):
47
48
  validators.
48
49
  """
49
50
 
51
+ # TODO perhaps we can remove these classes and do validation of the configuration
52
+ # file more easily with helm values.yaml checks.
50
53
  VALIDATORS = {
51
54
  # # TODO enable validators for node. To see if it works, use v6 node list
52
55
  # "node": {
@@ -65,6 +68,10 @@ class NodeConfiguration(Configuration):
65
68
  }
66
69
 
67
70
 
71
+ class AuthConfiguration(Configuration):
72
+ VALIDATORS = {}
73
+
74
+
68
75
  class TestConfiguration(Configuration):
69
76
  VALIDATORS = {}
70
77
 
@@ -193,6 +200,30 @@ class AlgorithmStoreConfigurationManager(ConfigurationManager):
193
200
  return super()._get_config_template(ALGO_STORE_TEMPLATE_FILE)
194
201
 
195
202
 
203
+ class AuthConfigurationManager(ConfigurationManager):
204
+ """
205
+ Maintains the auth's configuration.
206
+
207
+ Parameters
208
+ ----------
209
+ name : str
210
+ Name of the configuration file.
211
+ """
212
+
213
+ def __init__(self, name, *args, **kwargs):
214
+ super().__init__(conf_class=AuthConfiguration, name=name)
215
+
216
+ @classmethod
217
+ def from_file(cls, path: str) -> Self:
218
+ return super().from_file(path, conf_class=AuthConfiguration)
219
+
220
+ def get_config_template(self) -> str:
221
+ """
222
+ Get the configuration template for the auth.
223
+ """
224
+ return super()._get_config_template(AUTH_TEMPLATE_FILE)
225
+
226
+
196
227
  class TestingConfigurationManager(ConfigurationManager):
197
228
  def __init__(self, name, *args, **kwargs):
198
229
  super().__init__(conf_class=TestConfiguration, name=name)
@@ -12,6 +12,7 @@ from vantage6.common.globals import (
12
12
 
13
13
  from vantage6.cli.configuration_manager import (
14
14
  AlgorithmStoreConfigurationManager,
15
+ AuthConfigurationManager,
15
16
  NodeConfigurationManager,
16
17
  ServerConfigurationManager,
17
18
  )
@@ -167,8 +168,12 @@ def configuration_wizard(
167
168
  conf_manager = NodeConfigurationManager
168
169
  elif type_ == InstanceType.SERVER:
169
170
  conf_manager = ServerConfigurationManager
170
- else:
171
+ elif type_ == InstanceType.ALGORITHM_STORE:
171
172
  conf_manager = AlgorithmStoreConfigurationManager
173
+ elif type_ == InstanceType.AUTH:
174
+ conf_manager = AuthConfigurationManager
175
+ else:
176
+ raise ValueError(f"Invalid instance type: {type_}")
172
177
 
173
178
  if Path(config_file).exists():
174
179
  config_manager = conf_manager.from_file(config_file)
@@ -14,6 +14,7 @@ from vantage6.common import error
14
14
  from vantage6.common.globals import InstanceType
15
15
 
16
16
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
17
+ from vantage6.cli.context.auth import AuthContext
17
18
  from vantage6.cli.context.node import NodeContext
18
19
  from vantage6.cli.context.server import ServerContext
19
20
 
@@ -45,6 +46,8 @@ def select_context_class(
45
46
  return AlgorithmStoreContext
46
47
  elif type_ == InstanceType.NODE:
47
48
  return NodeContext
49
+ elif type_ == InstanceType.AUTH:
50
+ return AuthContext
48
51
  else:
49
52
  raise NotImplementedError
50
53