kuber_kit 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/TODO.md +0 -1
- data/lib/kuber_kit.rb +1 -0
- data/lib/kuber_kit/actions/kubectl_get.rb +30 -0
- data/lib/kuber_kit/cli.rb +10 -1
- data/lib/kuber_kit/container.rb +4 -0
- data/lib/kuber_kit/service_deployer/service_list_resolver.rb +2 -2
- data/lib/kuber_kit/shell/local_shell.rb +15 -1
- data/lib/kuber_kit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9573dca431e801716912c8dd4a51ea9d5e948d99e91c53e64385b317bc22dbe9
|
4
|
+
data.tar.gz: 7d162cc2036567c55ec9258d86dacb90354bc55c0914ed2c782d5aa0304ec50f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76846e6ac4744e9267c1a6f34571edd43c63fb17398014c2916f9bba558f4e026e6663e515f3dfaef758acc0ed3b7915662920a696fa03b2f962f217befdf37d
|
7
|
+
data.tar.gz: b348f513b6dc6448966b67c89babfb625387c0f1b272338cf0064db5c76ea6d8e036430a556cd2cace548198495f026ca13b6c29d7f1d20462ab0fd8b0f5cfbb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
**0.5.3**
|
2
|
+
- Change the symbol to exclude service from "-" to "!", you can pass "-s !auth_app" to exclude "auth_app"
|
3
|
+
- Added kit get command to find pods
|
4
|
+
|
1
5
|
**0.5.2**
|
2
6
|
- Added dependencies support to services
|
3
7
|
- Added an option to deploy all services in `kit deloy`
|
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
data/lib/kuber_kit.rb
CHANGED
@@ -176,6 +176,7 @@ module KuberKit
|
|
176
176
|
autoload :KubectlAttacher, 'actions/kubectl_attacher'
|
177
177
|
autoload :KubectlConsole, 'actions/kubectl_console'
|
178
178
|
autoload :KubectlDescribe, 'actions/kubectl_describe'
|
179
|
+
autoload :KubectlGet, 'actions/kubectl_get'
|
179
180
|
autoload :KubectlLogs, 'actions/kubectl_logs'
|
180
181
|
autoload :KubectlEnv, 'actions/kubectl_env'
|
181
182
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class KuberKit::Actions::KubectlGet
|
2
|
+
include KuberKit::Import[
|
3
|
+
"shell.kubectl_commands",
|
4
|
+
"shell.local_shell",
|
5
|
+
"kubernetes.resource_selector",
|
6
|
+
"ui"
|
7
|
+
]
|
8
|
+
|
9
|
+
Contract Maybe[String], Hash => Any
|
10
|
+
def call(resource_name, options)
|
11
|
+
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
12
|
+
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
13
|
+
|
14
|
+
resources = kubectl_commands.get_resources(
|
15
|
+
local_shell, "pod",
|
16
|
+
kubeconfig_path: kubeconfig_path,
|
17
|
+
namespace: deployer_namespace
|
18
|
+
)
|
19
|
+
|
20
|
+
matching_resources = resources.select{|r| r.include?(resource_name) }
|
21
|
+
|
22
|
+
ui.print_info("Pods", matching_resources.join("\n"))
|
23
|
+
|
24
|
+
true
|
25
|
+
rescue KuberKit::Error => e
|
26
|
+
ui.print_error("Error", e.message)
|
27
|
+
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
data/lib/kuber_kit/cli.rb
CHANGED
@@ -30,7 +30,7 @@ class KuberKit::CLI < Thor
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
desc "deploy -t
|
33
|
+
desc "deploy -t TAG_NAME", "Deploy CONTEXT_NAME with kubectl"
|
34
34
|
method_option :services, :type => :array, aliases: ["-s"], repeatable: true
|
35
35
|
method_option :tags, :type => :array, aliases: ["-t"], repeatable: true
|
36
36
|
method_option :skip_compile, :type => :boolean, aliases: ["-B"]
|
@@ -150,6 +150,15 @@ class KuberKit::CLI < Thor
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
+
desc "get RESOURCE_NAME", "List pods matching RESOURCE_NAME using kubectl"
|
154
|
+
def get(pod_name = nil)
|
155
|
+
setup(options)
|
156
|
+
|
157
|
+
if KuberKit::Container['actions.configuration_loader'].call(options.merge(load_inventory: false))
|
158
|
+
KuberKit::Container['actions.kubectl_get'].call(pod_name, options)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
153
162
|
desc "version", "Print current version"
|
154
163
|
def version
|
155
164
|
puts KuberKit::VERSION
|
data/lib/kuber_kit/container.rb
CHANGED
@@ -41,9 +41,9 @@ class KuberKit::ServiceDeployer::ServiceListResolver
|
|
41
41
|
|
42
42
|
Contract Array => Array
|
43
43
|
def split_by_inclusion(array)
|
44
|
-
excluded, included = array.partition{|e| e.start_with?('
|
44
|
+
excluded, included = array.partition{|e| e.start_with?('!') }
|
45
45
|
|
46
|
-
excluded.map!{ |item| item.gsub(
|
46
|
+
excluded.map!{ |item| item.gsub(/^\!/, "") }
|
47
47
|
|
48
48
|
[included, excluded]
|
49
49
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
4
|
+
MAX_LINES_TO_PRINT = 50
|
5
|
+
|
4
6
|
include KuberKit::Import[
|
5
7
|
"shell.command_counter",
|
6
8
|
"shell.rsync_commands",
|
@@ -20,7 +22,19 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
|
20
22
|
end
|
21
23
|
|
22
24
|
if result && result != "" && log_command
|
23
|
-
|
25
|
+
print_result = result
|
26
|
+
print_result_lines = print_result.split("\n")
|
27
|
+
|
28
|
+
if print_result_lines.count >= MAX_LINES_TO_PRINT
|
29
|
+
print_result = [
|
30
|
+
"[Result is too long, showing only first and last items]".yellow,
|
31
|
+
print_result_lines.first,
|
32
|
+
"[#{print_result_lines.count - 2} lines not showing]".yellow,
|
33
|
+
print_result_lines.last
|
34
|
+
].join("\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
ui.print_debug("LocalShell", "Finished [#{command_number}] with result: \n ----\n#{print_result.grey}\n ----")
|
24
38
|
end
|
25
39
|
|
26
40
|
if $?.exitstatus != 0
|
data/lib/kuber_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuber_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/kuber_kit/actions/kubectl_console.rb
|
212
212
|
- lib/kuber_kit/actions/kubectl_describe.rb
|
213
213
|
- lib/kuber_kit/actions/kubectl_env.rb
|
214
|
+
- lib/kuber_kit/actions/kubectl_get.rb
|
214
215
|
- lib/kuber_kit/actions/kubectl_logs.rb
|
215
216
|
- lib/kuber_kit/actions/service_checker.rb
|
216
217
|
- lib/kuber_kit/actions/service_deployer.rb
|