kuber_kit 0.9.7 → 0.9.9

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: 22fa30a7280f081e3071589c5573ecfef1c92d0da6c93f887a4270ed8c3569a7
4
- data.tar.gz: 93bb6739fea844065a2a766888c5a1dbd0bb5be81939f6c22673d5cf04fcc1fd
3
+ metadata.gz: 8b6ab3e069fffd079331ea898a239d3d75e05a971d808f2c5cd77b15e27ee7aa
4
+ data.tar.gz: b616c542fa526c9604f011f93d05ff747374836422261a794b8a305b80a425c6
5
5
  SHA512:
6
- metadata.gz: 2881ba6ef63cc7a93674628308c0f50b3a1d41999b9e4d7068e32d3df046321640c3f1ef4eeadd807ca0382f6b132630985ef113f2a54970b44488312cec4b1a
7
- data.tar.gz: 5bf0b67143f884538587bd62c7817196417d7f6280af5066260fc3ca4bcc6ce86e4d7ff81b7178bb8559e500c40456f9d51e805ddf318e2c76d9777cf0805ead
6
+ metadata.gz: 49a41b9e13384858588715d34b4cb4bd1d5625cb2c6a7301dc14004bd26fc87b536ba708ef3c49b4c5bb0bbf3987cdbab72bf67674731682573ab58a75926d7c
7
+ data.tar.gz: b3ace178e76c7a13cdf267572ac1040693dec090ee460e6600664893a546466c6bea00435dfa9e99ba3b3fb6cdd996a51cabb2af3c526238420753a51dcc6e93
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- **0.9.0-0.9.7**
1
+ **0.9.9**
2
+ - Fix updating artifact if it was force-pushed
3
+ - Improve resource selector, allow connecting to job via kit console
4
+
5
+ **0.9.0-0.9.8**
2
6
  - Allow skipping confirmation during deployment
3
7
  - Added `kit sh` command to create a new shell
4
8
  - Use tmp dir as image builds parent dir for remote compilation
data/kuber_kit.gemspec CHANGED
@@ -34,6 +34,12 @@ Gem::Specification.new do |spec|
34
34
  else
35
35
  spec.add_dependency "dry-auto_inject", "~> 0.7.0"
36
36
  end
37
+
38
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
39
+ spec.add_dependency "dry-core", "~> 0.8.1"
40
+ else
41
+ spec.add_dependency "dry-core", "~> 0.7.1"
42
+ end
37
43
 
38
44
  spec.add_dependency "thor"
39
45
  spec.add_dependency "cli-ui"
@@ -13,7 +13,10 @@ class KuberKit::Actions::KubectlConsole
13
13
  deployer_namespace = KuberKit.current_configuration.deployer_namespace
14
14
 
15
15
  if !pod_name
16
- pod_name = resource_selector.call("attach")
16
+ pod_name = resource_selector.call("attach", additional_resources: [
17
+ KuberKit::Kubernetes::Resources::POD,
18
+ KuberKit::Kubernetes::Resources::JOB,
19
+ ])
17
20
  end
18
21
 
19
22
  kubectl_commands.exec(
@@ -12,7 +12,12 @@ class KuberKit::Actions::KubectlDescribe
12
12
  deployer_namespace = KuberKit.current_configuration.deployer_namespace
13
13
 
14
14
  if !resource_name
15
- resource_name = resource_selector.call("describe", include_ingresses: true, include_pods: true)
15
+ resource_name = resource_selector.call("describe", additional_resources: [
16
+ KuberKit::Kubernetes::Resources::INGRESS,
17
+ KuberKit::Kubernetes::Resources::POD,
18
+ KuberKit::Kubernetes::Resources::JOB,
19
+ KuberKit::Kubernetes::Resources::CRONJOB
20
+ ])
16
21
  end
17
22
 
18
23
  args = nil
@@ -6,26 +6,21 @@ class KuberKit::Kubernetes::ResourceSelector
6
6
  ]
7
7
 
