kuber_kit 0.4.5 → 0.4.6
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kuber_kit.rb +4 -0
- data/lib/kuber_kit/actions/kubectl_attacher.rb +3 -4
- data/lib/kuber_kit/actions/kubectl_console.rb +2 -3
- data/lib/kuber_kit/actions/kubectl_describe.rb +2 -22
- data/lib/kuber_kit/actions/kubectl_logs.rb +2 -3
- data/lib/kuber_kit/container.rb +4 -0
- data/lib/kuber_kit/kubernetes/resources_fetcher.rb +41 -0
- data/lib/kuber_kit/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bcee9236bf3bc1938a2fa671e3d4a060ddf72a113a932365e5804bfc8c15b38
|
4
|
+
data.tar.gz: d452258ab40ad77ac5663c872be237032a80d138164b9e60d98d713fe8d5793f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e34e7f2d8106d941e911ce600c692bcc1332f7d16673151641900462cbab1238be707ebff787dbc40ea9f270b0a27543136439353b32b82e4a4d00ceb2f07ce2
|
7
|
+
data.tar.gz: 464be38573b8d6bc6fffc83292c0b80e37bfdb725ad367d8243243aed676d98464a43ec69f7a7283007783e0506863da5e78e80753953da9bff7b8f6dfec193c
|
data/Gemfile.lock
CHANGED
data/lib/kuber_kit.rb
CHANGED
@@ -175,6 +175,10 @@ module KuberKit
|
|
175
175
|
autoload :Inspectable, 'extensions/inspectable'
|
176
176
|
end
|
177
177
|
|
178
|
+
module Kubernetes
|
179
|
+
autoload :ResourcesFetcher, 'kubernetes/resources_fetcher'
|
180
|
+
end
|
181
|
+
|
178
182
|
module UI
|
179
183
|
autoload :Interactive, 'ui/interactive'
|
180
184
|
autoload :Simple, 'ui/simple'
|
@@ -2,6 +2,7 @@ class KuberKit::Actions::KubectlAttacher
|
|
2
2
|
include KuberKit::Import[
|
3
3
|
"shell.kubectl_commands",
|
4
4
|
"shell.local_shell",
|
5
|
+
"kubernetes.resources_fetcher",
|
5
6
|
"ui"
|
6
7
|
]
|
7
8
|
|
@@ -10,10 +11,8 @@ class KuberKit::Actions::KubectlAttacher
|
|
10
11
|
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
11
12
|
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
12
13
|
|
13
|
-
if !pod_name
|
14
|
-
|
15
|
-
options = resources.split(" ").map{|d| "deploy/#{d}" }
|
16
|
-
pod_name = ui.prompt("Please select deployment to attach", options)
|
14
|
+
if !pod_name
|
15
|
+
pod_name = resources_fetcher.call("attach")
|
17
16
|
end
|
18
17
|
|
19
18
|
kubectl_commands.exec(
|
@@ -2,6 +2,7 @@ class KuberKit::Actions::KubectlConsole
|
|
2
2
|
include KuberKit::Import[
|
3
3
|
"shell.kubectl_commands",
|
4
4
|
"shell.local_shell",
|
5
|
+
"kubernetes.resources_fetcher",
|
5
6
|
"ui"
|
6
7
|
]
|
7
8
|
|
@@ -11,9 +12,7 @@ class KuberKit::Actions::KubectlConsole
|
|
11
12
|
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
12
13
|
|
13
14
|
if !pod_name
|
14
|
-
|
15
|
-
options = resources.split(" ").map{|d| "deploy/#{d}" }
|
16
|
-
pod_name = ui.prompt("Please select deployment to attach", options)
|
15
|
+
pod_name = resources_fetcher.call("attach")
|
17
16
|
end
|
18
17
|
|
19
18
|
kubectl_commands.exec(
|
@@ -2,6 +2,7 @@ class KuberKit::Actions::KubectlDescribe
|
|
2
2
|
include KuberKit::Import[
|
3
3
|
"shell.kubectl_commands",
|
4
4
|
"shell.local_shell",
|
5
|
+
"kubernetes.resources_fetcher",
|
5
6
|
"ui"
|
6
7
|
]
|
7
8
|
|
@@ -11,7 +12,7 @@ class KuberKit::Actions::KubectlDescribe
|
|
11
12
|
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
12
13
|
|
13
14
|
if !resource_name
|
14
|
-
resource_name =
|
15
|
+
resource_name = resources_fetcher.call("describe", include_ingresses: true, include_pods: true)
|
15
16
|
end
|
16
17
|
|
17
18
|
args = nil
|
@@ -32,25 +33,4 @@ class KuberKit::Actions::KubectlDescribe
|
|
32
33
|
|
33
34
|
false
|
34
35
|
end
|
35
|
-
|
36
|
-
def get_resource_name
|
37
|
-
deployments = kubectl_commands.get_resources(local_shell, "deployments", jsonpath: ".items[*].metadata.name")
|
38
|
-
options = deployments.split(" ").map{|d| "deploy/#{d}" }
|
39
|
-
options += ["ingresses", "pods"]
|
40
|
-
option = ui.prompt("Please select resource to describe", options)
|
41
|
-
|
42
|
-
if option == "ingresses"
|
43
|
-
ingresses = kubectl_commands.get_resources(local_shell, "ingresses", jsonpath: ".items[*].metadata.name")
|
44
|
-
options = ingresses.split(" ").map{|d| "ingresses/#{d}" }
|
45
|
-
return ui.prompt("Please select ingress to describe", options)
|
46
|
-
end
|
47
|
-
|
48
|
-
if option == "pods"
|
49
|
-
ingresses = kubectl_commands.get_resources(local_shell, "pods", jsonpath: ".items[*].metadata.name")
|
50
|
-
options = ingresses.split(" ").map{|d| "pods/#{d}" }
|
51
|
-
return ui.prompt("Please select pod to describe", options)
|
52
|
-
end
|
53
|
-
|
54
|
-
option
|
55
|
-
end
|
56
36
|
end
|
@@ -2,6 +2,7 @@ class KuberKit::Actions::KubectlLogs
|
|
2
2
|
include KuberKit::Import[
|
3
3
|
"shell.kubectl_commands",
|
4
4
|
"shell.local_shell",
|
5
|
+
"kubernetes.resources_fetcher",
|
5
6
|
"ui"
|
6
7
|
]
|
7
8
|
|
@@ -11,9 +12,7 @@ class KuberKit::Actions::KubectlLogs
|
|
11
12
|
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
12
13
|
|
13
14
|
if !pod_name
|
14
|
-
|
15
|
-
deploy_options = deployments.split(" ").map{|d| "deploy/#{d}" }
|
16
|
-
pod_name = ui.prompt("Please select deployment to attach", deploy_options)
|
15
|
+
pod_name = resources_fetcher.call("attach")
|
17
16
|
end
|
18
17
|
|
19
18
|
args = nil
|
data/lib/kuber_kit/container.rb
CHANGED
@@ -261,6 +261,10 @@ class KuberKit::Container
|
|
261
261
|
KuberKit::ServiceReader::Reader.new
|
262
262
|
end
|
263
263
|
|
264
|
+
register "kubernetes.resources_fetcher" do
|
265
|
+
KuberKit::Kubernetes::ResourcesFetcher.new
|
266
|
+
end
|
267
|
+
|
264
268
|
register "ui" do
|
265
269
|
if KuberKit.ui_mode == :debug
|
266
270
|
KuberKit::UI::Debug.new
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class KuberKit::Kubernetes::ResourcesFetcher
|
2
|
+
include KuberKit::Import[
|
3
|
+
"shell.kubectl_commands",
|
4
|
+
"shell.local_shell",
|
5
|
+
"ui"
|
6
|
+
]
|
7
|
+
|
8
|
+
Contract String, KeywordArgs[
|
9
|
+
include_ingresses: Optional[Bool],
|
10
|
+
include_pods: Optional[Bool]
|
11
|
+
] => Any
|
12
|
+
def call(action_name, include_ingresses: false, include_pods: false)
|
13
|
+
deployments = get_resources("deployments")
|
14
|
+
options = deployments.split(" ").map{|d| "deploy/#{d}" }
|
15
|
+
options << "ingresses" if include_ingresses
|
16
|
+
options << "pods" if include_pods
|
17
|
+
option = ui.prompt("Please select resource to #{action_name}", options)
|
18
|
+
|
19
|
+
if option == "ingresses" && include_ingresses
|
20
|
+
ingresses = get_resources("ingresses")
|
21
|
+
options = ingresses.split(" ").map{|d| "ingresses/#{d}" }
|
22
|
+
return ui.prompt("Please select ingress to #{action_name}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
if option == "pods" && include_pods
|
26
|
+
ingresses = get_resources("pods")
|
27
|
+
options = ingresses.split(" ").map{|d| "pods/#{d}" }
|
28
|
+
return ui.prompt("Please select pod to #{action_name}", options)
|
29
|
+
end
|
30
|
+
|
31
|
+
option
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_resources(type)
|
35
|
+
kubectl_commands.get_resources(
|
36
|
+
local_shell, type,
|
37
|
+
jsonpath: ".items[*].metadata.name",
|
38
|
+
namespace: KuberKit.current_configuration.deployer_namespace
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
data/lib/kuber_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuber_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- lib/kuber_kit/image_compiler/image_builder.rb
|
274
274
|
- lib/kuber_kit/image_compiler/image_dependency_resolver.rb
|
275
275
|
- lib/kuber_kit/image_compiler/version_tag_builder.rb
|
276
|
+
- lib/kuber_kit/kubernetes/resources_fetcher.rb
|
276
277
|
- lib/kuber_kit/preprocessing/file_preprocessor.rb
|
277
278
|
- lib/kuber_kit/preprocessing/text_preprocessor.rb
|
278
279
|
- lib/kuber_kit/service_deployer/action_handler.rb
|