vantage6 5.0.0a37__tar.gz → 5.0.0a38__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 (116) hide show
  1. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/PKG-INFO +3 -3
  2. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/pyproject.toml +3 -3
  3. vantage6-5.0.0a38/vantage6/cli/algostore/attach.py +39 -0
  4. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/list.py +2 -2
  5. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/start.py +11 -3
  6. vantage6-5.0.0a38/vantage6/cli/algostore/version.py +62 -0
  7. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/attach.py +1 -1
  8. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/list.py +2 -2
  9. vantage6-5.0.0a38/vantage6/cli/auth/remove.py +89 -0
  10. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/start.py +12 -8
  11. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/cli.py +2 -0
  12. vantage6-5.0.0a38/vantage6/cli/common/attach.py +114 -0
  13. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/decorator.py +5 -3
  14. vantage6-5.0.0a38/vantage6/cli/common/list.py +68 -0
  15. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/remove.py +18 -0
  16. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/stop.py +3 -9
  17. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/utils.py +44 -76
  18. vantage6-5.0.0a38/vantage6/cli/common/version.py +82 -0
  19. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/__init__.py +3 -0
  20. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/algorithm_store.py +2 -2
  21. vantage6-5.0.0a38/vantage6/cli/node/attach.py +38 -0
  22. vantage6-5.0.0a38/vantage6/cli/node/list.py +16 -0
  23. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/start.py +11 -3
  24. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/stop.py +13 -15
  25. vantage6-5.0.0a38/vantage6/cli/node/version.py +125 -0
  26. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/config/base.py +10 -2
  27. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/config/core.py +3 -3
  28. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/config/node.py +2 -5
  29. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/remove.py +17 -35
  30. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/start.py +8 -0
  31. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/stop.py +1 -1
  32. vantage6-5.0.0a38/vantage6/cli/server/attach.py +39 -0
  33. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/list.py +2 -2
  34. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/start.py +11 -3
  35. vantage6-5.0.0a38/vantage6/cli/server/version.py +50 -0
  36. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/template/algo_store_config.j2 +3 -0
  37. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/template/node_config.j2 +2 -0
  38. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/use/context.py +8 -1
  39. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/use/namespace.py +10 -7
  40. vantage6-5.0.0a38/vantage6/cli/utils_kubernetes.py +270 -0
  41. vantage6-5.0.0a37/vantage6/cli/algostore/attach.py +0 -14
  42. vantage6-5.0.0a37/vantage6/cli/auth/remove.py +0 -31
  43. vantage6-5.0.0a37/vantage6/cli/node/attach.py +0 -14
  44. vantage6-5.0.0a37/vantage6/cli/node/list.py +0 -57
  45. vantage6-5.0.0a37/vantage6/cli/node/version.py +0 -62
  46. vantage6-5.0.0a37/vantage6/cli/server/attach.py +0 -14
  47. vantage6-5.0.0a37/vantage6/cli/server/version.py +0 -37
  48. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/.gitignore +0 -0
  49. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/Makefile +0 -0
  50. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/README.md +0 -0
  51. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/__init__.py +0 -0
  52. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/test_client_script.py +0 -0
  53. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/test_example.py +0 -0
  54. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/test_node_cli.py +0 -0
  55. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/test_server_cli.py +0 -0
  56. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/tests_cli/test_wizard.py +0 -0
  57. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/__init__.py +0 -0
  58. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algorithm/create.py +0 -0
  59. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algorithm/generate_algorithm_json.py +0 -0
  60. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algorithm/update.py +0 -0
  61. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/files.py +0 -0
  62. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/new.py +0 -0
  63. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/remove.py +0 -0
  64. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/algostore/stop.py +0 -0
  65. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/files.py +0 -0
  66. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/new.py +0 -0
  67. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/auth/stop.py +0 -0
  68. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/new.py +0 -0
  69. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/common/start.py +0 -0
  70. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/config.py +0 -0
  71. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/configuration_create.py +0 -0
  72. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/configuration_manager.py +0 -0
  73. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/auth.py +0 -0
  74. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/base_server.py +0 -0
  75. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/node.py +0 -0
  76. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/context/server.py +0 -0
  77. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/dev/clean.py +0 -0
  78. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/dev/common.py +0 -0
  79. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/dev/rebuild.py +0 -0
  80. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/dev/start.py +0 -0
  81. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/dev/stop.py +0 -0
  82. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/globals.py +0 -0
  83. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/common/__init__.py +0 -0
  84. /vantage6-5.0.0a37/vantage6/cli/node/task_cleanup/__init__.py → /vantage6-5.0.0a38/vantage6/cli/node/common/task_cleanup.py +0 -0
  85. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/create_private_key.py +0 -0
  86. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/files.py +0 -0
  87. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/new.py +0 -0
  88. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/remove.py +0 -0
  89. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/restart.py +0 -0
  90. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/node/set_api_key.py +0 -0
  91. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/prometheus/monitoring_manager.py +0 -0
  92. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/prometheus/prometheus.yml +0 -0
  93. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/data/km_dataset.csv +0 -0
  94. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/data/olympic_athletes_2016.csv +0 -0
  95. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/new.py +0 -0
  96. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/populate/__init__.py +0 -0
  97. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/populate/helpers/connect_store.py +0 -0
  98. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/populate/helpers/delete_fixtures.py +0 -0
  99. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/populate/helpers/load_fixtures.py +0 -0
  100. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/sandbox/populate/helpers/utils.py +0 -0
  101. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/common/__init__.py +0 -0
  102. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/files.py +0 -0
  103. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/import_.py +0 -0
  104. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/new.py +0 -0
  105. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/remove.py +0 -0
  106. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/server/stop.py +0 -0
  107. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/template/auth_config.j2 +0 -0
  108. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/template/node_config_nonk8s.j2 +0 -0
  109. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/template/server_config.j2 +0 -0
  110. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  111. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  112. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/client_script.py +0 -0
  113. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/common/diagnostic_runner.py +0 -0
  114. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/feature_tester.py +0 -0
  115. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/test/integration_test.py +0 -0
  116. {vantage6-5.0.0a37 → vantage6-5.0.0a38}/vantage6/cli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 5.0.0a37
