kuber_kit 0.9.8 → 1.0.0

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: 63fe40fb4674dd8e0fcad748f502d541f4fad27662b481a71647766f086c3d3f
4
- data.tar.gz: c1f4966e67d11cf860a4822846dcdde18cc2ca9651b8233d448cc225e12dbf25
3
+ metadata.gz: ff95234b5cab092203c9c2dd52adb49a2bfc8d18bb0ced534051f1851b7d7f2c
4
+ data.tar.gz: c1d81ba6a787226ffe66a976cc2eb33dca52ad0f0b2893cc7235ee76405afbfa
5
5
  SHA512:
6
- metadata.gz: a436fd78bd994fe89bbddd28b2a093286922aaace1718a5b7c0cbe568d48c0ddfe1dfd0badf2fdd7f0bdfa15a9fb7e4bbc6c19c3e25e80b4b4ef2a8d58b2c1e5
7
- data.tar.gz: 3b33b8f312664f1417c4f1bef6e23993ca69c98688ed276e1a4f8334ab0a7e940a912793a8f330cdfe0222276f482aa3b6155eb7905c40bfb19ce2e30dbe28c7
6
+ metadata.gz: 5c9dbc3157f13c253dd0d5385d4a31ff65c2053ed9099db21cb9d32b6376aba812593d5ab79add432d0b3f3d028b9fd4edd685cb42c0c267001f069d7bdc89ab
7
+ data.tar.gz: c93d98d9a7319c54ea4979972fc85eb6aeab06d6dc272c960851bf2e020dd10e29e7262de79632a6b82344140660eee898735fac257d84f7da06dcbe0bd3dfa3
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  strategy:
21
21
  matrix:
22
- ruby-version: ['2.5', '2.7', '3.0']
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
23
 
24
24
  steps:
25
25
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ **1.0.0**
2
+ - Bump stable release
3
+
4
+ **0.9.9**
5
+ - Fix updating artifact if it was force-pushed
6
+ - Improve resource selector, allow connecting to job via kit console
7
+
1
8
  **0.9.0-0.9.8**
2
9
  - Allow skipping confirmation during deployment
3
10
  - Added `kit sh` command to create a new shell
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,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.9.8"
2
+ VERSION = "1.0.0"
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.8
4
+ version: 1.0.0
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-10-17 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