konduktor-nightly 0.1.0.dev20250909104711__tar.gz → 0.1.0.dev20250910100913__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 konduktor-nightly might be problematic. Click here for more details.
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/PKG-INFO +1 -1
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/__init__.py +2 -2
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/jobset_utils.py +6 -1
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/kube_client.py +58 -6
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/kubernetes_utils.py +36 -5
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/log_utils.py +27 -2
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/loki_utils.py +13 -1
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/schemas.py +7 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/pyproject.toml +1 -1
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/LICENSE +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/README.md +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/adaptors/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/adaptors/aws.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/adaptors/common.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/adaptors/gcp.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/authentication.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/backend.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/deployment.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/deployment_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/jobset.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/backends/pod_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/check.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/cli.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/config.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/controller/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/controller/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/controller/launch.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/controller/node.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/controller/parse.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/README.md +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/backend/main.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/backend/sockets.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/.eslintrc.json +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/.gitignore +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/api/jobs/route.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/api/namespaces/route.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/Grafana.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/JobsData.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/LogsData.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/NavMenu.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/NavTabs.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/NavTabs2.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/SelectBtn.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/lib/utils.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/ui/chip-select.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/ui/input.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/ui/navigation-menu.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/components/ui/select.jsx +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/favicon.ico +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/globals.css +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/jobs/page.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/layout.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/logs/page.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/app/page.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/jsconfig.json +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/next.config.mjs +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/package-lock.json +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/package.json +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/postcss.config.mjs +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/server.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/dashboard/frontend/tailwind.config.js +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/aws/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/aws/s3.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/data_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/gcp/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/gcp/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/gcp/gcs.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/gcp/utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/registry.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/storage.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/data/storage_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/execution.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/logging.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/apoxy-setup.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/apoxy-setup2.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/controller_deployment.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/dashboard_deployment.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/dmesg_daemonset.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/manifests/pod_cleanup_controller.yaml +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/resource.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/serving.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/task.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/templates/apoxy-deployment.yaml.j2 +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/templates/deployment.yaml.j2 +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/templates/jobset.yaml.j2 +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/templates/pod.yaml.j2 +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/usage/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/usage/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/__init__.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/accelerator_registry.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/annotations.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/base64_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/common_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/constants.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/env_options.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/exceptions.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/kubernetes_enums.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/rich_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/subprocess_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/ux_utils.py +0 -0
- {konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/konduktor/utils/validator.py +0 -0
|
@@ -11,7 +11,7 @@ from konduktor.task import Task
|
|
|
11
11
|
__all__ = ['launch', 'Resources', 'Task', 'Serving']
|
|
12
12
|
|
|
13
13
|
# Replaced with the current commit when building the wheels.
|
|
14
|
-
_KONDUKTOR_COMMIT_SHA = '
|
|
14
|
+
_KONDUKTOR_COMMIT_SHA = 'ca586c26e1db34e0b199c9fa57e84b39983db15e'
|
|
15
15
|
os.makedirs(os.path.expanduser('~/.konduktor'), exist_ok=True)
|
|
16
16
|
|
|
17
17
|
|
|
@@ -45,5 +45,5 @@ def _get_git_commit():
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
__commit__ = _get_git_commit()
|
|
48
|
-
__version__ = '1.0.0.dev0.1.0.
|
|
48
|
+
__version__ = '1.0.0.dev0.1.0.dev20250910100913'
|
|
49
49
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
|
@@ -117,7 +117,12 @@ def create_jobset(
|
|
|
117
117
|
)
|
|
118
118
|
logger.info(
|
|
119
119
|
f'task {colorama.Fore.CYAN}{colorama.Style.BRIGHT}'
|
|
120
|
-
f'{
|
|
120
|
+
f'{colorama.Fore.CYAN}{colorama.Style.BRIGHT}{task.name}'
|
|
121
|
+
f'{colorama.Style.RESET_ALL} created in context '
|
|
122
|
+
f'{colorama.Fore.YELLOW}{colorama.Style.BRIGHT}{context}'
|
|
123
|
+
f'{colorama.Style.RESET_ALL}, namespace '
|
|
124
|
+
f'{colorama.Fore.GREEN}{colorama.Style.BRIGHT}{namespace}'
|
|
125
|
+
f'{colorama.Style.RESET_ALL}'
|
|
121
126
|
)
|
|
122
127
|
return jobset
|
|
123
128
|
except kube_client.api_exception() as err:
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
-
from typing import Any, Callable, Optional
|
|
3
|
+
from typing import Any, Callable, List, Optional
|
|
4
4
|
|
|
5
5
|
import kubernetes
|
|
6
6
|
import urllib3
|
|
7
7
|
|
|
8
|
+
from konduktor import config
|
|
8
9
|
from konduktor import logging as konduktor_logging
|
|
9
10
|
from konduktor.utils import annotations, ux_utils
|
|
10
11
|
|
|
@@ -20,6 +21,10 @@ DEFAULT_IN_CLUSTER_REGION = 'in-cluster'
|
|
|
20
21
|
# set to DEFAULT_IN_CLUSTER_REGION.
|
|
21
22
|
IN_CLUSTER_CONTEXT_NAME_ENV_VAR = 'KONDUKTOR_IN_CLUSTER_CONTEXT_NAME'
|
|
22
23
|
|
|
24
|
+
# Tracks the most recently selected/loaded context name.
|
|
25
|
+
# None means no explicit context was resolved/loaded yet.
|
|
26
|
+
_ACTIVE_CONTEXT: Optional[str] = None
|
|
27
|
+
|
|
23
28
|
|
|
24
29
|
def _decorate_methods(obj: Any, decorator: Callable, decoration_type: str):
|
|
25
30
|
for attr_name in dir(obj):
|
|
@@ -54,12 +59,37 @@ def _api_logging_decorator(logger: str, level: int):
|
|
|
54
59
|
def _load_config(context: Optional[str] = None):
|
|
55
60
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
56
61
|
|
|
62
|
+
# If no context explicitly provided, prefer the configured allowed context
|
|
63
|
+
# (first element) when present. This ensures the client defaults to the
|
|
64
|
+
# user-specified context instead of kubeconfig's current-context.
|
|
65
|
+
effective_context = context
|
|
66
|
+
allowed_contexts: List[str] = config.get_nested(
|
|
67
|
+
('kubernetes', 'allowed_contexts'), []
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
is_allowed_selected = False
|
|
71
|
+
if effective_context is None and allowed_contexts:
|
|
72
|
+
effective_context = allowed_contexts[0]
|
|
73
|
+
is_allowed_selected = True
|
|
74
|
+
logger.info(
|
|
75
|
+
'Detected kubernetes.allowed_contexts in config; using context: %s',
|
|
76
|
+
effective_context,
|
|
77
|
+
)
|
|
78
|
+
|
|
57
79
|
def _load_config_from_kubeconfig(context: Optional[str] = None):
|
|
58
80
|
try:
|
|
59
81
|
kubernetes.config.load_kube_config(context=context)
|
|
60
82
|
except kubernetes.config.config_exception.ConfigException as e:
|
|
61
|
-
#
|
|
62
|
-
|
|
83
|
+
# Improve error when a configured allowed context cannot be loaded
|
|
84
|
+
msg = str(e)
|
|
85
|
+
if is_allowed_selected and context is not None:
|
|
86
|
+
err_str = (
|
|
87
|
+
'Configured Kubernetes context not usable: '
|
|
88
|
+
f'kubernetes.allowed_contexts[0] = {context!r}. '
|
|
89
|
+
'Please ensure this context exists and is valid in your '
|
|
90
|
+
'kubeconfig (typically at ~/.kube/config).'
|
|
91
|
+
)
|
|
92
|
+
elif 'Expected key current-context' in msg:
|
|
63
93
|
err_str = (
|
|
64
94
|
f'Failed to load Kubernetes configuration for {context!r}. '
|
|
65
95
|
'Kubeconfig does not contain any valid context(s).\n'
|
|
@@ -73,7 +103,8 @@ def _load_config(context: Optional[str] = None):
|
|
|
73
103
|
with ux_utils.print_exception_no_traceback():
|
|
74
104
|
raise ValueError(err_str) from None
|
|
75
105
|
|
|
76
|
-
|
|
106
|
+
global _ACTIVE_CONTEXT
|
|
107
|
+
if effective_context == in_cluster_context_name() or effective_context is None:
|
|
77
108
|
try:
|
|
78
109
|
# Load in-cluster config if running in a pod and context is None.
|
|
79
110
|
# Kubernetes set environment variables for service discovery do not
|
|
@@ -83,10 +114,22 @@ def _load_config(context: Optional[str] = None):
|
|
|
83
114
|
os.environ['KUBERNETES_SERVICE_HOST'] = 'kubernetes.default.svc'
|
|
84
115
|
os.environ['KUBERNETES_SERVICE_PORT'] = '443'
|
|
85
116
|
kubernetes.config.load_incluster_config()
|
|
117
|
+
_ACTIVE_CONTEXT = in_cluster_context_name()
|
|
86
118
|
except kubernetes.config.config_exception.ConfigException:
|
|
87
|
-
|
|
119
|
+
# If allowed_contexts was specified, do not fall back silently.
|
|
120
|
+
if is_allowed_selected:
|
|
121
|
+
_load_config_from_kubeconfig(effective_context)
|
|
122
|
+
else:
|
|
123
|
+
_load_config_from_kubeconfig()
|
|
124
|
+
# Best effort: set active context to current-context from kubeconfig
|
|
125
|
+
try:
|
|
126
|
+
_, current_ctx = kubernetes.config.list_kube_config_contexts()
|
|
127
|
+
_ACTIVE_CONTEXT = current_ctx.get('name') if current_ctx else None
|
|
128
|
+
except kubernetes.config.config_exception.ConfigException:
|
|
129
|
+
_ACTIVE_CONTEXT = None
|
|
88
130
|
else:
|
|
89
|
-
_load_config_from_kubeconfig(
|
|
131
|
+
_load_config_from_kubeconfig(effective_context)
|
|
132
|
+
_ACTIVE_CONTEXT = effective_context
|
|
90
133
|
|
|
91
134
|
|
|
92
135
|
@_api_logging_decorator('urllib3', logging.ERROR)
|
|
@@ -183,3 +226,12 @@ def in_cluster_context_name() -> Optional[str]:
|
|
|
183
226
|
context name.
|
|
184
227
|
"""
|
|
185
228
|
return os.environ.get(IN_CLUSTER_CONTEXT_NAME_ENV_VAR) or DEFAULT_IN_CLUSTER_REGION
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def get_active_context() -> Optional[str]:
|
|
232
|
+
"""Returns the last context selected by the client loader.
|
|
233
|
+
|
|
234
|
+
This reflects the effective context used by the most recent client init.
|
|
235
|
+
May be None if no client has been initialized yet.
|
|
236
|
+
"""
|
|
237
|
+
return _ACTIVE_CONTEXT
|
|
@@ -264,11 +264,31 @@ AUTOSCALER_TO_LABEL_FORMATTER = {
|
|
|
264
264
|
|
|
265
265
|
@functools.lru_cache()
|
|
266
266
|
def get_current_kube_config_context_name() -> Optional[str]:
|
|
267
|
-
"""Get the
|
|
267
|
+
"""Get the active Kubernetes context name.
|
|
268
|
+
|
|
269
|
+
Precedence:
|
|
270
|
+
1) The first entry in `kubernetes.allowed_contexts` (if configured).
|
|
271
|
+
2) kubeconfig's current-context (fallback when not configured).
|
|
268
272
|
|
|
269
273
|
Returns:
|
|
270
|
-
str | None: The
|
|
274
|
+
str | None: The selected context if it exists, None otherwise.
|
|
271
275
|
"""
|
|
276
|
+
# 1) Prefer a user-configured allowed context if provided.
|
|
277
|
+
try:
|
|
278
|
+
allowed_contexts: Optional[List[str]] = config.get_nested(
|
|
279
|
+
('kubernetes', 'allowed_contexts'), None
|
|
280
|
+
)
|
|
281
|
+
if allowed_contexts:
|
|
282
|
+
context = allowed_contexts[0]
|
|
283
|
+
logger.info(
|
|
284
|
+
'Detected kubernetes.allowed_contexts in config; using context: %s',
|
|
285
|
+
context,
|
|
286
|
+
)
|
|
287
|
+
return context
|
|
288
|
+
except Exception: # fallback safely if config loading fails unexpectedly
|
|
289
|
+
pass
|
|
290
|
+
|
|
291
|
+
# 2) Fall back to kubeconfig's current context
|
|
272
292
|
k8s = kubernetes
|
|
273
293
|
try:
|
|
274
294
|
_, current_context = k8s.config.list_kube_config_contexts()
|
|
@@ -336,13 +356,24 @@ def get_kube_config_context_namespace(context_name: Optional[str] = None) -> str
|
|
|
336
356
|
"""
|
|
337
357
|
k8s = kubernetes
|
|
338
358
|
ns_path = '/var/run/secrets/kubernetes.io/serviceaccount/namespace'
|
|
339
|
-
|
|
340
|
-
#
|
|
341
|
-
|
|
359
|
+
|
|
360
|
+
# If no explicit context provided, prefer configured allowed context first.
|
|
361
|
+
if context_name is None:
|
|
362
|
+
try:
|
|
363
|
+
allowed_contexts: Optional[List[str]] = config.get_nested(
|
|
364
|
+
('kubernetes', 'allowed_contexts'), None
|
|
365
|
+
)
|
|
366
|
+
if allowed_contexts:
|
|
367
|
+
context_name = allowed_contexts[0]
|
|
368
|
+
except Exception:
|
|
369
|
+
pass
|
|
370
|
+
|
|
371
|
+
# If using in-cluster context, get the namespace from the SA namespace file.
|
|
342
372
|
if context_name == kube_client.in_cluster_context_name() or context_name is None:
|
|
343
373
|
if os.path.exists(ns_path):
|
|
344
374
|
with open(ns_path, encoding='utf-8') as f:
|
|
345
375
|
return f.read().strip()
|
|
376
|
+
|
|
346
377
|
# If not in-cluster, get the namespace from kubeconfig
|
|
347
378
|
try:
|
|
348
379
|
contexts, current_context = k8s.config.list_kube_config_contexts()
|
|
@@ -170,6 +170,29 @@ def create_table(field_names: List[str], **kwargs) -> prettytable.PrettyTable:
|
|
|
170
170
|
return table
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
def _get_kr8s_api():
|
|
174
|
+
"""Return a kr8s API configured for the selected context.
|
|
175
|
+
|
|
176
|
+
Honors kubernetes.allowed_contexts via
|
|
177
|
+
get_current_kube_config_context_name(). Fails with a clear error if a
|
|
178
|
+
configured context cannot be initialized.
|
|
179
|
+
"""
|
|
180
|
+
ctx = kubernetes_utils.get_current_kube_config_context_name()
|
|
181
|
+
try:
|
|
182
|
+
# kr8s exposes a factory function `api(...)` that accepts context.
|
|
183
|
+
api = kr8s.api(context=ctx) if ctx else kr8s.api()
|
|
184
|
+
if ctx:
|
|
185
|
+
logger.debug('Initialized kr8s API for context: %s', ctx)
|
|
186
|
+
return api
|
|
187
|
+
except Exception as e: # defensive: surface a clear error if context fails
|
|
188
|
+
if ctx:
|
|
189
|
+
raise ValueError(
|
|
190
|
+
'Failed to initialize kr8s client for context '
|
|
191
|
+
f'{ctx!r}. Ensure the context exists and your kubeconfig is valid.'
|
|
192
|
+
) from e
|
|
193
|
+
raise
|
|
194
|
+
|
|
195
|
+
|
|
173
196
|
def run_with_log(
|
|
174
197
|
cmd: Union[List[str], str],
|
|
175
198
|
log_path: str,
|
|
@@ -311,7 +334,8 @@ def tail_loki_logs_ws(
|
|
|
311
334
|
# until we reach the end of the log and then invoke tail again.
|
|
312
335
|
# Also include checks that the job is running/ever ran.
|
|
313
336
|
raise ValueError('num_logs must be less than or equal to 5000')
|
|
314
|
-
|
|
337
|
+
api = _get_kr8s_api()
|
|
338
|
+
loki_svc = kr8s.objects.Service.get('loki', namespace='loki', api=api)
|
|
315
339
|
with kr8s.portforward.PortForward(
|
|
316
340
|
loki_svc, LOKI_REMOTE_PORT, local_port='auto'
|
|
317
341
|
) as port:
|
|
@@ -345,8 +369,9 @@ def tail_vicky_logs(
|
|
|
345
369
|
context = kubernetes_utils.get_current_kube_config_context_name()
|
|
346
370
|
namespace = kubernetes_utils.get_kube_config_context_namespace(context)
|
|
347
371
|
query: Dict[str, Any] = {}
|
|
372
|
+
api = _get_kr8s_api()
|
|
348
373
|
vicky_svc = kr8s.objects.Service.get(
|
|
349
|
-
'vls-victoria-logs-single-server', namespace='victoria-logs'
|
|
374
|
+
'vls-victoria-logs-single-server', namespace='victoria-logs', api=api
|
|
350
375
|
)
|
|
351
376
|
|
|
352
377
|
if num_logs == -1:
|
|
@@ -11,6 +11,7 @@ import kr8s
|
|
|
11
11
|
import websockets
|
|
12
12
|
|
|
13
13
|
from konduktor import logging
|
|
14
|
+
from konduktor.utils import kubernetes_utils
|
|
14
15
|
|
|
15
16
|
logger = logging.get_logger(__name__)
|
|
16
17
|
|
|
@@ -59,7 +60,18 @@ def tail_loki_logs_ws(
|
|
|
59
60
|
# until we reach the end of the log and then invoke tail again.
|
|
60
61
|
# Also include checks that the job is running/ever ran.
|
|
61
62
|
raise ValueError('num_logs must be less than or equal to 5000')
|
|
62
|
-
|
|
63
|
+
# Initialize kr8s API honoring allowed_contexts if configured.
|
|
64
|
+
ctx = kubernetes_utils.get_current_kube_config_context_name()
|
|
65
|
+
try:
|
|
66
|
+
api = kr8s.api(context=ctx) if ctx else kr8s.api()
|
|
67
|
+
except Exception as e:
|
|
68
|
+
if ctx:
|
|
69
|
+
raise ValueError(
|
|
70
|
+
'Failed to initialize kr8s client for context '
|
|
71
|
+
f'{ctx!r}. Ensure the context exists and your kubeconfig is valid.'
|
|
72
|
+
) from e
|
|
73
|
+
raise
|
|
74
|
+
loki_svc = kr8s.objects.Service.get('loki', namespace='loki', api=api)
|
|
63
75
|
with kr8s.portforward.PortForward(
|
|
64
76
|
loki_svc, LOKI_REMOTE_PORT, local_port='auto'
|
|
65
77
|
) as port:
|
|
@@ -504,6 +504,13 @@ def get_config_schema():
|
|
|
504
504
|
'anyOf': [{'required': ['name']}, {'required': ['namespace']}]
|
|
505
505
|
},
|
|
506
506
|
},
|
|
507
|
+
'allowed_contexts': {
|
|
508
|
+
'type': 'array',
|
|
509
|
+
'items': {
|
|
510
|
+
'type': 'string',
|
|
511
|
+
},
|
|
512
|
+
'maxItems': 1,
|
|
513
|
+
},
|
|
507
514
|
'provision_timeout': {
|
|
508
515
|
'type': 'integer',
|
|
509
516
|
},
|
{konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/LICENSE
RENAMED
|
File without changes
|
{konduktor_nightly-0.1.0.dev20250909104711 → konduktor_nightly-0.1.0.dev20250910100913}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|