kuber_kit 0.2.6 → 0.2.7

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: 1a60a34aefa8bd114c7bcb0f877495619c6bc5d4060f3178d6810b767264e5d7
4
- data.tar.gz: 8b6771ac06f2c9fb3c86c810657d3f0d0368fbb4f11d37f410b87a3e7586b0c7
3
+ metadata.gz: e2735934312125fca63822a1f45333ae928f4e053d9b6e9509a99036285e171a
4
+ data.tar.gz: 3045f6fb2cbe3d77313af0c3740edc3ae2dcd838cc46c65f672d419d6590d815
5
5
  SHA512:
6
- metadata.gz: f342d97d51f6b6ad375e8d3a112cd13b186b9ea16ff34a517e62a62c50fb307b74aaeabbfc42de001a3c9a8960c09a0c3c9e5e3bab33f47cefeb260bee8dc992
7
- data.tar.gz: cb67b78fd74831a2bc3b39c9ac035ff06f848c1b63dde2c5725ff2d73fc08247ef9f666f88c88ea3e4ffdfda963cbdcbc96756e591205a80bcc983eaab0742b7
6
+ metadata.gz: 613792df522946cf5b5fdf83447214549ca47976c5d5a3c2c24c32813535237674fb72e62ccca378ba437e0b3a2675047ed4db32e7a6f53dc8b2598377497ae4
7
+ data.tar.gz: e0f187c76817f7af79716816459683b731726b2ae296481229fbcee23f75c65b0d7e7d934da4c18330b5b20602c43688a1c4e02d7d9852a19bf68703df6cd819
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.2.6)
4
+ kuber_kit (0.2.7)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
data/TODO.md CHANGED
@@ -1,4 +1,5 @@
1
- - find a way to launch job on each run, e.g. for migrations
1
+ - add config file support to kuber_kit root folder
2
+ - find a way to always deploy some service, e.g. for migrations and env_files
2
3
  - allow setting default configuration for kuberkit using env variable
3
4
  - add ability to set container health checks
4
5
  - implement interactive shell.exec!
@@ -19,9 +19,17 @@ class KuberKit::ServiceDeployer::Strategies::KubernetesRunner < KuberKit::Servic
19
19
 
20
20
  deployment_delete_enabled = service.attribute(:deployment_delete_enabled, default: true)
21
21
  if deployment_delete_enabled
22
- kubectl_commands.delete_resource(shell, deployment_resource_type, deployment_resource_name, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
22
+ delete_resource_if_exists(shell, deployment_resource_type, deployment_resource_name, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
23
23
  end
24
24
 
25
25
  kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
26
26
  end
27
+
28
+ private
29
+ def delete_resource_if_exists(shell, resource_type, resource_name, kubeconfig_path:, namespace: )
30
+ unless kubectl_commands.resource_exists?(shell, resource_type, resource_name, kubeconfig_path: kubeconfig_path, namespace: namespace)
31
+ return false
32
+ end
33
+ kubectl_commands.delete_resource(shell, resource_type, resource_name, kubeconfig_path: kubeconfig_path, namespace: namespace)
34
+ end
27
35
  end
@@ -41,6 +41,17 @@ class KuberKit::Shell::Commands::KubectlCommands
41
41
  kubectl_run(shell, command_parts, kubeconfig_path: kubeconfig_path, interactive: interactive, namespace: namespace)
42
42
  end
43
43
 
44
+ def resource_exists?(shell, resource_type, resource_name, kubeconfig_path: nil, namespace: nil)
45
+ result = find_resources(shell, resource_type, resource_name, kubeconfig_path: kubeconfig_path, namespace: namespace)
46
+ result && result != ""
47
+ end
48
+
49
+ def find_resources(shell, resource_type, resource_name, jsonpath: ".items[*].metadata.name", kubeconfig_path: nil, namespace: nil)
50
+ command = %Q{get #{resource_type} --field-selector=metadata.name=#{resource_name} -o jsonpath='{#{jsonpath}}'}
51
+
52
+ kubectl_run(shell, command, kubeconfig_path: kubeconfig_path, namespace: namespace)
53
+ end
54
+
44
55
  def delete_resource(shell, resource_type, resource_name, kubeconfig_path: nil, namespace: nil)
45
56
  command = %Q{delete #{resource_type} #{resource_name}}
46
57
 
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
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.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-03 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts-lite