8
8
  Contract String, KeywordArgs[
9
- include_ingresses: Optional[Bool],
10
- include_pods: Optional[Bool]
9
+ immediate_resource: Optional[String],
10
+ additional_resources: Optional[ArrayOf[String]]
11
11
  ] => Any
12
- def call(action_name, include_ingresses: false, include_pods: false)
13
- deployments = resources_fetcher.call("deployments")
14
- options = deployments.map{|d| "deploy/#{d}" }
15
- options << "ingresses" if include_ingresses
16
- options << "pods" if include_pods
12
+ def call(action_name, immediate_resource: "deploy", additional_resources: [])
13
+ deployments = resources_fetcher.call(immediate_resource)
14
+ options = deployments.map{|d| "#{immediate_resource}/#{d}" }
15
+ options += additional_resources
17
16
  option = ui.prompt("Please select resource to #{action_name}", options)
18
17
 
19
- if option == "ingresses" && include_ingresses
20
- ingresses = resources_fetcher.call("ingresses")
21
- options = ingresses.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 = resources_fetcher.call("pods")
27
- options = ingresses.map{|d| "pods/#{d}" }
28
- return ui.prompt("Please select pod to #{action_name}", options)
18
+ additional_resources.each do |resource_name|
19
+ if option == resource_name && additional_resources.include?(resource_name)
20
+ ingresses = resources_fetcher.call(resource_name)
21
+ options = ingresses.map{|d| "#{resource_name}/#{d}" }
22
+ return ui.prompt("Please select #{resource_name} to #{action_name}", options)
23
+ end
29
24
  end
30
25
 
31
26
  option
@@ -0,0 +1,7 @@
1
+ module KuberKit::Kubernetes::Resources
2
+ DEPLOY = "deploy"
3
+ INGRESS = "ingress"
4
+ POD = "pod"
5
+ JOB = "job"
6
+ CRONJOB = "cronjob"
7
+ end
@@ -8,6 +8,13 @@ class KuberKit::Shell::Commands::GitCommands
8
8
  return nil
9
9
  end
10
10
 
11
+ def get_version_hash(shell, git_repo_path)
12
+ shell.exec! [
13
+ "cd #{git_repo_path}",
14
+ "git rev-parse --short HEAD",
15
+ ].join(" && ")
16
+ end
17
+
11
18
  def download_repo(shell, remote_url:, path:, branch:)
12
19
  shell.exec! [
13
20
  "rm -rf #{path}",
@@ -22,6 +29,7 @@ class KuberKit::Shell::Commands::GitCommands
22
29
  "git add .",
23
30
  "git reset HEAD --hard",
24
31
  "git checkout #{branch}",
32
+ "git reset --hard '@{u}'",
25
33
  "git pull --force",
26
34
  ].join(" && ")
27
35
  end
@@ -1,6 +1,7 @@
1
1
  class KuberKit::Tools::BuildDirCleaner
2
2
  include KuberKit::Import[
3
3
  "shell.bash_commands",
4
+ "ui"
4
5
  ]
5
6
 
6
7
  KEEP_DIRS_COUNT = 10
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.9"
3
3
  end
data/lib/kuber_kit.rb CHANGED
@@ -210,6 +210,7 @@ module KuberKit
210
210
  module Kubernetes
211
211
  autoload :ResourceSelector, 'kubernetes/resource_selector'
212
212
  autoload :ResourcesFetcher, 'kubernetes/resources_fetcher'
213
+ autoload :Resources, 'kubernetes/resources'
213
214
  end
214
215
 
215
216
  module UI
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.9.7
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-core
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.1
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: thor
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -318,6 +332,7 @@ files:
318
332
  - lib/kuber_kit/image_compiler/image_dependency_resolver.rb
319
333
  - lib/kuber_kit/image_compiler/version_tag_builder.rb
320
334
  - lib/kuber_kit/kubernetes/resource_selector.rb
335
+ - lib/kuber_kit/kubernetes/resources.rb
321
336
  - lib/kuber_kit/kubernetes/resources_fetcher.rb
322
337
  - lib/kuber_kit/preprocessing/file_preprocessor.rb
323
338
  - lib/kuber_kit/preprocessing/text_preprocessor.rb