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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2735934312125fca63822a1f45333ae928f4e053d9b6e9509a99036285e171a
|
4
|
+
data.tar.gz: 3045f6fb2cbe3d77313af0c3740edc3ae2dcd838cc46c65f672d419d6590d815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 613792df522946cf5b5fdf83447214549ca47976c5d5a3c2c24c32813535237674fb72e62ccca378ba437e0b3a2675047ed4db32e7a6f53dc8b2598377497ae4
|
7
|
+
data.tar.gz: e0f187c76817f7af79716816459683b731726b2ae296481229fbcee23f75c65b0d7e7d934da4c18330b5b20602c43688a1c4e02d7d9852a19bf68703df6cd819
|
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
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
|
-
|
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
|
|
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.2.
|
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-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|