kubernator 1.0.23.dev20251016050525__tar.gz → 1.0.24.dev20251028221359__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 kubernator might be problematic. Click here for more details.
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/PKG-INFO +1 -1
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/__init__.py +1 -1
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/api.py +64 -9
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/k8s.py +17 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/k8s_api.py +14 -5
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/kubectl.py +1 -2
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/PKG-INFO +1 -1
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/setup.py +1 -1
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/MANIFEST.in +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/LICENSE +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/__main__.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/_json_path.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/_k8s_client_patches.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/app.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/merge.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/__init__.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/awscli.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/eks.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/gke.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/helm.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/istio.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/kops.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/kubeconfig.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/minikube.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/template.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/terraform.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/plugins/terragrunt.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/proc.py +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/SOURCES.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/dependency_links.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/entry_points.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/namespace_packages.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/requires.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/top_level.txt +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator.egg-info/zip-safe +0 -0
- {kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kubernator
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.24.dev20251028221359
|
|
4
4
|
Summary: Kubernator is the a pluggable framework for K8S provisioning
|
|
5
5
|
Home-page: https://github.com/karellen/kubernator
|
|
6
6
|
Author: Express Systems USA, Inc.
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/api.py
RENAMED
|
@@ -20,10 +20,10 @@ import fnmatch
|
|
|
20
20
|
import json
|
|
21
21
|
import logging
|
|
22
22
|
import os
|
|
23
|
-
import io
|
|
24
23
|
import platform
|
|
25
24
|
import re
|
|
26
25
|
import sys
|
|
26
|
+
import textwrap
|
|
27
27
|
import traceback
|
|
28
28
|
import urllib.parse
|
|
29
29
|
from collections.abc import Callable
|
|
@@ -48,6 +48,7 @@ from jinja2 import (Environment,
|
|
|
48
48
|
pass_context)
|
|
49
49
|
from jsonschema import validators
|
|
50
50
|
from platformdirs import user_cache_dir
|
|
51
|
+
from yaml import MarkedYAMLError
|
|
51
52
|
|
|
52
53
|
from kubernator._json_path import jp # noqa: F401
|
|
53
54
|
from kubernator._k8s_client_patches import (URLLIB_HEADERS_PATCH,
|
|
@@ -59,6 +60,43 @@ _CACHE_HEADER_TRANSLATION = {"etag": "if-none-match",
|
|
|
59
60
|
_CACHE_HEADERS = ("etag", "last-modified")
|
|
60
61
|
|
|
61
62
|
|
|
63
|
+
def to_json(obj: Union[dict, list]):
|
|
64
|
+
return json.dumps(obj)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def to_yaml_str(s: str):
|
|
68
|
+
return repr(s)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def to_json_yaml_str(obj: Union[dict, list]):
|
|
72
|
+
"""
|
|
73
|
+
Takes `obj`, dumps as json representation, converts json representation to YAML string literal.
|
|
74
|
+
"""
|
|
75
|
+
return to_yaml_str(to_json(obj))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def to_yaml_str_block(s: str, indent: int = 4, pretty_indent: int = 2):
|
|
79
|
+
"""
|
|
80
|
+
Takes a multiline string, dedents it then indents it `indent` spaces for in-yaml alignment and
|
|
81
|
+
`pretty-indent` spaces for in-block alignment.
|
|
82
|
+
"""
|
|
83
|
+
return (f"|+{pretty_indent}\n" +
|
|
84
|
+
textwrap.indent(textwrap.dedent(s), " " * (indent + pretty_indent)))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def to_json_yaml_str_block(obj: Union[str, dict, list], indent: int = 4, pretty_indent=2):
|
|
88
|
+
"""
|
|
89
|
+
Takes an `obj`, serializes it as pretty JSON with `pretty_indent` in-json indentation and then
|
|
90
|
+
passes it to `to_yaml_str_block`.
|
|
91
|
+
"""
|
|
92
|
+
return to_yaml_str_block(json.dumps(obj, indent=pretty_indent), indent=indent, pretty_indent=pretty_indent)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def to_yaml(obj: Union[dict, list], level_indent: int, indent: int):
|
|
96
|
+
s = yaml.safe_dump(obj, indent=indent)
|
|
97
|
+
return "\n" + textwrap.indent(s, " " * level_indent)
|
|
98
|
+
|
|
99
|
+
|
|
62
100
|
class TemplateEngine:
|
|
63
101
|
VARIABLE_START_STRING = "{${"
|
|
64
102
|
VARIABLE_END_STRING = "}$}"
|
|
@@ -97,7 +135,15 @@ class TemplateEngine:
|
|
|
97
135
|
variable_end_string=self.VARIABLE_END_STRING,
|
|
98
136
|
autoescape=False,
|
|
99
137
|
finalize=variable_finalizer,
|
|
100
|
-
undefined=logging_undefined
|
|
138
|
+
undefined=logging_undefined,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
self.env.filters["to_json"] = to_json
|
|
142
|
+
self.env.filters["to_yaml_str"] = to_yaml_str
|
|
143
|
+
self.env.filters["to_yaml"] = to_yaml
|
|
144
|
+
self.env.filters["to_yaml_str_block"] = to_yaml_str_block
|
|
145
|
+
self.env.filters["to_json_yaml_str_block"] = to_json_yaml_str_block
|
|
146
|
+
self.env.filters["to_json_yaml_str"] = to_json_yaml_str
|
|
101
147
|
|
|
102
148
|
def from_string(self, template):
|
|
103
149
|
return self.env.from_string(template)
|
|
@@ -136,9 +182,18 @@ def scan_dir(logger, path: Path, path_filter: Callable[[os.DirEntry], bool], exc
|
|
|
136
182
|
yield path / f
|
|
137
183
|
|
|
138
184
|
|
|
185
|
+
def parse_yaml_docs(document: str, source=None):
|
|
186
|
+
try:
|
|
187
|
+
return list(d for d in yaml.safe_load_all(document) if d)
|
|
188
|
+
except MarkedYAMLError:
|
|
189
|
+
raise
|
|
190
|
+
|
|
191
|
+
|
|
139
192
|
class FileType(Enum):
|
|
140
|
-
|
|
141
|
-
|
|
193
|
+
TEXT = (lambda x: x,)
|
|
194
|
+
BINARY = (lambda x: x,)
|
|
195
|
+
JSON = (json.loads,)
|
|
196
|
+
YAML = (parse_yaml_docs,)
|
|
142
197
|
|
|
143
198
|
def __init__(self, func):
|
|
144
199
|
self.func = func
|
|
@@ -147,13 +202,13 @@ class FileType(Enum):
|
|
|
147
202
|
def _load_file(logger, path: Path, file_type: FileType, source=None,
|
|
148
203
|
template_engine: Optional[TemplateEngine] = None,
|
|
149
204
|
template_context: Optional[dict] = None) -> Iterable[dict]:
|
|
150
|
-
with open(path, "rb" if
|
|
205
|
+
with open(path, "rb" if file_type == FileType.BINARY else "rt") as f:
|
|
151
206
|
try:
|
|
152
|
-
if template_engine:
|
|
207
|
+
if template_engine and not file_type == FileType.BINARY:
|
|
153
208
|
raw_data = template_engine.from_string(f.read()).render(template_context)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
data = file_type.func(
|
|
209
|
+
else:
|
|
210
|
+
raw_data = f.read()
|
|
211
|
+
data = file_type.func(raw_data)
|
|
157
212
|
if isinstance(data, GeneratorType):
|
|
158
213
|
data = list(data)
|
|
159
214
|
return data
|
|
@@ -112,6 +112,7 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
112
112
|
|
|
113
113
|
self._transformers = []
|
|
114
114
|
self._validators = []
|
|
115
|
+
self._manifest_patchers = []
|
|
115
116
|
self._summary = 0, 0, 0
|
|
116
117
|
self._template_engine = TemplateEngine(logger)
|
|
117
118
|
|
|
@@ -150,6 +151,7 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
150
151
|
add_transformer=self.api_add_transformer,
|
|
151
152
|
remove_transformer=self.api_remove_transformer,
|
|
152
153
|
add_validator=self.api_remove_validator,
|
|
154
|
+
add_manifest_patcher=self.api_add_manifest_patcher,
|
|
153
155
|
get_api_versions=self.get_api_versions,
|
|
154
156
|
create_resource=self.create_resource,
|
|
155
157
|
disable_client_patches=disable_client_patches,
|
|
@@ -373,6 +375,10 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
373
375
|
if validator not in self._validators:
|
|
374
376
|
self._validators.append(validator)
|
|
375
377
|
|
|
378
|
+
def api_add_manifest_patcher(self, patcher):
|
|
379
|
+
if patcher not in self._manifest_patchers:
|
|
380
|
+
self._manifest_patchers.append(patcher)
|
|
381
|
+
|
|
376
382
|
def api_remove_transformer(self, transformer):
|
|
377
383
|
if transformer in self._transformers:
|
|
378
384
|
self._transformers.remove(transformer)
|
|
@@ -391,6 +397,17 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
391
397
|
frame = frame.f_back
|
|
392
398
|
return ValueError((msg % args) if args else msg).with_traceback(tb)
|
|
393
399
|
|
|
400
|
+
def _patch_manifest(self,
|
|
401
|
+
manifest: dict,
|
|
402
|
+
resource_description: str):
|
|
403
|
+
for patcher in reversed(self._manifest_patchers):
|
|
404
|
+
logger.debug("Applying patcher %s to %s",
|
|
405
|
+
getattr(patcher, "__name__", patcher),
|
|
406
|
+
resource_description)
|
|
407
|
+
manifest = patcher(manifest, resource_description) or manifest
|
|
408
|
+
|
|
409
|
+
return manifest
|
|
410
|
+
|
|
394
411
|
def _transform_resource(self, resources: Sequence[K8SResource], resource: K8SResource) -> K8SResource:
|
|
395
412
|
for transformer in reversed(self._transformers):
|
|
396
413
|
logger.debug("Applying transformer %s to %s from %s",
|
|
@@ -23,7 +23,6 @@ from collections import namedtuple
|
|
|
23
23
|
from collections.abc import Callable, Mapping, MutableMapping, Sequence, Iterable
|
|
24
24
|
from enum import Enum, auto
|
|
25
25
|
from functools import partial
|
|
26
|
-
from io import StringIO
|
|
27
26
|
from pathlib import Path
|
|
28
27
|
from typing import Union, Optional
|
|
29
28
|
|
|
@@ -34,7 +33,7 @@ from jsonschema.exceptions import ValidationError
|
|
|
34
33
|
from jsonschema.validators import extend, Draft7Validator
|
|
35
34
|
from openapi_schema_validator import OAS31Validator
|
|
36
35
|
|
|
37
|
-
from kubernator.api import load_file, FileType, load_remote_file, calling_frame_source
|
|
36
|
+
from kubernator.api import load_file, FileType, load_remote_file, calling_frame_source, parse_yaml_docs
|
|
38
37
|
|
|
39
38
|
K8S_WARNING_HEADER = re.compile(r'(?:,\s*)?(\d{3})\s+(\S+)\s+"(.+?)(?<!\\)"(?:\s+\"(.+?)(?<!\\)\")?\s*')
|
|
40
39
|
UPPER_FOLLOWED_BY_LOWER_RE = re.compile(r"(.)([A-Z][a-z]+)")
|
|
@@ -524,7 +523,7 @@ class K8SResourcePluginMixin:
|
|
|
524
523
|
source = calling_frame_source()
|
|
525
524
|
|
|
526
525
|
if isinstance(manifests, str):
|
|
527
|
-
manifests = list(
|
|
526
|
+
manifests = list(parse_yaml_docs(manifests, source))
|
|
528
527
|
|
|
529
528
|
if isinstance(manifests, (Mapping, dict)):
|
|
530
529
|
return self.add_resource(manifests, source)
|
|
@@ -557,7 +556,7 @@ class K8SResourcePluginMixin:
|
|
|
557
556
|
source = calling_frame_source()
|
|
558
557
|
|
|
559
558
|
if isinstance(manifests, str):
|
|
560
|
-
manifests = list(
|
|
559
|
+
manifests = list(parse_yaml_docs(manifests, source))
|
|
561
560
|
|
|
562
561
|
if isinstance(manifests, (Mapping, dict)):
|
|
563
562
|
return self.add_crd(manifests, source)
|
|
@@ -614,8 +613,13 @@ class K8SResourcePluginMixin:
|
|
|
614
613
|
|
|
615
614
|
def _create_resource(self, manifest: dict, source: Union[str, Path] = None):
|
|
616
615
|
resource_description = K8SResource.get_manifest_description(manifest, source)
|
|
617
|
-
self.logger.debug("Validating K8S manifest for %s", resource_description)
|
|
618
616
|
|
|
617
|
+
new_manifest = self._patch_manifest(manifest, resource_description)
|
|
618
|
+
if new_manifest != manifest:
|
|
619
|
+
manifest = new_manifest
|
|
620
|
+
resource_description = K8SResource.get_manifest_description(manifest, source)
|
|
621
|
+
|
|
622
|
+
self.logger.debug("Validating K8S manifest for %s", resource_description)
|
|
619
623
|
errors = list(self._validate_resource(manifest, source))
|
|
620
624
|
if errors:
|
|
621
625
|
for error in errors:
|
|
@@ -644,6 +648,11 @@ class K8SResourcePluginMixin:
|
|
|
644
648
|
|
|
645
649
|
return resource
|
|
646
650
|
|
|
651
|
+
def _patch_manifest(self,
|
|
652
|
+
manifest: dict,
|
|
653
|
+
resource_description: str):
|
|
654
|
+
return manifest
|
|
655
|
+
|
|
647
656
|
def _transform_resource(self,
|
|
648
657
|
resources: Sequence[K8SResource],
|
|
649
658
|
resource: K8SResource) -> K8SResource:
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
-
import io
|
|
20
19
|
import json
|
|
21
20
|
import logging
|
|
22
21
|
import os
|
|
@@ -121,7 +120,7 @@ class KubectlPlugin(KubernatorPlugin):
|
|
|
121
120
|
args += ["-n", namespace]
|
|
122
121
|
args += ["-o", "yaml"]
|
|
123
122
|
|
|
124
|
-
res = list(yaml.safe_load_all(
|
|
123
|
+
res = list(yaml.safe_load_all(self.context.kubectl.run_capturing(*args)))
|
|
125
124
|
if len(res):
|
|
126
125
|
if len(res) > 1:
|
|
127
126
|
return res
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kubernator
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.24.dev20251028221359
|
|
4
4
|
Summary: Kubernator is the a pluggable framework for K8S provisioning
|
|
5
5
|
Home-page: https://github.com/karellen/kubernator
|
|
6
6
|
Author: Express Systems USA, Inc.
|
|
@@ -21,7 +21,7 @@ class install(_install):
|
|
|
21
21
|
if __name__ == '__main__':
|
|
22
22
|
setup(
|
|
23
23
|
name = 'kubernator',
|
|
24
|
-
version = '1.0.
|
|
24
|
+
version = '1.0.24.dev20251028221359',
|
|
25
25
|
description = 'Kubernator is the a pluggable framework for K8S provisioning',
|
|
26
26
|
long_description = '# Kubernator\n\nKubernator™ (Ktor™) is an integrated solution for the Kubernetes state management. It operates on directories,\nprocessing their content via a collection of plugins, generating Kubernetes resources in the process, validating them,\ntransforming them and then applying against the Kubernetes cluster.\n\n[](https://gitter.im/karellen/Lobby)\n[](https://github.com/karellen/kubernator/actions/workflows/kubernator.yml)\n[](https://coveralls.io/r/karellen/kubernator?branch=master)\n\n[](https://pypi.org/project/kubernator/)\n[](https://pypi.org/project/kubernator/)\n[](https://pypi.org/project/kubernator/)\n[](https://pypi.org/project/kubernator/)\n[](https://pypi.org/project/kubernator/)\n\n## Notices\n\n### Beta Software\n\nWhile fully functional in the current state and used in production, this software is in **BETA**. A lot of things\nare expected to change rapidly, including main APIs, initialization procedures and some core features. Documentation at\nthis stage is basically non-existent.\n\n### License\n\nThe product is licensed under the Apache License, Version 2.0. Please see LICENSE for further details.\n\n### Warranties and Liability\n\nKubernator and its plugins are provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\nexpress or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,\nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of\nusing or redistributing Kubernator and assume any risks associated with doing so.\n\n### Trademarks\n\n"Kubernator" and "Ktor" are trademarks or registered trademarks of Express Systems USA, Inc and Karellen, Inc. All other\ntrademarks are property of their respective owners.\n\n## Problem Statement\n\n## Solution\n\n## Using Kubernator with Docker\n\nA simple example is as follows:\n```\n$ docker run --mount type=bind,source="$(pwd)",target=/root,readonly -t ghcr.io/karellen/kubernator:latest\n```\n\n## Using Kubernator on MacOS\n\n```\n$ brew install python3.11\n$ pip3.11 install \'kubernator~=1.0.9\'\n$ kubernator --version\n```\n\nPlease note, that some plugins (e.g. `awscli`, `eks`) may require additional volume mounts or environmental\nvariables to be passed for credentials and other external configuration.\n\n## Mode of Operation\n\nKubernator is a command line utility. Upon startup and processing of the command line arguments and initializing\nlogging, Kubernator initializes plugins. Current plugins include:\n\n0. Kubernator App\n1. Terraform\n2. kOps\n3. Kubernetes\n4. Helm\n5. Template\n\nThe order of initialization matters as it\'s the order the plugin handlers are executed!\n\nThe entire application operates in the following stages by invoking each plugin\'s stage handler in sequence:\n\n1. Plugin Init Stage\n2. Pre-start script (if specified)\n3. Plugin Start Stage\n4. For each directory in the pipeline:\n 1. Plugin Before Directory Stage\n 2. If `.kubernator.py` is present in the directory:\n 1. Plugin Before Script Stage\n 2. `.kubernator.py` script\n 3. Plugin After Script Stage\n 3. Plugin After Directory Stage\n5. Plugin End Stage\n\nEach plugin individually plays a specific role and performs a specific function which will be described in a later\nsection.\n\n## State/Context\n\nThere is a global state that is carried through as the application is running. It is a hierarchy of objects (`context`)\nthat follows the parent-child relationship as the application traverses the directory structure. For example, given the\ndirectory structure `/a/b`, `/a/c`, and `/a/c/d` any value of the context set or modified in context scoped to\ndirectory `/a` is visible in directories `/a/b`, `/a/c` and `/a/c/d`, while the same modified or set in `/a/b` is only\nvisible there, while one in `/a/c` is visible in `/a/c` and in `/a/c/d` but not `/a` or `/a/b`.\n\nAdditionally, there is a `context.globals` which is the top-most context that is available in all stages that are not\nassociated with the directory structure.\n\nNote, that in cases where the directory structure traversal moves to remote directories (that are actualized by local\ntemporary directories), such remote directory structure enters the context hierarchy as a child of the directory in\nwhich remote was registered.\n\nAlso note, that context carries not just data by references to essential functions.\n\nIn pre-start and `.kubernator.py` scripts the context is fully available as a global variable `ktor`.\n\n### Plugins\n\n#### Kubernator App Plugin\n\nThe role of the Kubernator App Plugin is to traverse the directory structure, expose essential functions through context\nand to run Kubernator scripts.\n\nIn the *After Directory Stage* Kubernator app scans the directories immediately available in the current, sorts them in\nthe alphabetic order, excludes those matching any of the patterns in `context.app.excludes` and then queues up the\nremaining directories in the order the match the patterns in `context.app.includes`.\n\nThus, for a directory content `/a/foo`, `/a/bal`, `/a/bar`, `/a/baz`, excludes `f*`, and includes `baz` and `*`, the\nresulting queue of directories to traverse will be `/a/baz`, `/a/bal`, `/a/bar`.\n\nNotice, that user can further interfere with processing order of the directory queue by asking Kubernator to walk\narbitrary paths, both local and remote.\n\n##### Context\n\n* `ktor.app.args`\n > Namespace containing command line argument values\n* `ktor.app.walk_local(*paths: Union[Path, str, bytes])`\n > Immediately schedules the paths to be traversed after the current directory by adding them to the queue\n > Relative path is relative to the current directory\n* `ktor.app.walk_remote(repo, *path_prefixes: Union[Path, str, bytes])`\n > Immediately schedules the path prefixes under the remote repo URL to be traversed after the current directory by\n > adding them to the queue. Only Git URLs are currently supported.\n > All absolute path prefixes are relativized based on the repository.\n* `ktor.app.repository_credentials_provider(func: Callable)`\n > Sets a repository credentials provider function `func` that sets/overwrites credentials for URLs being specified by\n > `walk_remote`. The callable `func` accepts a single argument containing a parsed URL in a form of tuple. The `func`\n > is expected to return a tuple of three elements representing URL schema, username and password. If the value should\n > not be changed it should be None. To convert from `git://repo.com/hello` to HTTPS authentication one should write\n > a function returning `("https", "username", "password")`. The best utility is achieved by logic that allows running\n > the plan both in CI and local environments using different authentication mechanics in different environments.\n\n#### Terraform\n\nThis is exclusively designed to pull the configuration options out of Terraform and to allow scripts and plugins to\nutilize that data.\n\n##### Context\n\n* `ktor.tf`\n > A dictionary containing the values from Terraform output\n\n#### Kops\n\n##### Context\n\n#### Kubernetes\n\n##### Context\n\n#### Helm\n\n##### Context\n\n#### Templates\n\n##### Context\n\n## Examples\n\n### Adding Remote Directory\n\n```python\nktor.app.repository_credentials_provider(lambda r: ("ssh", "git", None))\nktor.app.walk_remote("git://repo.example.com/org/project?ref=dev", "/project")\n```\n\n### Adding Local Directory\n\n```python\nktor.app.walk_local("/home/username/local-dir")\n```\n\n### Using Transformers\n\n```python\ndef remove_replicas(resources, r: "K8SResource"):\n if (r.group == "apps" and r.kind in ("StatefulSet", "Deployment")\n and "replicas" in r.manifest["spec"]):\n logger.warning("Resource %s in %s contains `replica` specification that will be removed. Use HPA!!!",\n r, r.source)\n del r.manifest["spec"]["replicas"]\n\n\nktor.k8s.add_transformer(remove_replicas)\n```\n',
|
|
27
27
|
long_description_content_type = 'text/markdown',
|
|
File without changes
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/LICENSE
RENAMED
|
File without changes
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/__main__.py
RENAMED
|
File without changes
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/_json_path.py
RENAMED
|
File without changes
|
|
File without changes
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/app.py
RENAMED
|
File without changes
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/merge.py
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
|
{kubernator-1.0.23.dev20251016050525 → kubernator-1.0.24.dev20251028221359}/kubernator/proc.py
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
|