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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 485e80726d7350ce239a165860ba4096b3549178d10e5ff8abdc918df983ab4c
4
- data.tar.gz: 480a475c88bf4a6626a182ade7909e0a08143a978d96471faf0c2495021abf6a
3
+ metadata.gz: 9573dca431e801716912c8dd4a51ea9d5e948d99e91c53e64385b317bc22dbe9
4
+ data.tar.gz: 7d162cc2036567c55ec9258d86dacb90354bc55c0914ed2c782d5aa0304ec50f
5
5
  SHA512:
6
- metadata.gz: d285c169ea188e3c8d4679db94ea74a7c3b5cabc993fbd41e675d590505d1f714836de4b052cd1b1793d810069b1d61f2520d78bcc8c538a6efaa95730f0dc2d
7
- data.tar.gz: b645418d23a5e68f5bebf571dcd2853d460cadd42247ccc749b5c938825b08671059fedd3cbb83fd960cc3deb8a6eb0a121c11468e4dc7e365dc89b803046383
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.5.2)
4
+ kuber_kit (0.5.3)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
data/TODO.md CHANGED
@@ -1,4 +1,3 @@
1
- - do not show result for images list, if list is too large (Mikhail)
2
1
  - add kit get method for more interactive kubernetes
3
2
  - env files should use a separate deployment method (with change detection)
4
3
  - add automatical confirmation support for service deployer
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 CONTEXT_NAME", "Deploy CONTEXT_NAME with kubectl"
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
@@ -45,6 +45,10 @@ class KuberKit::Container
45
45
  KuberKit::Actions::KubectlDescribe.new
46
46
  end
47
47
 
48
+ register "actions.kubectl_get" do
49
+ KuberKit::Actions::KubectlGet.new
50
+ end
51
+
48
52
  register "actions.kubectl_logs" do
49
53
  KuberKit::Actions::KubectlLogs.new
50
54
  end
@@ -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
- ui.print_debug("LocalShell", "Finished [#{command_number}] with result: \n ----\n#{result.grey}\n ----")
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
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
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.2
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-12 00:00:00.000000000 Z
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