3
+ Version: 5.0.0a38
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==2.1.1
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.0a37
22
- Requires-Dist: vantage6-common==5.0.0a37
21
+ Requires-Dist: vantage6-client==5.0.0a38
22
+ Requires-Dist: vantage6-common==5.0.0a38
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.0a37"
7
+ version = "5.0.0a38"
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.0a37",
33
- "vantage6-client==5.0.0a37",
32
+ "vantage6-common==5.0.0a38",
33
+ "vantage6-client==5.0.0a38",
34
34
  ]
35
35
 
36
36
  [project.optional-dependencies]
@@ -0,0 +1,39 @@
1
+ import click
2
+
3
+ from vantage6.common import info
4
+
5
+ from vantage6.cli.common.attach import attach_logs
6
+ from vantage6.cli.context import InstanceType
7
+ from vantage6.cli.globals import InfraComponentName
8
+
9
+
10
+ @click.command()
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:
26
+ """
27
+ Show the store logs in the current console.
28
+ """
29
+ info("Attaching to store 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
+ )
@@ -2,7 +2,7 @@ import click
2
2
 
3
3
  from vantage6.common.globals import InstanceType
4
4
 
5
- from vantage6.cli.common.utils import get_server_configuration_list
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
- get_server_configuration_list(InstanceType.ALGORITHM_STORE)
13
+ get_configuration_list(InstanceType.ALGORITHM_STORE)
@@ -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,12 +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
18
  select_context_and_namespace,
19
19
  )
20
20
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
21
- from vantage6.cli.globals import ChartName
21
+ from vantage6.cli.globals import ChartName, InfraComponentName
22
22
 
23
23
 
24
24
  @click.command()
@@ -84,4 +84,12 @@ def cli_algo_store_start(
84
84
  )
85
85
 
86
86
  if attach:
87
- attach_logs("app=store", "component=store-server")
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
+ )
@@ -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__}")
@@ -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,
@@ -2,7 +2,7 @@ import click
2
2
 
3
3
  from vantage6.common.globals import InstanceType
4
4
 
