kubernator 1.0.6.dev20231217165655__py3-none-any.whl → 1.0.6.dev20231219050913__py3-none-any.whl
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/__init__.py +1 -1
- kubernator/app.py +26 -23
- kubernator/plugins/awscli.py +2 -2
- kubernator/plugins/eks.py +1 -1
- kubernator/plugins/helm.py +6 -6
- kubernator/plugins/istio.py +7 -7
- kubernator/plugins/kubectl.py +4 -4
- kubernator/plugins/minikube.py +119 -19
- kubernator/plugins/terraform.py +4 -4
- kubernator/plugins/terragrunt.py +4 -4
- kubernator/proc.py +4 -1
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/METADATA +1 -1
- kubernator-1.0.6.dev20231219050913.dist-info/RECORD +27 -0
- kubernator-1.0.6.dev20231217165655.dist-info/RECORD +0 -27
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/WHEEL +0 -0
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/entry_points.txt +0 -0
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/namespace_packages.txt +0 -0
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/top_level.txt +0 -0
- {kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/zip-safe +0 -0
kubernator/__init__.py
CHANGED
kubernator/app.py
CHANGED
|
@@ -166,40 +166,43 @@ class App(KubernatorPlugin):
|
|
|
166
166
|
|
|
167
167
|
self.register_plugin(self)
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
try:
|
|
170
|
+
while True:
|
|
171
|
+
cwd = self.next()
|
|
172
|
+
if not cwd:
|
|
173
|
+
logger.debug("No paths left to traverse")
|
|
174
|
+
break
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
logger.debug("Inspecting directory %s", self._display_path(cwd))
|
|
178
|
-
self._run_handlers(KubernatorPlugin.handle_before_dir, False, context, None, cwd)
|
|
176
|
+
context = self.context
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
self._run_handlers(KubernatorPlugin.
|
|
178
|
+
logger.debug("Inspecting directory %s", self._display_path(cwd))
|
|
179
|
+
self._run_handlers(KubernatorPlugin.handle_before_dir, False, context, None, cwd)
|
|
182
180
|
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
if (ktor_py := (cwd / ".kubernator.py")).exists():
|
|
182
|
+
self._run_handlers(KubernatorPlugin.handle_before_script, False, context, None, cwd)
|
|
185
183
|
|
|
186
|
-
|
|
184
|
+
for h in self.context._plugins:
|
|
185
|
+
h.set_context(context)
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
h.set_context(None)
|
|
187
|
+
self._exec_ktor(ktor_py)
|
|
190
188
|
|
|
191
|
-
|
|
189
|
+
for h in self.context._plugins:
|
|
190
|
+
h.set_context(None)
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
self._run_handlers(KubernatorPlugin.handle_after_script, True, context, None, cwd)
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
context = self.context
|
|
194
|
+
self._run_handlers(KubernatorPlugin.handle_after_dir, True, context, None, cwd)
|
|
197
195
|
|
|
198
|
-
|
|
196
|
+
self.context = self._top_dir_context
|
|
197
|
+
context = self.context
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
self._run_handlers(KubernatorPlugin.handle_apply, True, context, None)
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
self._run_handlers(KubernatorPlugin.handle_verify, True, context, None)
|
|
202
|
+
finally:
|
|
203
|
+
self.context = self._top_dir_context
|
|
204
|
+
context = self.context
|
|
205
|
+
self._run_handlers(KubernatorPlugin.handle_shutdown, True, context, None)
|
|
203
206
|
|
|
204
207
|
def discover_plugins(self):
|
|
205
208
|
importlib.invalidate_caches()
|
kubernator/plugins/awscli.py
CHANGED
|
@@ -54,7 +54,7 @@ class AwsCliPlugin(KubernatorPlugin):
|
|
|
54
54
|
def set_context(self, context):
|
|
55
55
|
self.context = context
|
|
56
56
|
|
|
57
|
-
def
|
|
57
|
+
def stanza(self, *args, output="json", region=None):
|
|
58
58
|
context = self.context
|
|
59
59
|
stanza = [context.awscli.aws_file, "--output", output]
|
|
60
60
|
if region:
|
|
@@ -112,7 +112,7 @@ class AwsCliPlugin(KubernatorPlugin):
|
|
|
112
112
|
|
|
113
113
|
context.globals.awscli = dict(version=version,
|
|
114
114
|
aws_file=self.aws_file,
|
|
115
|
-
|
|
115
|
+
stanza=self.stanza
|
|
116
116
|
)
|
|
117
117
|
|
|
118
118
|
def __repr__(self):
|
kubernator/plugins/eks.py
CHANGED
|
@@ -64,7 +64,7 @@ class EksPlugin(KubernatorPlugin):
|
|
|
64
64
|
def handle_init(self):
|
|
65
65
|
context = self.context
|
|
66
66
|
|
|
67
|
-
self.context.app.run(context.awscli.
|
|
67
|
+
self.context.app.run(context.awscli.stanza(
|
|
68
68
|
"eks", "update-kubeconfig", "--name", self.name, "--kubeconfig", context.eks.kubeconfig,
|
|
69
69
|
region=self.region),
|
|
70
70
|
stdout_logger,
|
kubernator/plugins/helm.py
CHANGED
|
@@ -106,7 +106,7 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
106
106
|
def set_context(self, context):
|
|
107
107
|
self.context = context
|
|
108
108
|
|
|
109
|
-
def
|
|
109
|
+
def stanza(self):
|
|
110
110
|
context = self.context
|
|
111
111
|
stanza = [context.helm.helm_file, f"--kubeconfig={context.kubeconfig.kubeconfig}"]
|
|
112
112
|
if logger.getEffectiveLevel() < logging.INFO:
|
|
@@ -145,13 +145,13 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
145
145
|
default_excludes=Globs([".*"], True),
|
|
146
146
|
namespace_transformer=True,
|
|
147
147
|
helm_file=helm_file,
|
|
148
|
-
|
|
148
|
+
stanza=self.stanza,
|
|
149
149
|
add_helm_template=self.add_helm_template,
|
|
150
150
|
add_helm=self.add_helm,
|
|
151
151
|
)
|
|
152
152
|
|
|
153
153
|
def handle_init(self):
|
|
154
|
-
version = self.context.app.run_capturing_out(self.
|
|
154
|
+
version = self.context.app.run_capturing_out(self.stanza() + ["version", "--template", "{{.Version}}"],
|
|
155
155
|
logger.error)
|
|
156
156
|
logger.info("Found Helm version %s", version)
|
|
157
157
|
|
|
@@ -204,10 +204,10 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
204
204
|
logger.debug("Repository %s mapping to %s", repository, repository_hash)
|
|
205
205
|
if repository_hash not in self.repositories:
|
|
206
206
|
logger.info("Adding and updating repository %s mapping to %s", repository, repository_hash)
|
|
207
|
-
self.context.app.run(self.
|
|
207
|
+
self.context.app.run(self.stanza() + ["repo", "add", repository_hash, repository],
|
|
208
208
|
stdout_logger,
|
|
209
209
|
stderr_logger).wait()
|
|
210
|
-
self.context.app.run(self.
|
|
210
|
+
self.context.app.run(self.stanza() + ["repo", "update"],
|
|
211
211
|
stdout_logger,
|
|
212
212
|
stderr_logger).wait()
|
|
213
213
|
self.repositories.add(repository_hash)
|
|
@@ -233,7 +233,7 @@ class HelmPlugin(KubernatorPlugin):
|
|
|
233
233
|
|
|
234
234
|
stdin = write_stdin
|
|
235
235
|
|
|
236
|
-
resources = self.context.app.run_capturing_out(self.
|
|
236
|
+
resources = self.context.app.run_capturing_out(self.stanza() +
|
|
237
237
|
["template",
|
|
238
238
|
name,
|
|
239
239
|
f"{repository_hash}/{chart}",
|
kubernator/plugins/istio.py
CHANGED
|
@@ -90,19 +90,19 @@ class IstioPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
90
90
|
default_includes=Globs(["*.istio.yaml", "*.istio.yml"], True),
|
|
91
91
|
default_excludes=Globs([".*"], True),
|
|
92
92
|
istioctl_file=istioctl_file,
|
|
93
|
-
|
|
93
|
+
stanza=self.stanza,
|
|
94
94
|
test=self.test_istioctl
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
def test_istioctl(self):
|
|
98
98
|
context = self.context
|
|
99
|
-
version_out: str = context.app.run_capturing_out(context.istio.
|
|
99
|
+
version_out: str = context.app.run_capturing_out(context.istio.stanza() + ["version", "-o", "json"],
|
|
100
100
|
stderr_logger)
|
|
101
101
|
|
|
102
102
|
version_out_js = json.loads(version_out)
|
|
103
103
|
version = version_out_js["clientVersion"]["version"]
|
|
104
104
|
logger.info("Using istioctl %r version %r with stanza %r",
|
|
105
|
-
self.context.istio.istioctl_file, version, context.istio.
|
|
105
|
+
self.context.istio.istioctl_file, version, context.istio.stanza())
|
|
106
106
|
|
|
107
107
|
logger.info("Found Istio client version %s", version)
|
|
108
108
|
|
|
@@ -111,7 +111,7 @@ class IstioPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
111
111
|
def set_context(self, context):
|
|
112
112
|
self.context = context
|
|
113
113
|
|
|
114
|
-
def
|
|
114
|
+
def stanza(self):
|
|
115
115
|
context = self.context.istio
|
|
116
116
|
return [context.istioctl_file, f"--kubeconfig={self.context.kubeconfig.kubeconfig}"]
|
|
117
117
|
|
|
@@ -189,9 +189,9 @@ class IstioPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
189
189
|
|
|
190
190
|
if context.app.args.command == "apply":
|
|
191
191
|
logger.info("Running Istio precheck")
|
|
192
|
-
context.app.run(context.istio.
|
|
192
|
+
context.app.run(context.istio.stanza() + ["x", "precheck"],
|
|
193
193
|
stdout_logger, stderr_logger).wait()
|
|
194
|
-
context.app.run(context.istio.
|
|
194
|
+
context.app.run(context.istio.stanza() + ["validate", "-f", operators_file.name],
|
|
195
195
|
stdout_logger, stderr_logger).wait()
|
|
196
196
|
|
|
197
197
|
self._operator_init(operators_file, True)
|
|
@@ -230,7 +230,7 @@ class IstioPlugin(KubernatorPlugin, K8SResourcePluginMixin):
|
|
|
230
230
|
raise
|
|
231
231
|
|
|
232
232
|
logger.info("Running Istio operator init%s", status_details)
|
|
233
|
-
istio_operator_init = context.istio.
|
|
233
|
+
istio_operator_init = context.istio.stanza() + ["operator", "init", "-f", operators_file.name]
|
|
234
234
|
context.app.run(istio_operator_init + (["--dry-run"] if dry_run else []),
|
|
235
235
|
stdout_logger,
|
|
236
236
|
stderr_logger).wait()
|
kubernator/plugins/kubectl.py
CHANGED
|
@@ -49,7 +49,7 @@ class KubectlPlugin(KubernatorPlugin):
|
|
|
49
49
|
def set_context(self, context):
|
|
50
50
|
self.context = context
|
|
51
51
|
|
|
52
|
-
def
|
|
52
|
+
def stanza(self):
|
|
53
53
|
context = self.context.kubectl
|
|
54
54
|
return [context.kubectl_file, f"--kubeconfig={context.kubeconfig}"]
|
|
55
55
|
|
|
@@ -85,14 +85,14 @@ class KubectlPlugin(KubernatorPlugin):
|
|
|
85
85
|
context.globals.kubectl = dict(version=version,
|
|
86
86
|
kubeconfig=kubeconfig,
|
|
87
87
|
kubectl_file=kubectl_file,
|
|
88
|
-
|
|
88
|
+
stanza=self.stanza,
|
|
89
89
|
test=self.test_kubectl
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
context.globals.kubectl.version = context.kubectl.test()
|
|
93
93
|
|
|
94
94
|
def test_kubectl(self):
|
|
95
|
-
version_out: str = self.context.app.run_capturing_out(self.
|
|
95
|
+
version_out: str = self.context.app.run_capturing_out(self.stanza() +
|
|
96
96
|
["version", "--client=true", "-o", "json"],
|
|
97
97
|
stderr_logger)
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ class KubectlPlugin(KubernatorPlugin):
|
|
|
100
100
|
kubectl_version = version_out_js["clientVersion"]["gitVersion"][1:]
|
|
101
101
|
|
|
102
102
|
logger.info("Using kubectl %r version %r with stanza %r",
|
|
103
|
-
self.context.kubectl.kubectl_file, kubectl_version, self.
|
|
103
|
+
self.context.kubectl.kubectl_file, kubectl_version, self.stanza())
|
|
104
104
|
|
|
105
105
|
return kubectl_version
|
|
106
106
|
|
kubernator/plugins/minikube.py
CHANGED
|
@@ -18,11 +18,16 @@
|
|
|
18
18
|
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
21
|
+
import tempfile
|
|
22
|
+
from pathlib import Path
|
|
21
23
|
|
|
22
24
|
from kubernator.api import (KubernatorPlugin,
|
|
23
25
|
StripNL,
|
|
24
26
|
get_golang_os,
|
|
25
|
-
get_golang_machine
|
|
27
|
+
get_golang_machine,
|
|
28
|
+
prepend_os_path,
|
|
29
|
+
get_cache_dir,
|
|
30
|
+
CalledProcessError
|
|
26
31
|
)
|
|
27
32
|
|
|
28
33
|
logger = logging.getLogger("kubernator.minikube")
|
|
@@ -38,6 +43,7 @@ class MinikubePlugin(KubernatorPlugin):
|
|
|
38
43
|
|
|
39
44
|
def __init__(self):
|
|
40
45
|
self.context = None
|
|
46
|
+
self.minikube_dir = None
|
|
41
47
|
self.minikube_home_dir = None
|
|
42
48
|
self.kubeconfig_dir = None
|
|
43
49
|
|
|
@@ -64,38 +70,132 @@ class MinikubePlugin(KubernatorPlugin):
|
|
|
64
70
|
map(lambda line: line.split()[1][11:].split("."),
|
|
65
71
|
versions.splitlines(False))))))[-1])))
|
|
66
72
|
|
|
67
|
-
def cmd(self, ):
|
|
68
|
-
|
|
73
|
+
def cmd(self, *extra_args):
|
|
74
|
+
stanza, env = self._stanza(list(extra_args))
|
|
75
|
+
return self.context.app.run(stanza, stdout_logger, stderr_logger, env=env).wait()
|
|
69
76
|
|
|
70
|
-
def
|
|
77
|
+
def cmd_out(self, *extra_args):
|
|
78
|
+
stanza, env = self._stanza(list(extra_args))
|
|
79
|
+
return self.context.app.run_capturing_out(stanza, stderr_logger, env=env)
|
|
80
|
+
|
|
81
|
+
def _stanza(self, extra_args):
|
|
82
|
+
context = self.context
|
|
83
|
+
minikube = context.minikube
|
|
84
|
+
stanza = [context.minikube.minikube_file, "-p", f"minikube-{minikube.profile}"] + extra_args
|
|
85
|
+
env = dict(os.environ)
|
|
86
|
+
env["MINIKUBE_HOME"] = str(self.minikube_home_dir)
|
|
87
|
+
env["KUBECONFIG"] = str(minikube.kubeconfig)
|
|
88
|
+
return stanza, env
|
|
89
|
+
|
|
90
|
+
def register(self, minikube_version=None, profile="default", k8s_version=None,
|
|
91
|
+
keep_running=False, start_fresh=False,
|
|
92
|
+
nodes=1, driver="docker", cpus="no-limit", extra_args=None):
|
|
71
93
|
context = self.context
|
|
72
94
|
|
|
73
|
-
context.app.register_plugin("
|
|
95
|
+
context.app.register_plugin("kubeconfig")
|
|
96
|
+
|
|
97
|
+
if not k8s_version:
|
|
98
|
+
msg = "No Kubernetes version is specified for Minikube"
|
|
99
|
+
logger.critical(msg)
|
|
100
|
+
raise RuntimeError(msg)
|
|
74
101
|
|
|
75
102
|
if not minikube_version:
|
|
76
103
|
minikube_version = self.get_latest_minikube_version()
|
|
77
104
|
logger.info("No minikube version is specified, latest is %s", minikube_version)
|
|
78
105
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
106
|
+
minikube_dl_file, _ = context.app.download_remote_file(logger,
|
|
107
|
+
f"https://github.com/kubernetes/minikube/releases"
|
|
108
|
+
f"/download/v{minikube_version}/"
|
|
109
|
+
f"minikube-{get_golang_os()}-{get_golang_machine()}",
|
|
110
|
+
"bin")
|
|
111
|
+
|
|
112
|
+
os.chmod(minikube_dl_file, 0o500)
|
|
113
|
+
self.minikube_dir = tempfile.TemporaryDirectory()
|
|
114
|
+
minikube_file = Path(self.minikube_dir.name) / "minikube"
|
|
115
|
+
minikube_file.symlink_to(minikube_dl_file)
|
|
116
|
+
prepend_os_path(self.minikube_dir.name)
|
|
84
117
|
version_out: str = self.context.app.run_capturing_out([minikube_file, "version", "--short"],
|
|
85
|
-
stderr_logger)
|
|
118
|
+
stderr_logger).strip()
|
|
86
119
|
version = version_out[1:]
|
|
87
|
-
logger.info("Found minikube %s in %
|
|
120
|
+
logger.info("Found minikube %s in %s", version, minikube_file)
|
|
121
|
+
|
|
122
|
+
profile_dir = get_cache_dir("minikube", profile)
|
|
123
|
+
self.minikube_home_dir = profile_dir / "home"
|
|
124
|
+
self.minikube_home_dir.mkdir(parents=True, exist_ok=True)
|
|
125
|
+
self.kubeconfig_dir = profile_dir / ".kube"
|
|
126
|
+
self.kubeconfig_dir.mkdir(parents=True, exist_ok=True)
|
|
88
127
|
|
|
89
128
|
context.globals.minikube = dict(version=version,
|
|
90
|
-
minikube_file=minikube_file,
|
|
91
|
-
|
|
129
|
+
minikube_file=str(minikube_file),
|
|
130
|
+
profile=profile,
|
|
131
|
+
k8s_version=k8s_version,
|
|
132
|
+
start_fresh=start_fresh,
|
|
133
|
+
keep_running=keep_running,
|
|
134
|
+
nodes=nodes,
|
|
135
|
+
driver=driver,
|
|
136
|
+
cpus=cpus,
|
|
137
|
+
extra_args=extra_args or [],
|
|
138
|
+
kubeconfig=str(self.kubeconfig_dir / "config"),
|
|
139
|
+
cmd=self.cmd,
|
|
140
|
+
cmd_out=self.cmd_out
|
|
92
141
|
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
142
|
+
context.kubeconfig.kubeconfig = context.minikube.kubeconfig
|
|
143
|
+
|
|
144
|
+
logger.info("Minikube Home is %s", self.minikube_home_dir)
|
|
145
|
+
logger.info("Minikube Kubeconfig is %s", context.minikube.kubeconfig)
|
|
146
|
+
|
|
147
|
+
def minikube_is_running(self):
|
|
148
|
+
try:
|
|
149
|
+
out = self.cmd_out("status", "-o", "json")
|
|
150
|
+
logger.info("Minikube profile %r is running: %s", self.context.minikube.profile,
|
|
151
|
+
out.strip())
|
|
152
|
+
return True
|
|
153
|
+
except CalledProcessError as e:
|
|
154
|
+
logger.info("Minikube profile %r is not running: %s", self.context.minikube.profile,
|
|
155
|
+
e.output.strip())
|
|
156
|
+
return False
|
|
157
|
+
|
|
158
|
+
def minikube_start(self):
|
|
159
|
+
minikube = self.context.minikube
|
|
160
|
+
if not self.minikube_is_running():
|
|
161
|
+
logger.info("Starting minikube profile %r...", minikube.profile)
|
|
162
|
+
self.cmd("start",
|
|
163
|
+
"--driver", str(minikube.driver),
|
|
164
|
+
"--nodes", str(minikube.nodes),
|
|
165
|
+
"--cpus", str(minikube.cpus),
|
|
166
|
+
"--kubernetes-version", str(minikube.k8s_version),
|
|
167
|
+
"--wait", "apiserver")
|
|
168
|
+
else:
|
|
169
|
+
logger.warning("Minikube profile %r is already running!", minikube.profile)
|
|
170
|
+
|
|
171
|
+
logger.info("Updating minikube profile %r context", minikube.profile)
|
|
172
|
+
self.cmd("update-context")
|
|
173
|
+
|
|
174
|
+
def minikube_stop(self):
|
|
175
|
+
minikube = self.context.minikube
|
|
176
|
+
if self.minikube_is_running():
|
|
177
|
+
logger.info("Shutting down minikube profile %r...", minikube.profile)
|
|
178
|
+
self.cmd("stop", "-o", "json")
|
|
179
|
+
|
|
180
|
+
def minikube_delete(self):
|
|
181
|
+
minikube = self.context.minikube
|
|
182
|
+
self.minikube_stop()
|
|
183
|
+
logger.warning("Deleting minikube profile %r!", minikube.profile)
|
|
184
|
+
self.cmd("delete")
|
|
185
|
+
|
|
186
|
+
def handle_start(self):
|
|
187
|
+
minikube = self.context.minikube
|
|
188
|
+
if minikube.start_fresh:
|
|
189
|
+
self.minikube_delete()
|
|
190
|
+
|
|
191
|
+
self.minikube_start()
|
|
96
192
|
|
|
97
193
|
def handle_shutdown(self):
|
|
98
|
-
|
|
194
|
+
minikube = self.context.minikube
|
|
195
|
+
if not minikube.keep_running:
|
|
196
|
+
self.minikube_stop()
|
|
197
|
+
else:
|
|
198
|
+
logger.warning("Will keep minikube profile %s running!", minikube.profile)
|
|
99
199
|
|
|
100
200
|
def __repr__(self):
|
|
101
|
-
return "
|
|
201
|
+
return "Minikube Plugin"
|
kubernator/plugins/terraform.py
CHANGED
|
@@ -51,7 +51,7 @@ class TerraformPlugin(KubernatorPlugin):
|
|
|
51
51
|
def set_context(self, context):
|
|
52
52
|
self.context = context
|
|
53
53
|
|
|
54
|
-
def
|
|
54
|
+
def stanza(self):
|
|
55
55
|
return [self.tf_file]
|
|
56
56
|
|
|
57
57
|
def register(self, version=None):
|
|
@@ -95,7 +95,7 @@ class TerraformPlugin(KubernatorPlugin):
|
|
|
95
95
|
|
|
96
96
|
context.globals.terraform = dict(version=version,
|
|
97
97
|
tf_file=self.tf_file,
|
|
98
|
-
|
|
98
|
+
stanza=self.stanza,
|
|
99
99
|
)
|
|
100
100
|
|
|
101
101
|
logger.info("Found Terraform version %s at %s", version, self.tf_file)
|
|
@@ -127,10 +127,10 @@ class TerraformPlugin(KubernatorPlugin):
|
|
|
127
127
|
if not tf_detected:
|
|
128
128
|
return
|
|
129
129
|
|
|
130
|
-
context.app.run(self.
|
|
130
|
+
context.app.run(self.stanza() + ["init", "-reconfigure", "-input=false", "-upgrade=false"],
|
|
131
131
|
stdout_logger, stderr_logger, cwd=cwd).wait()
|
|
132
132
|
|
|
133
|
-
output = json.loads(context.app.run_capturing_out(self.
|
|
133
|
+
output = json.loads(context.app.run_capturing_out(self.stanza() + ["output", "-json"],
|
|
134
134
|
stderr_logger, cwd=cwd))
|
|
135
135
|
if not output:
|
|
136
136
|
raise RuntimeError("Terraform output produced no values. Please check if Terraform is functioning.")
|
kubernator/plugins/terragrunt.py
CHANGED
|
@@ -49,7 +49,7 @@ class TerragruntPlugin(KubernatorPlugin):
|
|
|
49
49
|
def set_context(self, context):
|
|
50
50
|
self.context = context
|
|
51
51
|
|
|
52
|
-
def
|
|
52
|
+
def stanza(self):
|
|
53
53
|
return [self.tg_file]
|
|
54
54
|
|
|
55
55
|
def register(self, version=None):
|
|
@@ -81,7 +81,7 @@ class TerragruntPlugin(KubernatorPlugin):
|
|
|
81
81
|
version = version_out.split(" ")[-1][1:].strip()
|
|
82
82
|
context.globals.terragrunt = dict(version=version,
|
|
83
83
|
tg_file=self.tg_file,
|
|
84
|
-
|
|
84
|
+
stanza=self.stanza,
|
|
85
85
|
)
|
|
86
86
|
|
|
87
87
|
logger.info("Found Terragrunt version %s at %s", version, self.tg_file)
|
|
@@ -113,10 +113,10 @@ class TerragruntPlugin(KubernatorPlugin):
|
|
|
113
113
|
if not tg_detected:
|
|
114
114
|
return
|
|
115
115
|
|
|
116
|
-
context.app.run(self.
|
|
116
|
+
context.app.run(self.stanza() + ["run-all", "init", "-reconfigure", "-input=false", "-upgrade=false"],
|
|
117
117
|
stdout_logger, stderr_logger, cwd=cwd).wait()
|
|
118
118
|
|
|
119
|
-
output_json = context.app.run_capturing_out(self.
|
|
119
|
+
output_json = context.app.run_capturing_out(self.stanza() + ["run-all", "output", "-json"],
|
|
120
120
|
stderr_logger, cwd=cwd)
|
|
121
121
|
|
|
122
122
|
json_decoder = json.JSONDecoder()
|
kubernator/proc.py
CHANGED
|
@@ -70,13 +70,16 @@ class ProcessRunner:
|
|
|
70
70
|
safe_args=None, universal_newlines=True, **kwargs):
|
|
71
71
|
self._safe_args = safe_args or args
|
|
72
72
|
logger.trace("Starting %r", self._safe_args)
|
|
73
|
+
|
|
74
|
+
if "env" not in kwargs:
|
|
75
|
+
kwargs["env"] = os.environ
|
|
76
|
+
|
|
73
77
|
self._proc = Popen(args,
|
|
74
78
|
stdout=PIPE if isinstance(stdout, Callable) else (stdout if stdout is not None else DEVNULL),
|
|
75
79
|
stderr=PIPE if isinstance(stderr, Callable) else (stderr if stderr is not None else DEVNULL),
|
|
76
80
|
stdin=PIPE if isinstance(stdin, (Callable, bytes, str)) else
|
|
77
81
|
(stdin if stdin is not None else DEVNULL),
|
|
78
82
|
universal_newlines=universal_newlines,
|
|
79
|
-
env=os.environ if "env" not in kwargs else kwargs["env"],
|
|
80
83
|
**kwargs)
|
|
81
84
|
|
|
82
85
|
self._stdin_writer = (spawn(partial(stream_writer_text if universal_newlines else stream_writer_buf,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kubernator
|
|
3
|
-
Version: 1.0.6.
|
|
3
|
+
Version: 1.0.6.dev20231219050913
|
|
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.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
kubernator/LICENSE,sha256=wKKdOCMTCPQRV5gDkVLAsXX8qSnRJ5owk7yWPO1KZNo,11387
|
|
2
|
+
kubernator/__init__.py,sha256=a4DQSz4YUiH2tVn7eDqyaEaQCTkj9uOi22PlMeW9_us,932
|
|
3
|
+
kubernator/__main__.py,sha256=f0S60wgpLu--1UlOhzfWail-xt8zyIuODodX98_yPN0,707
|
|
4
|
+
kubernator/api.py,sha256=nu6dHXAayk1M4Mc5lni4GiQ6kKsrjWmaUM4BwmotR5E,24168
|
|
5
|
+
kubernator/app.py,sha256=_5O8ToIy2OHVwNskbQGuxG63bftdjEitr6gcCaV4-n4,19467
|
|
6
|
+
kubernator/proc.py,sha256=8YlgbppyHic_51fVTPD7OP8x5yuRuL8j1kThR8MJjNI,5119
|
|
7
|
+
kubernator/plugins/__init__.py,sha256=h9TLYK8UFEi53ipZSZsTBjp0ljKhisWsgPpt_PkWrO8,670
|
|
8
|
+
kubernator/plugins/awscli.py,sha256=S6X7-qFiaZ7NDVDl2Jg0t-ih9KAJ45cUjjzd5Qe93ZM,4252
|
|
9
|
+
kubernator/plugins/eks.py,sha256=xe7vyPHNwuP8gEYDSzPyBkm-RkAtP64wCOqs9U5I7xI,2273
|
|
10
|
+
kubernator/plugins/helm.py,sha256=CHuK97TTLf6j6lTL1FSB51xyQ_Jqf-lAVZId_NHhQfQ,10469
|
|
11
|
+
kubernator/plugins/istio.py,sha256=ixY-6H_hH55rBBcWJqq6SCkyHrVIu4iJdKm18okxdfk,9777
|
|
12
|
+
kubernator/plugins/k8s.py,sha256=1M1cJ_fkYcvht9YQTPkz8Y2t5OH0PlSXAj9OXijt7S4,20152
|
|
13
|
+
kubernator/plugins/k8s_api.py,sha256=SDxU86Uthy1fcTotAdRWSv13BMoyO0znfcP_7aQ0yIM,25932
|
|
14
|
+
kubernator/plugins/kops.py,sha256=QsrQJUF6wGJo2QRVqP92pG5vmOTYQIc25PD_DWCzrAA,9635
|
|
15
|
+
kubernator/plugins/kubeconfig.py,sha256=uwtHmF2I6LiTPrC3M88G5SfYxDWtuh0MqcMfrHHoNRA,2178
|
|
16
|
+
kubernator/plugins/kubectl.py,sha256=4Z01zDCni0B60F4L2ImuA3Ob8HMD1YK-DD9FXfZ1Z6Y,3861
|
|
17
|
+
kubernator/plugins/minikube.py,sha256=cJYnjGcQdNNrTAisDzF5kJXuAeYbRHUBc-XCuxBwEY8,8386
|
|
18
|
+
kubernator/plugins/template.py,sha256=o6UqLw1wK91gCfN7q-Wwc3P5iycAeELUryXh-egA2vQ,8070
|
|
19
|
+
kubernator/plugins/terraform.py,sha256=bw-0KUBYB1bKEeBTfSYD5A1PGHtuGwOVLV86z6zznkc,5231
|
|
20
|
+
kubernator/plugins/terragrunt.py,sha256=UbV_Hm2wO8lPpkRvE9PGCbtpcWVjDJedAv-SHw7KngE,4996
|
|
21
|
+
kubernator-1.0.6.dev20231219050913.dist-info/METADATA,sha256=vWnqThBp4YL-2pRKd_sxGXf-E4JOmldeg-4m5uxuHrI,10318
|
|
22
|
+
kubernator-1.0.6.dev20231219050913.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
23
|
+
kubernator-1.0.6.dev20231219050913.dist-info/entry_points.txt,sha256=IWDtHzyTleRqDSuVRXEr5GImrI7z_kh21t5DWZ8ldcQ,47
|
|
24
|
+
kubernator-1.0.6.dev20231219050913.dist-info/namespace_packages.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
25
|
+
kubernator-1.0.6.dev20231219050913.dist-info/top_level.txt,sha256=_z1CxWeKMI55ckf2vC8HqjbCn_E2Y_P5RdrhE_QWcIs,11
|
|
26
|
+
kubernator-1.0.6.dev20231219050913.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
27
|
+
kubernator-1.0.6.dev20231219050913.dist-info/RECORD,,
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
kubernator/LICENSE,sha256=wKKdOCMTCPQRV5gDkVLAsXX8qSnRJ5owk7yWPO1KZNo,11387
|
|
2
|
-
kubernator/__init__.py,sha256=i8PrMcFA2tsdJv5vwCQfTRLhLho1motFv-I62nCRFtc,932
|
|
3
|
-
kubernator/__main__.py,sha256=f0S60wgpLu--1UlOhzfWail-xt8zyIuODodX98_yPN0,707
|
|
4
|
-
kubernator/api.py,sha256=nu6dHXAayk1M4Mc5lni4GiQ6kKsrjWmaUM4BwmotR5E,24168
|
|
5
|
-
kubernator/app.py,sha256=WDlDz4ksgrpJK8u6HxFpVkGqOYCiSlC4zCy_4Ttmewg,19266
|
|
6
|
-
kubernator/proc.py,sha256=MNJwcpSwY_j-WfxEtI3CIhC59rID47GQwUMOFiIQEMk,5131
|
|
7
|
-
kubernator/plugins/__init__.py,sha256=h9TLYK8UFEi53ipZSZsTBjp0ljKhisWsgPpt_PkWrO8,670
|
|
8
|
-
kubernator/plugins/awscli.py,sha256=UNTQ7JrdaJ73IRV5VQwnMZ-0qcmLmcE5X9tCdHFL_KQ,4243
|
|
9
|
-
kubernator/plugins/eks.py,sha256=PbbnopFxy7sF66GLAq_BazjUKSPQvKsS_Z4vqUDJ7pA,2270
|
|
10
|
-
kubernator/plugins/helm.py,sha256=WagjiLScsbFJBq3brItOE8lZ3Rn8C8dE7VCVIoEG-Co,10504
|
|
11
|
-
kubernator/plugins/istio.py,sha256=xw1juf2tSWd0S9uhb3VAPyQQijcQFUiaJJvySSH0S_Q,9849
|
|
12
|
-
kubernator/plugins/k8s.py,sha256=1M1cJ_fkYcvht9YQTPkz8Y2t5OH0PlSXAj9OXijt7S4,20152
|
|
13
|
-
kubernator/plugins/k8s_api.py,sha256=SDxU86Uthy1fcTotAdRWSv13BMoyO0znfcP_7aQ0yIM,25932
|
|
14
|
-
kubernator/plugins/kops.py,sha256=QsrQJUF6wGJo2QRVqP92pG5vmOTYQIc25PD_DWCzrAA,9635
|
|
15
|
-
kubernator/plugins/kubeconfig.py,sha256=uwtHmF2I6LiTPrC3M88G5SfYxDWtuh0MqcMfrHHoNRA,2178
|
|
16
|
-
kubernator/plugins/kubectl.py,sha256=Ug_GyiKamvDy0waC2bplVTs2vTJEaCR31riPWMBisCI,3901
|
|
17
|
-
kubernator/plugins/minikube.py,sha256=crXSXVf7O4JLS1d5-2tjKOFEBurYFgzM18x9dEmbpc8,3760
|
|
18
|
-
kubernator/plugins/template.py,sha256=o6UqLw1wK91gCfN7q-Wwc3P5iycAeELUryXh-egA2vQ,8070
|
|
19
|
-
kubernator/plugins/terraform.py,sha256=E0nJ2ZQxxucAT2sg1iQFi_5zweoGh3ttEvWz_VCmI1M,5246
|
|
20
|
-
kubernator/plugins/terragrunt.py,sha256=WnTLHHmnBlXzAC1yTnLsig-1Jf6aPTuqbnlWzdJN0to,5011
|
|
21
|
-
kubernator-1.0.6.dev20231217165655.dist-info/METADATA,sha256=83urt6tmmdBT8wtMQbcPD16fU6Oyszto64iGMjgYYWE,10318
|
|
22
|
-
kubernator-1.0.6.dev20231217165655.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
23
|
-
kubernator-1.0.6.dev20231217165655.dist-info/entry_points.txt,sha256=IWDtHzyTleRqDSuVRXEr5GImrI7z_kh21t5DWZ8ldcQ,47
|
|
24
|
-
kubernator-1.0.6.dev20231217165655.dist-info/namespace_packages.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
25
|
-
kubernator-1.0.6.dev20231217165655.dist-info/top_level.txt,sha256=_z1CxWeKMI55ckf2vC8HqjbCn_E2Y_P5RdrhE_QWcIs,11
|
|
26
|
-
kubernator-1.0.6.dev20231217165655.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
27
|
-
kubernator-1.0.6.dev20231217165655.dist-info/RECORD,,
|
{kubernator-1.0.6.dev20231217165655.dist-info → kubernator-1.0.6.dev20231219050913.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|