kuber_kit 0.1.7 → 0.1.8

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: 7860f397b95796df7a9304a6fa169b31a3bd9e163e0e38def0c7d73c94dad95e
4
- data.tar.gz: 0ab17643bf762719394883b91cb08f5009d34e6ae9dbe823e27dd6f81b42f429
3
+ metadata.gz: 37500e0f3feb9e241251e04ae72ed0cc618d5dadf3e1c660a05658a0e5fefa15
4
+ data.tar.gz: 82d7c67f5f421fed5cbb94f14ad153dcb6f6f2f068817ffd518f6c0ea7cfe3f8
5
5
  SHA512:
6
- metadata.gz: 5853d09c155988787409f6748280b4f65c57074d3d1dc6b2f5769231768596dadcc7cc811f3a68fd72db51984db031b15eaffe59e34fce3897177f2686aa389a
7
- data.tar.gz: 6871768abcf20b78b673db0f859f17d4b42835f6876b0bac4774ee854b4c6d702b51a574a404f91f06303c57967f584c4a83f8730f843918468e63e2d9b338b6
6
+ metadata.gz: 63c544b4ee93bf01f7d36720effff85052643583b008d68327c10bcbceb5711bce976856da1e6c56c9f877720eb2735447574e534f9f97a966777156ee01bda3
7
+ data.tar.gz: d388233a8636e884ee033971bf8365f3b5e753dc43a22b5e03702dda764e0632003dc80448fd7a9f3378e98539e06bc25f8163dcd6c85fdd67afddba2f141c80
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.1.7)
4
+ kuber_kit (0.1.8)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
@@ -1,3 +1,6 @@
1
1
  KuberKit
2
2
  .define_service(:env_file)
3
- .template(:env_file)
3
+ .template(:env_file)
4
+ .attributes(
5
+ deployment_restart_enabled: false
6
+ )
@@ -50,6 +50,8 @@ class KuberKit::Actions::ConfigurationLoader
50
50
  files = service_store.load_definitions(services_path)
51
51
  task.update_title("Loaded #{files.count} service definitions")
52
52
  end
53
+ rescue KuberKit::Error => e
54
+ ui.print_error("Error", e.message)
53
55
  end
54
56
 
55
57
  def load_configurations(configurations_path, configuration_name)
@@ -11,5 +11,7 @@ class KuberKit::Actions::EnvFileReader
11
11
  def call(env_file_name, options)
12
12
  result = env_file_reader.call(local_shell, env_file_name)
13
13
  ui.print_info(env_file_name.to_s, JSON.pretty_generate(result))
14
+ rescue KuberKit::Error => e
15
+ ui.print_error("Error", e.message)
14
16
  end
15
17
  end
@@ -21,6 +21,8 @@ class KuberKit::Actions::ImageCompiler
21
21
  end
22
22
 
23
23
  compile_simultaneously(image_names - resolved_dependencies, build_id)
24
+ rescue KuberKit::Error => e
25
+ ui.print_error("Error", e.message)
24
26
  end
25
27
 
26
28
  private
@@ -13,5 +13,7 @@ class KuberKit::Actions::KubectlApplier
13
13
  task.update_title("Applied file: #{file_path}")
14
14
  end
15
15
  nil
16
+ rescue KuberKit::Error => e
17
+ ui.print_error("Error", e.message)
16
18
  end
17
19
  end
@@ -31,6 +31,8 @@ class KuberKit::Actions::ServiceDeployer
31
31
 
32
32
  compile_images(images_names)
33
33
  deploy_services(service_names)
34
+ rescue KuberKit::Error => e
35
+ ui.print_error("Error", e.message)
34
36
  end
35
37
 
36
38
  def deploy_services(service_names)
@@ -10,5 +10,7 @@ class KuberKit::Actions::ServiceReader
10
10
  result = service_reader.call(local_shell, service_name)
11
11
 
12
12
  ui.print_info(service_name.to_s, result)
13
+ rescue KuberKit::Error => e
14
+ ui.print_error("Error", e.message)
13
15
  end
14
16
  end
@@ -13,5 +13,7 @@ class KuberKit::Actions::TemplateReader
13
13
  result = reader.read(local_shell, template)
14
14
 
15
15
  ui.print_info(template_name.to_s, result)
16
+ rescue KuberKit::Error => e
17
+ ui.print_error("Error", e.message)
16
18
  end
17
19
  end
@@ -42,4 +42,12 @@ class KuberKit::Core::Artifacts::ArtifactStore
42
42
  def reset!
43
43
  @@artifacts = {}
44
44
  end
45
+
46
+ def all_definitions
47
+ @@artifacts ||= {}
48
+ end
49
+
50
+ def exists?(artifact_name)
51
+ !all_definitions[artifact_name].nil?
52
+ end
45
53
  end
@@ -17,7 +17,7 @@ class KuberKit::Core::ContextHelper::ServiceHelper < KuberKit::Core::ContextHelp
17
17
  @service.uri
18
18
  end
19
19
 
20
- def attribute(attribute_name)
21
- @service.attribute(attribute_name)
20
+ def attribute(attribute_name, default: nil)
21
+ @service.attribute(attribute_name, default: default)
22
22
  end
23
23
  end
@@ -22,11 +22,15 @@ class KuberKit::Core::Service
22
22
  name.to_s.gsub("_", "-")
23
23
  end
24
24
 
25
- def attribute(attribute_name)
26
- unless attributes.has_key?(attribute_name.to_sym)
25
+ def attribute(attribute_name, default: nil)
26
+ if !attributes.has_key?(attribute_name.to_sym) && default.nil?
27
27
  raise AttributeNotSet, "attribute #{attribute_name} was not set"
28
28
  end
29
29
 
30
+ if !attributes.has_key?(attribute_name.to_sym) && !default.nil?
31
+ return default
32
+ end
33
+
30
34
  attributes[attribute_name.to_sym]
31
35
  end
32
36
  end
@@ -42,4 +42,12 @@ class KuberKit::Core::Templates::TemplateStore
42
42
  def reset!
43
43
  @@templates = {}
44
44
  end
45
+
46
+ def all_definitions
47
+ @@templates ||= {}
48
+ end
49
+
50
+ def exists?(template_name)
51
+ !all_definitions[template_name].nil?
52
+ end
45
53
  end
@@ -13,6 +13,11 @@ class KuberKit::ServiceDeployer::Strategies::Kubernetes < KuberKit::ServiceDeplo
13
13
 
14
14
  kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
15
15
  kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path)
16
- kubectl_commands.rolling_restart(shell, service.uri, kubeconfig_path: kubeconfig_path)
16
+
17
+ deployment_restart_enabled = service.attribute(:deployment_restart_enabled, default: true)
18
+ deployment_restart_name = service.attribute(:deployment_restart_name, default: service.uri)
19
+ if deployment_restart_enabled
20
+ kubectl_commands.rolling_restart(shell, deployment_restart_name, kubeconfig_path: kubeconfig_path)
21
+ end
17
22
  end
18
23
  end
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuber_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev