kubernator 1.0.21__tar.gz → 1.0.22__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.21 → kubernator-1.0.22}/PKG-INFO +1 -1
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/__init__.py +1 -1
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/api.py +61 -51
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/helm.py +17 -4
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/istio.py +5 -4
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/k8s.py +7 -2
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/kops.py +5 -4
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/PKG-INFO +1 -1
- {kubernator-1.0.21 → kubernator-1.0.22}/setup.py +1 -1
- {kubernator-1.0.21 → kubernator-1.0.22}/MANIFEST.in +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/LICENSE +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/__main__.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/_json_path.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/_k8s_client_patches.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/app.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/merge.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/__init__.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/awscli.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/eks.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/k8s_api.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/kubeconfig.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/kubectl.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/minikube.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/template.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/terraform.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/plugins/terragrunt.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator/proc.py +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/SOURCES.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/dependency_links.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/entry_points.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/namespace_packages.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/requires.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/top_level.txt +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/kubernator.egg-info/zip-safe +0 -0
- {kubernator-1.0.21 → kubernator-1.0.22}/setup.cfg +0 -0
|
@@ -20,6 +20,7 @@ import fnmatch
|
|
|
20
20
|
import json
|
|
21
21
|
import logging
|
|
22
22
|
import os
|
|
23
|
+
import io
|
|
23
24
|
import platform
|
|
24
25
|
import re
|
|
25
26
|
import sys
|
|
@@ -58,6 +59,53 @@ _CACHE_HEADER_TRANSLATION = {"etag": "if-none-match",
|
|
|
58
59
|
_CACHE_HEADERS = ("etag", "last-modified")
|
|
59
60
|
|
|
60
61
|
|
|
62
|
+
class TemplateEngine:
|
|
63
|
+
VARIABLE_START_STRING = "{${"
|
|
64
|
+
VARIABLE_END_STRING = "}$}"
|
|
65
|
+
|
|
66
|
+
def __init__(self, logger):
|
|
67
|
+
self.template_failures = 0
|
|
68
|
+
self.templates = {}
|
|
69
|
+
|
|
70
|
+
class CollectingUndefined(ChainableUndefined):
|
|
71
|
+
__slots__ = ()
|
|
72
|
+
|
|
73
|
+
def __str__(self):
|
|
74
|
+
self.template_failures += 1
|
|
75
|
+
return super().__str__()
|
|
76
|
+
|
|
77
|
+
logging_undefined = make_logging_undefined(
|
|
78
|
+
logger=logger,
|
|
79
|
+
base=CollectingUndefined
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
@pass_context
|
|
83
|
+
def variable_finalizer(ctx, value):
|
|
84
|
+
normalized_value = str(value)
|
|
85
|
+
if self.VARIABLE_START_STRING in normalized_value and self.VARIABLE_END_STRING in normalized_value:
|
|
86
|
+
value_template_content = sys.intern(normalized_value)
|
|
87
|
+
env: Environment = ctx.environment
|
|
88
|
+
value_template = self.templates.get(value_template_content)
|
|
89
|
+
if not value_template:
|
|
90
|
+
value_template = env.from_string(value_template_content, env.globals)
|
|
91
|
+
self.templates[value_template_content] = value_template
|
|
92
|
+
return value_template.render(ctx.parent)
|
|
93
|
+
|
|
94
|
+
return normalized_value
|
|
95
|
+
|
|
96
|
+
self.env = Environment(variable_start_string=self.VARIABLE_START_STRING,
|
|
97
|
+
variable_end_string=self.VARIABLE_END_STRING,
|
|
98
|
+
autoescape=False,
|
|
99
|
+
finalize=variable_finalizer,
|
|
100
|
+
undefined=logging_undefined)
|
|
101
|
+
|
|
102
|
+
def from_string(self, template):
|
|
103
|
+
return self.env.from_string(template)
|
|
104
|
+
|
|
105
|
+
def failures(self):
|
|
106
|
+
return self.template_failures
|
|
107
|
+
|
|
108
|
+
|
|
61
109
|
def calling_frame_source(depth=2):
|
|
62
110
|
f = traceback.extract_stack(limit=depth + 1)[0]
|
|
63
111
|
return f"file {f.filename}, line {f.lineno} in {f.name}"
|
|
@@ -96,9 +144,15 @@ class FileType(Enum):
|
|
|
96
144
|
self.func = func
|
|
97
145
|
|
|
98
146
|
|
|
99
|
-
def _load_file(logger, path: Path, file_type: FileType, source=None
|
|
100
|
-
|
|
147
|
+
def _load_file(logger, path: Path, file_type: FileType, source=None,
|
|
148
|
+
template_engine: Optional[TemplateEngine] = None,
|
|
149
|
+
template_context: Optional[dict] = None) -> Iterable[dict]:
|
|
150
|
+
with open(path, "rb" if not template_engine else "rt") as f:
|
|
101
151
|
try:
|
|
152
|
+
if template_engine:
|
|
153
|
+
raw_data = template_engine.from_string(f.read()).render(template_context)
|
|
154
|
+
f.close()
|
|
155
|
+
f = io.StringIO(raw_data)
|
|
102
156
|
data = file_type.func(f)
|
|
103
157
|
if isinstance(data, GeneratorType):
|
|
104
158
|
data = list(data)
|
|
@@ -191,9 +245,12 @@ def load_remote_file(logger, url, file_type: FileType, category: str = "k8s", su
|
|
|
191
245
|
return _load_file(logger, file_name, file_type, url)
|
|
192
246
|
|
|
193
247
|
|
|
194
|
-
def load_file(logger, path: Path, file_type: FileType, source=None
|
|
248
|
+
def load_file(logger, path: Path, file_type: FileType, source=None,
|
|
249
|
+
template_engine: Optional[TemplateEngine] = None,
|
|
250
|
+
template_context: Optional[dict] = None) -> Iterable[dict]:
|
|
195
251
|
logger.debug("Loading %s using %s", source or path, file_type.name)
|
|
196
|
-
return _load_file(logger, path, file_type
|
|
252
|
+
return _load_file(logger, path, file_type,
|
|
253
|
+
source, template_engine, template_context)
|
|
197
254
|
|
|
198
255
|
|
|
199
256
|
def validator_with_defaults(validator_class):
|
|
@@ -513,53 +570,6 @@ class Globs(MutableSet[Union[str, re.Pattern]]):
|
|
|
513
570
|
return f"Globs[{self._list}]"
|
|
514
571
|
|
|
515
572
|
|
|
516
|
-
class TemplateEngine:
|
|
517
|
-
VARIABLE_START_STRING = "{${"
|
|
518
|
-
VARIABLE_END_STRING = "}$}"
|
|
519
|
-
|
|
520
|
-
def __init__(self, logger):
|
|
521
|
-
self.template_failures = 0
|
|
522
|
-
self.templates = {}
|
|
523
|
-
|
|
524
|
-
class CollectingUndefined(ChainableUndefined):
|
|
525
|
-
__slots__ = ()
|
|
526
|
-
|
|
527
|
-
def __str__(self):
|
|
528
|
-
self.template_failures += 1
|
|
529
|
-
return super().__str__()
|
|
530
|
-
|
|
531
|
-
logging_undefined = make_logging_undefined(
|
|
532
|
-
logger=logger,
|
|
533
|
-
base=CollectingUndefined
|
|
534
|
-
)
|
|
535
|
-
|
|
536
|
-
@pass_context
|
|
537
|
-
def variable_finalizer(ctx, value):
|
|
538
|
-
normalized_value = str(value)
|
|
539
|
-
if self.VARIABLE_START_STRING in normalized_value and self.VARIABLE_END_STRING in normalized_value:
|
|
540
|
-
value_template_content = sys.intern(normalized_value)
|
|
541
|
-
env: Environment = ctx.environment
|
|
542
|
-
value_template = self.templates.get(value_template_content)
|
|
543
|
-
if not value_template:
|
|
544
|
-
value_template = env.from_string(value_template_content, env.globals)
|
|
545
|
-
self.templates[value_template_content] = value_template
|
|
546
|
-
return value_template.render(ctx.parent)
|
|
547
|
-
|
|
548
|
-
return normalized_value
|
|
549
|
-
|
|
550
|
-
self.env = Environment(variable_start_string=self.VARIABLE_START_STRING,
|
|
551
|
-
variable_end_string=self.VARIABLE_END_STRING,
|
|
552
|
-
autoescape=False,
|
|
553
|
-
finalize=variable_finalizer,
|
|
554
|
-
undefined=logging_undefined)
|
|
555
|
-
|
|
556
|
-
def from_string(self, template):
|
|
557
|
-
return self.env.from_string(template)
|
|
558
|
-
|
|
559
|
-
def failures(self):
|
|
560
|
-
return self.template_failures
|
|
561
|
-
|
|
562
|
-
|
|
563
573
|
class Template:
|
|
564
574
|
def __init__(self, name: str, template: JinjaTemplate, defaults: dict = None, path=None, source=None):
|
|
565
575
|
self.name = name
|
|
@@ -37,7 +37,7 @@ from kubernator.api import (KubernatorPlugin, Globs, StripNL,
|
|
|
37
37
|
validator_with_defaults,
|
|
38
38
|
get_golang_os,
|
|
39
39
|
get_golang_machine,
|
|
40
|
-
prepend_os_path
|
|
40
|
+
prepend_os_path, TemplateEngine
|
|
41
41
|
)
|
|
42
42
|
from kubernator.plugins.k8s_api import K8SResource
|
|
43
43
|
from kubernator.proc import DEVNULL
|
|
@@ -102,6 +102,7 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
102
102
|
self.context = None
|
|
103
103
|
self.repositories = set()
|
|
104
104
|
self.helm_dir = None
|
|
105
|
+
self.template_engine = TemplateEngine(logger)
|
|
105
106
|
|
|
106
107
|
def set_context(self, context):
|
|
107
108
|
self.context = context
|
|
@@ -180,7 +181,9 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
180
181
|
display_p = context.app.display_path(p)
|
|
181
182
|
logger.debug("Adding Helm template from %s", display_p)
|
|
182
183
|
|
|
183
|
-
helm_templates = load_file(logger, p, FileType.YAML, display_p
|
|
184
|
+
helm_templates = load_file(logger, p, FileType.YAML, display_p,
|
|
185
|
+
self.template_engine,
|
|
186
|
+
{"ktor": context})
|
|
184
187
|
|
|
185
188
|
for helm_template in helm_templates:
|
|
186
189
|
self._add_helm(helm_template, display_p)
|
|
@@ -232,6 +235,17 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
232
235
|
values_file = Path(values_file)
|
|
233
236
|
if not values_file.is_absolute():
|
|
234
237
|
values_file = self.context.app.cwd / values_file
|
|
238
|
+
values = list(load_file(logger, values_file, FileType.YAML,
|
|
239
|
+
template_engine=self.template_engine,
|
|
240
|
+
template_context={"ktor": self.context,
|
|
241
|
+
"helm": {"chart": chart,
|
|
242
|
+
"name": name,
|
|
243
|
+
"namespace": namespace,
|
|
244
|
+
"include_crds": include_crds,
|
|
245
|
+
"repository": repository,
|
|
246
|
+
"version": version,
|
|
247
|
+
}}))
|
|
248
|
+
values = values[0] if values else {}
|
|
235
249
|
|
|
236
250
|
version_spec = []
|
|
237
251
|
if repository:
|
|
@@ -260,8 +274,7 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
260
274
|
] +
|
|
261
275
|
version_spec +
|
|
262
276
|
(["--include-crds"] if include_crds else []) +
|
|
263
|
-
|
|
264
|
-
(["-f", "-"] if values else []),
|
|
277
|
+
["-f", "-"],
|
|
265
278
|
stderr_logger,
|
|
266
279
|
stdin=stdin,
|
|
267
280
|
)
|
|
@@ -33,7 +33,7 @@ from kubernator.api import (KubernatorPlugin, scan_dir,
|
|
|
33
33
|
Globs,
|
|
34
34
|
get_golang_os,
|
|
35
35
|
get_golang_machine,
|
|
36
|
-
prepend_os_path, jp)
|
|
36
|
+
prepend_os_path, jp, load_file)
|
|
37
37
|
from kubernator.plugins.k8s_api import K8SResourcePluginMixin
|
|
38
38
|
|
|
39
39
|
logger = logging.getLogger("kubernator.istio")
|
|
@@ -210,10 +210,11 @@ class IstioPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
210
210
|
display_p = context.app.display_path(p)
|
|
211
211
|
logger.info("Adding Istio Operator from %s", display_p)
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
manifests = load_file(logger, p, FileType.YAML, display_p,
|
|
214
|
+
self.template_engine,
|
|
215
|
+
{"ktor": context})
|
|
215
216
|
|
|
216
|
-
self.add_resources(
|
|
217
|
+
self.add_resources(manifests, display_p)
|
|
217
218
|
|
|
218
219
|
def handle_apply(self):
|
|
219
220
|
context = self.context
|
|
@@ -38,7 +38,8 @@ from kubernator.api import (KubernatorPlugin,
|
|
|
38
38
|
FileType,
|
|
39
39
|
load_remote_file,
|
|
40
40
|
StripNL,
|
|
41
|
-
install_python_k8s_client
|
|
41
|
+
install_python_k8s_client,
|
|
42
|
+
TemplateEngine)
|
|
42
43
|
from kubernator.merge import extract_merge_instructions, apply_merge_instructions
|
|
43
44
|
from kubernator.plugins.k8s_api import (K8SResourcePluginMixin,
|
|
44
45
|
K8SResource,
|
|
@@ -95,6 +96,7 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
95
96
|
self._transformers = []
|
|
96
97
|
self._validators = []
|
|
97
98
|
self._summary = 0, 0, 0
|
|
99
|
+
self._template_engine = TemplateEngine(logger)
|
|
98
100
|
|
|
99
101
|
def set_context(self, context):
|
|
100
102
|
self.context = context
|
|
@@ -239,7 +241,10 @@ class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
239
241
|
display_p = context.app.display_path(p)
|
|
240
242
|
logger.debug("Adding Kubernetes manifest from %s", display_p)
|
|
241
243
|
|
|
242
|
-
manifests = load_file(logger, p, FileType.YAML, display_p
|
|
244
|
+
manifests = load_file(logger, p, FileType.YAML, display_p,
|
|
245
|
+
self._template_engine,
|
|
246
|
+
{"ktor": context}
|
|
247
|
+
)
|
|
243
248
|
|
|
244
249
|
for manifest in manifests:
|
|
245
250
|
if manifest:
|
|
@@ -30,7 +30,7 @@ from kubernator.api import (KubernatorPlugin, scan_dir,
|
|
|
30
30
|
io_StringIO,
|
|
31
31
|
TemplateEngine,
|
|
32
32
|
StripNL,
|
|
33
|
-
Globs)
|
|
33
|
+
Globs, load_file)
|
|
34
34
|
from kubernator.plugins.k8s_api import K8SResourcePluginMixin
|
|
35
35
|
from kubernator.proc import CalledProcessError
|
|
36
36
|
|
|
@@ -136,10 +136,11 @@ class KopsPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
136
136
|
display_p = context.app.display_path(p)
|
|
137
137
|
logger.debug("Adding Kops resources from %s", display_p)
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
manifests = load_file(logger, p, FileType.YAML, display_p,
|
|
140
|
+
self.template_engine,
|
|
141
|
+
{"ktor": context})
|
|
141
142
|
|
|
142
|
-
self.add_resources(
|
|
143
|
+
self.add_resources(manifests, display_p)
|
|
143
144
|
|
|
144
145
|
def update(self):
|
|
145
146
|
context = self.context
|
|
@@ -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.22',
|
|
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
|
|
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
|