edge-containers-cli 4.2.2__tar.gz → 4.3.0__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.
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.copier-answers.yml +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.devcontainer/devcontainer.json +4 -4
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/CONTRIBUTING.md +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_release.yml +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_test.yml +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/PKG-INFO +2 -2
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/_version.py +9 -4
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/argo_commands.py +76 -62
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/demo_commands.py +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/helm.py +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/k8s_commands.py +31 -19
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/monitor.py +126 -159
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/definitions.py +1 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/git.py +3 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/logging.py +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/utils.py +22 -5
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/PKG-INFO +2 -2
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/argocd.yaml +4 -8
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/yaml.yaml +1 -1
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/test_unit.py +9 -4
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/ISSUE_TEMPLATE/issue.md +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/actions/install_requirements/action.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/dependabot.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/pages/index.html +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/pages/make_switcher.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_check.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_dist.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_pypi.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/_tox.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.github/workflows/ci.yml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.gitignore +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.pre-commit-config.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.vscode/extensions.json +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.vscode/launch.json +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.vscode/settings.json +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/.vscode/tasks.json +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/Dockerfile +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/LICENSE +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/README.md +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/conf.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/explanations/decisions/0001-record-architecture-decisions.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/explanations/decisions/0002-switched-to-pip-skeleton.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/explanations/decisions.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/build-docs.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/contribute.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/lint.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/make-release.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/pin-requirements.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/run-tests.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/static-analysis.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/test-container.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/how-to/update-tools.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/index.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/reference/standards.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/developer/tutorials/dev-install.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/genindex.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/images/dls-favicon.ico +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/images/dls-logo.svg +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/images/ec-logs.png +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/images/ec-web.png +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/index.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/user/explanations/docs-structure.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/user/how-to/run-container.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/user/index.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/user/reference/api.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/docs/user/tutorials/installation.rst +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/pyproject.toml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/setup.cfg +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/__init__.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/__main__.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/autocomplete.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/backend.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cli.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/__init__.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/commands.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/monitor.tcss +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/globals.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/shell.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/SOURCES.txt +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/dependency_links.txt +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/entry_points.txt +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/requires.txt +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli.egg-info/top_level.txt +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/__init__.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/conftest.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-deployment/apps/values.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-01/Chart.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-01/config/ioc.db +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-01/config/ioc.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-01/templates/configmap.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-01/values.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-02/Chart.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/bl01t-ea-test-02/values.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/dls-aravis/Chart.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/dls-aravis/config/ioc.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/dls-aravis/templates/configmap.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/dls-aravis/values.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/bl01t-services/services/values.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/cli.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/data/k8s.yaml +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/test_argocd.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/test_cli.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/test_demo.py +0 -0
- {edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/tests/test_k8s.py +0 -0
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"features": {
|
|
31
|
-
//
|
|
32
|
-
"ghcr.io/
|
|
33
|
-
"upgradePackages": false
|
|
34
|
-
}
|
|
31
|
+
// add in eternal history and other bash features
|
|
32
|
+
"ghcr.io/diamondlightsource/devcontainer-features/bash-config:1.0.0": {}
|
|
35
33
|
},
|
|
34
|
+
// Create the config folder for the bash-config feature
|
|
35
|
+
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config",
|
|
36
36
|
"runArgs": [
|
|
37
37
|
// Allow the container to access the host X11 display and EPICS CA
|
|
38
38
|
"--net=host",
|
|
@@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua
|
|
|
24
24
|
|
|
25
25
|
This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.
|
|
26
26
|
|
|
27
|
-
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/2.
|
|
27
|
+
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/2.6.0/how-to.html).
|
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
- name: Create GitHub Release
|
|
24
24
|
# We pin to the SHA, not the tag, for security reasons.
|
|
25
25
|
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
|
|
26
|
-
uses: softprops/action-gh-release@
|
|
26
|
+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
|
|
27
27
|
with:
|
|
28
28
|
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
|
|
29
29
|
files: "*"
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# file generated by
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
3
6
|
TYPE_CHECKING = False
|
|
4
7
|
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
6
11
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
12
|
else:
|
|
8
13
|
VERSION_TUPLE = object
|
|
@@ -12,5 +17,5 @@ __version__: str
|
|
|
12
17
|
__version_tuple__: VERSION_TUPLE
|
|
13
18
|
version_tuple: VERSION_TUPLE
|
|
14
19
|
|
|
15
|
-
__version__ = version = '4.
|
|
16
|
-
__version_tuple__ = version_tuple = (4,
|
|
20
|
+
__version__ = version = '4.3.0'
|
|
21
|
+
__version_tuple__ = version_tuple = (4, 3, 0)
|
|
@@ -12,7 +12,12 @@ from time import sleep
|
|
|
12
12
|
import polars
|
|
13
13
|
from ruamel.yaml import YAML
|
|
14
14
|
|
|
15
|
-
from edge_containers_cli.cmds.commands import
|
|
15
|
+
from edge_containers_cli.cmds.commands import (
|
|
16
|
+
CommandError,
|
|
17
|
+
Commands,
|
|
18
|
+
ServicesDataFrame,
|
|
19
|
+
ServicesSchema,
|
|
20
|
+
)
|
|
16
21
|
from edge_containers_cli.definitions import ECContext
|
|
17
22
|
from edge_containers_cli.git import set_values
|
|
18
23
|
from edge_containers_cli.globals import TIME_FORMAT
|
|
@@ -25,28 +30,35 @@ def extract_ns_app(target: str) -> tuple[str, str]:
|
|
|
25
30
|
return namespace, app
|
|
26
31
|
|
|
27
32
|
|
|
33
|
+
def do_retry(cmd):
|
|
34
|
+
def _do_retry(*args, **kwargs):
|
|
35
|
+
max_attempts = 5
|
|
36
|
+
attempt = 1
|
|
37
|
+
sleep_time = 1
|
|
38
|
+
while attempt <= max_attempts:
|
|
39
|
+
try:
|
|
40
|
+
cmd(*args, **kwargs)
|
|
41
|
+
return None
|
|
42
|
+
except ShellError:
|
|
43
|
+
if attempt == max_attempts:
|
|
44
|
+
log.debug(f"Retry failed after {max_attempts} attempts")
|
|
45
|
+
raise
|
|
46
|
+
else:
|
|
47
|
+
log.debug(f"Retry attempt {attempt} failed. Retrying...")
|
|
48
|
+
sleep(sleep_time)
|
|
49
|
+
attempt += 1
|
|
50
|
+
|
|
51
|
+
return _do_retry
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@do_retry
|
|
28
55
|
def patch_value(target: str, key: str, value: str | bool | int):
|
|
29
56
|
cmd_temp_ = f"argocd app set {target} -p {key}={value}"
|
|
30
57
|
shell.run_command(cmd_temp_, skip_on_dryrun=True)
|
|
31
|
-
|
|
32
|
-
attempt = 1
|
|
33
|
-
sleep_time = 2
|
|
34
|
-
while attempt <= max_attempts:
|
|
35
|
-
try:
|
|
36
|
-
# Sync may conflict with autosync "another operation is already in progress"
|
|
37
|
-
cmd_sync = f"argocd app sync {target} --apply-out-of-sync-only"
|
|
38
|
-
shell.run_command(cmd_sync, skip_on_dryrun=True)
|
|
39
|
-
return None
|
|
40
|
-
except ShellError:
|
|
41
|
-
if attempt == max_attempts:
|
|
42
|
-
log.debug(f"Argo patch failed after {max_attempts} attempts")
|
|
43
|
-
raise
|
|
44
|
-
else:
|
|
45
|
-
log.debug(f"Argo patch attempt {attempt} failed. Retrying...")
|
|
46
|
-
sleep(sleep_time)
|
|
47
|
-
attempt += 1
|
|
58
|
+
# Rely on argocd autosync to get the cluster into the right state
|
|
48
59
|
|
|
49
60
|
|
|
61
|
+
@do_retry
|
|
50
62
|
def push_value(target: str, key: str, value: str | bool | int):
|
|
51
63
|
# Get source details
|
|
52
64
|
app_resp = shell.run_command(
|
|
@@ -63,11 +75,12 @@ def push_value(target: str, key: str, value: str | bool | int):
|
|
|
63
75
|
value,
|
|
64
76
|
)
|
|
65
77
|
|
|
66
|
-
#
|
|
67
|
-
cmd_sync = f"argocd app sync {target} --apply-out-of-sync-only"
|
|
68
|
-
shell.run_command(cmd_sync, skip_on_dryrun=True)
|
|
78
|
+
# Free a possible patched value & refresh repo
|
|
69
79
|
cmd_unset = f"argocd app unset {target} -p {key}"
|
|
70
80
|
shell.run_command(cmd_unset, skip_on_dryrun=True)
|
|
81
|
+
cmd_refresh = f"argocd app get {target} --refresh"
|
|
82
|
+
shell.run_command(cmd_refresh, skip_on_dryrun=True)
|
|
83
|
+
# Rely on argocd autosync to get the cluster into the right state
|
|
71
84
|
|
|
72
85
|
|
|
73
86
|
class ArgoCommands(Commands):
|
|
@@ -96,8 +109,7 @@ class ArgoCommands(Commands):
|
|
|
96
109
|
self._check_service(service_name)
|
|
97
110
|
namespace, app = extract_ns_app(self.target)
|
|
98
111
|
cmd = (
|
|
99
|
-
f"argocd app delete-resource {namespace}/{service_name} "
|
|
100
|
-
f"--kind StatefulSet"
|
|
112
|
+
f"argocd app delete-resource {namespace}/{service_name} --kind StatefulSet"
|
|
101
113
|
)
|
|
102
114
|
shell.run_command(cmd, skip_on_dryrun=True)
|
|
103
115
|
|
|
@@ -139,45 +151,47 @@ class ArgoCommands(Commands):
|
|
|
139
151
|
)
|
|
140
152
|
app_dicts = YAML(typ="safe").load(app_resp)
|
|
141
153
|
|
|
142
|
-
if
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
154
|
+
if app_dicts:
|
|
155
|
+
for app in app_dicts:
|
|
156
|
+
resources_dict = app["status"]["resources"]
|
|
157
|
+
|
|
158
|
+
for resource in resources_dict:
|
|
159
|
+
is_ready = False
|
|
160
|
+
if resource["kind"] == "StatefulSet":
|
|
161
|
+
name = app["metadata"]["name"]
|
|
162
|
+
|
|
163
|
+
# check if replicas ready
|
|
164
|
+
mani_resp = shell.run_command(
|
|
165
|
+
f"argocd app manifests {namespace}/{name} --source live",
|
|
166
|
+
)
|
|
167
|
+
for resource_manifest in mani_resp.split("---")[1:]:
|
|
168
|
+
manifest = YAML(typ="safe").load(resource_manifest)
|
|
169
|
+
if not manifest:
|
|
170
|
+
continue
|
|
171
|
+
kind = manifest["kind"]
|
|
172
|
+
resource_name = manifest["metadata"]["name"]
|
|
173
|
+
if kind == "StatefulSet" and resource_name == name:
|
|
174
|
+
try:
|
|
175
|
+
is_ready = bool(manifest["status"]["readyReplicas"])
|
|
176
|
+
except (
|
|
177
|
+
KeyError,
|
|
178
|
+
TypeError,
|
|
179
|
+
): # Not ready if doesnt exist
|
|
180
|
+
is_ready = False
|
|
181
|
+
time_stamp = datetime.strptime(
|
|
182
|
+
manifest["metadata"]["creationTimestamp"],
|
|
183
|
+
"%Y-%m-%dT%H:%M:%SZ",
|
|
184
|
+
)
|
|
185
|
+
service_data["name"].append(name)
|
|
186
|
+
service_data["version"].append(
|
|
187
|
+
app["spec"]["source"]["targetRevision"]
|
|
188
|
+
)
|
|
189
|
+
service_data["ready"].append(is_ready)
|
|
190
|
+
service_data["deployed"].append(
|
|
191
|
+
datetime.strftime(time_stamp, TIME_FORMAT)
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
services_df = polars.from_dict(service_data, schema=ServicesSchema)
|
|
181
195
|
|
|
182
196
|
if running_only:
|
|
183
197
|
services_df = services_df.filter(polars.col("ready").eq(True))
|
|
@@ -29,7 +29,7 @@ sample_data = {
|
|
|
29
29
|
"version": ["1.0." + str(25 - cnt) for cnt in range(NUM_SERVICES)],
|
|
30
30
|
"ready": [True] * NUM_SERVICES,
|
|
31
31
|
"deployed": [
|
|
32
|
-
process_t(f"2024-10-22T11:23:0{randrange(1,9
|
|
32
|
+
process_t(f"2024-10-22T11:23:0{randrange(1, 9)}Z")
|
|
33
33
|
for cnt in range(NUM_SERVICES)
|
|
34
34
|
],
|
|
35
35
|
}
|
{edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/helm.py
RENAMED
|
@@ -87,7 +87,7 @@ class Helm:
|
|
|
87
87
|
with open("Chart.yaml") as fp:
|
|
88
88
|
chart_yaml = YAML(typ="safe").load(fp)
|
|
89
89
|
package_path = (
|
|
90
|
-
service_folder / f
|
|
90
|
+
service_folder / f"{chart_yaml['name']}-{chart_yaml['version']}.tgz"
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
# use helm to install the chart
|
{edge_containers_cli-4.2.2 → edge_containers_cli-4.3.0}/src/edge_containers_cli/cmds/k8s_commands.py
RENAMED
|
@@ -124,34 +124,46 @@ class K8sCommands(Commands):
|
|
|
124
124
|
f'kubectl get statefulset -l "is_ioc==true" -n {self.target} -o yaml',
|
|
125
125
|
)
|
|
126
126
|
sts_dicts = YAML(typ="safe").load(kubectl_res)
|
|
127
|
-
if not sts_dicts["items"]:
|
|
128
|
-
raise CommandError(f"No ec-services found in {self.target}")
|
|
129
127
|
service_data = {
|
|
130
128
|
"name": [], # type: ignore
|
|
131
129
|
"ready": [],
|
|
132
130
|
"deployed": [],
|
|
133
131
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
132
|
+
if sts_dicts["items"]:
|
|
133
|
+
for sts in sts_dicts["items"]:
|
|
134
|
+
name = sts["metadata"]["name"]
|
|
135
|
+
time_stamp = datetime.strptime(
|
|
136
|
+
sts["metadata"]["creationTimestamp"], "%Y-%m-%dT%H:%M:%SZ"
|
|
137
|
+
)
|
|
138
|
+
try:
|
|
139
|
+
is_ready = bool(sts["status"]["readyReplicas"])
|
|
140
|
+
except KeyError: # Not ready if doesnt exist
|
|
141
|
+
is_ready = False
|
|
142
|
+
|
|
143
|
+
# Fill app data
|
|
144
|
+
service_data["name"].append(name)
|
|
145
|
+
service_data["ready"].append(is_ready)
|
|
146
|
+
service_data["deployed"].append(
|
|
147
|
+
datetime.strftime(time_stamp, TIME_FORMAT)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
services_df = polars.from_dict(
|
|
151
|
+
service_data,
|
|
152
|
+
schema=polars.Schema(
|
|
153
|
+
{
|
|
154
|
+
"name": polars.String,
|
|
155
|
+
"ready": polars.Boolean,
|
|
156
|
+
"deployed": polars.String,
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
)
|
|
150
160
|
|
|
151
161
|
# Adds the version for all services
|
|
152
162
|
helm_out = str(shell.run_command(f"helm list -n {self.target} -o json"))
|
|
153
163
|
if helm_out == "[]\n":
|
|
154
|
-
helm_df = polars.DataFrame(
|
|
164
|
+
helm_df = polars.DataFrame(
|
|
165
|
+
schema=polars.Schema({"name": polars.String, "version": polars.String})
|
|
166
|
+
)
|
|
155
167
|
else:
|
|
156
168
|
helm_df = polars.read_json(StringIO(str(helm_out)))
|
|
157
169
|
helm_df = helm_df.rename({"app_version": "version"})
|