5
- from vantage6.cli.common.utils import get_server_configuration_list
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
- get_server_configuration_list(InstanceType.AUTH)
13
+ get_configuration_list(InstanceType.AUTH)
@@ -0,0 +1,89 @@
1
+ import click
2
+
3
+ from vantage6.common import info, warning
4
+ from vantage6.common.globals import InstanceType
5
+
6
+ from vantage6.cli.common.decorator import click_insert_context
7
+ from vantage6.cli.common.remove import execute_remove
8
+ from vantage6.cli.context.auth import AuthContext
9
+ from vantage6.cli.globals import InfraComponentName
10
+ from vantage6.cli.utils_kubernetes import get_core_api_with_ssl_handling
11
+
12
+
13
+ @click.command()
14
+ @click_insert_context(
15
+ type_=InstanceType.AUTH, include_name=True, include_system_folders=True
16
+ )
17
+ @click.option("-f", "--force", "force", flag_value=True)
18
+ def cli_auth_remove(
19
+ ctx: AuthContext, name: str, system_folders: bool, force: bool
20
+ ) -> None:
21
+ """
22
+ Function to remove a server.
23
+
24
+ Parameters
25
+ ----------
26
+ ctx : ServerContext
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
32
+ force : bool
33
+ Whether to ask for confirmation before removing or not
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
+
48
+ execute_remove(
49
+ ctx, InstanceType.AUTH, InfraComponentName.AUTH, name, system_folders, force
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}")
@@ -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,10 +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
- select_context_and_namespace,
15
- )
12
+ from vantage6.cli.common.utils import select_context_and_namespace
16
13
  from vantage6.cli.context.auth import AuthContext
17
14
  from vantage6.cli.globals import ChartName
18
15
 
@@ -89,6 +86,13 @@ def cli_auth_start(
89
86
  )
90
87
 
91
88
  if attach:
92
- attach_logs(
93
- [f"app.kubernetes.io/instance={ctx.helm_release_name}"],
94
- )
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
+ # )
@@ -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
@@ -175,6 +176,7 @@ cli_algo_store.add_command(cli_algo_store_stop, name="stop")
175
176
  cli_algo_store.add_command(cli_algo_store_files, name="files")
176
177
  cli_algo_store.add_command(cli_algo_store_configuration_list, name="list")
177
178
  cli_algo_store.add_command(cli_algo_store_remove, name="remove")
179
+ cli_algo_store.add_command(cli_algo_store_version, name="version")
178
180
 
179
181
 
180
182
  # Define the auth group
@@ -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()
@@ -4,8 +4,9 @@ from pathlib import Path
4
4
  import click
5
5
 
6
6
  from vantage6.common import error
7
- from vantage6.common.globals import SANDBOX_SUFFIX, InstanceType
7
+ from vantage6.common.globals import InstanceType
8
8
 
9
+ from vantage6.cli.common.utils import extract_name_and_is_sandbox
9
10
  from vantage6.cli.configuration_create import select_configuration_questionnaire
10
11
  from vantage6.cli.context import get_context, select_context_class
11
12
 
@@ -88,8 +89,9 @@ def click_insert_context(
88
89
  if sandbox_param is not None:
89
90
  # Pop to avoid passing unknown kwarg to the wrapped function
90
91
  runtime_is_sandbox = bool(kwargs.pop(sandbox_param, False))
91
- if runtime_is_sandbox and name and name.endswith(SANDBOX_SUFFIX):
92
- name = name[: -len(SANDBOX_SUFFIX)]
92
+ name, runtime_is_sandbox = extract_name_and_is_sandbox(
93
+ name, runtime_is_sandbox
94
+ )
93
95
 
94
96
  # path to configuration file always overrides name
95
97
  if config:
@@ -0,0 +1,68 @@
1
+ import click
2
+ from colorama import Fore, Style
3
+
4
+ from vantage6.common import warning
5
+ from vantage6.common.globals import (
6
+ APPNAME,
7
+ SANDBOX_SUFFIX,
8
+ InstanceType,
9
+ )
10
+
11
+ from vantage6.cli.common.utils import find_running_service_names
12
+ from vantage6.cli.context import select_context_class
13
+
14
+
15
+ def get_configuration_list(instance_type: InstanceType) -> None:
16
+ """
17
+ Print list of available server configurations.
18
+
19
+ Parameters
20
+ ----------
21
+ instance_type : InstanceType
22
+ The type of instance to get the configurations for
23
+ """
24
+ ctx_class = select_context_class(instance_type)
25
+
26
+ running_server_names = find_running_service_names(instance_type)
27
+ header = "\nName" + (21 * " ") + "Status" + (10 * " ") + "System/User"
28
+
29
+ click.echo(header)
30
+ click.echo("-" * len(header))
31
+
32
+ running = Fore.GREEN + "Running" + Style.RESET_ALL
33
+ stopped = Fore.RED + "Not running" + Style.RESET_ALL
34
+
35
+ # system folders
36
+ configs, failed_imports_system = ctx_class.available_configurations(
37
+ system_folders=True
38
+ )
39
+ for config in configs:
40
+ config.name = config.name.replace(SANDBOX_SUFFIX, "")
41
+ status = (
42
+ running
43
+ if f"{APPNAME}-{config.name}-system-{instance_type.value}"
44
+ in running_server_names
45
+ else stopped
46
+ )
47
+ click.echo(f"{config.name:25}{status:25} System ")
48
+
49
+ # user folders
50
+ configs, failed_imports_user = ctx_class.available_configurations(
51
+ system_folders=False
52
+ )
53
+ for config in configs:
54
+ config.name = config.name.replace(SANDBOX_SUFFIX, "")
55
+ status = (
56
+ running
57
+ if f"{APPNAME}-{config.name}-user-{instance_type.value}"
58
+ in running_server_names
59
+ else stopped
60
+ )
61
+ click.echo(f"{config.name:25}{status:25} User ")
62
+
63
+ click.echo("-" * 85)
64
+ if len(failed_imports_system) + len(failed_imports_user):
65
+ warning(
66
+ f"{Fore.RED}Failed imports: "
67
+ f"{len(failed_imports_system) + len(failed_imports_user)}{Style.RESET_ALL}"
68
+ )
@@ -24,6 +24,24 @@ def execute_remove(
24
24
  system_folders: bool,
25
25
  force: bool,
26
26
  ) -> None:
27
+ """
28
+ Function to remove a vantage6 service instance.
29
+
30
+ Parameters
31
+ ----------
32
+ ctx : AppContext
33
+ App context object
34
+ instance_type : InstanceType
35
+ Type of instance that is checked
36
+ infra_component : InfraComponentName
37
+ The infra component of the service
38
+ name : str
39
+ Name of the instance
40
+ system_folders : bool
41
+ Whether to use system folders or user folders
42
+ force : bool
43
+ Whether to ask for confirmation before removing or not
44
+ """
27
45
  if check_running(ctx.helm_release_name, instance_type, name, system_folders):
28
46
  error(
29
47
  f"The {infra_component.value} {name} is still running! Please stop the "
@@ -5,9 +5,10 @@ import subprocess
5
5
  from colorama import Fore, Style
6
6
 
7
7
  from vantage6.common import error, info, warning
8
- from vantage6.common.globals import SANDBOX_SUFFIX, InstanceType
8
+ from vantage6.common.globals import InstanceType
9
9
 
10
10
  from vantage6.cli.common.utils import (
11
+ extract_name_and_is_sandbox,
11
12
  find_running_service_names,
12
13
  select_context_and_namespace,
13
14
  select_running_service,
@@ -81,14 +82,7 @@ def execute_stop(
81
82
  if not to_stop:
82
83
  helm_name = select_running_service(running_services, instance_type)
83
84
  else:
84
- if to_stop.endswith(SANDBOX_SUFFIX):
85
- to_stop = to_stop[: -len(SANDBOX_SUFFIX)]
86
- is_sandbox = True
87
- elif is_sandbox:
88
- warning(
89
- "Sandbox configuration detected, but no sandbox suffix found. "
90
- "This may lead to issues."
91
- )
85
+ to_stop, is_sandbox = extract_name_and_is_sandbox(to_stop, is_sandbox)
92
86
  ctx = get_context(
93
87
  instance_type, to_stop, system_folders, is_sandbox=is_sandbox
94
88
  )