kuber_kit 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3acad6e0224702a4f70ae02d93c16bc766e1e36d75ee33cbc5d2fb15118d35e
4
- data.tar.gz: 8903414dfacb859f883298b21ac2d30dd08e93597044e325b253c0f5cd5c8709
3
+ metadata.gz: 88cc2d5d20c0f1bc958f8ecd8682ff66069cd95867b44e717c29adde0378c0c2
4
+ data.tar.gz: a3ebb9fd30393f45fab0f0ddfcd6aa8569777655a6a407bfe4df653b94e31123
5
5
  SHA512:
6
- metadata.gz: e5c368de0b96bfd89f80004d1c4fa0a0a5355c6116768fd0b86d7eb0191719ba11b646b1e202f40c08276d06bfb50d423659cb49a488f9573788a51638273cdc
7
- data.tar.gz: c0da8c721a80b02b41ee4c6430c175678f792271c3e9f10fba55784e7ea7f8013ffd09b989c043a723c234350340347176ab5c59541e3e1b9b98ebb60f6800dc
6
+ metadata.gz: 275c26b658b4f0739a364bbbc58e1ec03bc45bbeeb7d4dec8988ff8f2f7c598ef43e96a15991f0201c271259380a3949b48dccd6f5f3ab6a88c541f3f38f5a68
7
+ data.tar.gz: 7f3780629d0836443d20914551b427ce557e35f336c7640a4da6c70eee0380616a4fbeefab23154306254bf6c86693f44388c527ed7e2490139f5210353a2357
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.2.3)
4
+ kuber_kit (0.2.4)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
data/TODO.md CHANGED
@@ -1,5 +1,6 @@
1
1
  - find a way to launch job on each run, e.g. for migrations
2
2
  - allow setting default configuration for kuberkit using env variable
3
+ - add ability to set container health checks
3
4
  - implement interactive shell.exec!
4
5
  - allow deploying only services enabled for specific configuration
5
6
  - list services and require confirmation before deployment
@@ -68,7 +68,15 @@ class KuberKit::Actions::ServiceDeployer
68
68
  specific_service_option = "deploy specific service"
69
69
 
70
70
  tags = [specific_service_option]
71
- tags += service_store.all_definitions.values.map(&:to_service_attrs).map(&:tags).flatten.uniq.map(&:to_s)
71
+ tags += service_store
72
+ .all_definitions
73
+ .values
74
+ .map(&:to_service_attrs)
75
+ .map(&:tags)
76
+ .flatten
77
+ .uniq
78
+ .sort
79
+ .map(&:to_s)
72
80
 
73
81
  ui.prompt("Please select which tag to deploy", tags) do |selected_tag|
74
82
  if selected_tag == specific_service_option
@@ -80,7 +88,13 @@ class KuberKit::Actions::ServiceDeployer
80
88
  end
81
89
 
82
90
  def show_service_selection()
83
- services = service_store.all_definitions.values.map(&:service_name).uniq.map(&:to_s)
91
+ services = service_store
92
+ .all_definitions
93
+ .values
94
+ .map(&:service_name)
95
+ .uniq
96
+ .sort
97
+ .map(&:to_s)
84
98
 
85
99
  ui.prompt("Please select which service to deploy", services) do |selected_service|
86
100
  return [[selected_service], []]
@@ -1,21 +1,23 @@
1
1
  class KuberKit::Core::Service
2
2
  AttributeNotSet = Class.new(Indocker::Error)
3
3
 
4
- attr_reader :name, :template_name, :tags, :images, :attributes
4
+ attr_reader :name, :template_name, :tags, :images, :attributes, :deploy_strategy
5
5
 
6
6
  Contract KeywordArgs[
7
- name: Symbol,
8
- template_name: Symbol,
9
- tags: ArrayOf[Symbol],
10
- images: ArrayOf[Symbol],
11
- attributes: HashOf[Symbol => Any],
7
+ name: Symbol,
8
+ template_name: Symbol,
9
+ tags: ArrayOf[Symbol],
10
+ images: ArrayOf[Symbol],
11
+ attributes: HashOf[Symbol => Any],
12
+ deploy_strategy: Maybe[Symbol]
12
13
  ] => Any
13
- def initialize(name:, template_name:, tags:, images:, attributes:)
14
+ def initialize(name:, template_name:, tags:, images:, attributes:, deploy_strategy:)
14
15
  @name = name
15
16
  @template_name = template_name
16
17
  @tags = tags
17
18
  @images = images
18
19
  @attributes = attributes
20
+ @deploy_strategy = deploy_strategy
19
21
  end
20
22
 
21
23
  def uri
@@ -8,11 +8,12 @@ class KuberKit::Core::ServiceDefinition
8
8
 
9
9
  def to_service_attrs
10
10
  OpenStruct.new(
11
- name: @service_name,
12
- template_name: get_value(@template_name),
13
- tags: Array(get_value(@tags)).map(&:to_sym),
14
- images: Array(get_value(@images)).map(&:to_sym),
15
- attributes: get_value(@attributes),
11
+ name: @service_name,
12
+ template_name: get_value(@template_name),
13
+ tags: Array(get_value(@tags)).map(&:to_sym),
14
+ images: Array(get_value(@images)).map(&:to_sym),
15
+ attributes: get_value(@attributes),
16
+ deploy_strategy: get_value(@deploy_strategy),
16
17
  )
17
18
  end
18
19
 
@@ -40,6 +41,12 @@ class KuberKit::Core::ServiceDefinition
40
41
  self
41
42
  end
42
43
 
44
+ def deploy_strategy(value = nil, &block)
45
+ @deploy_strategy = block_given? ? block : value
46
+
47
+ self
48
+ end
49
+
43
50
  private
44
51
  def get_value(variable)
45
52
  variable.is_a?(Proc) ? variable.call : variable
@@ -12,11 +12,12 @@ class KuberKit::Core::ServiceFactory
12
12
  attributes = (service_attrs.attributes || {}).merge(configuration_attributes)
13
13
 
14
14
  KuberKit::Core::Service.new(
15
- name: service_attrs.name,
16
- template_name: service_attrs.template_name,
17
- tags: service_attrs.tags,
18
- images: service_attrs.images,
19
- attributes: attributes
15
+ name: service_attrs.name,
16
+ template_name: service_attrs.template_name,
17
+ tags: service_attrs.tags,
18
+ images: service_attrs.images,
19
+ attributes: attributes,
20
+ deploy_strategy: service_attrs.deploy_strategy,
20
21
  )
21
22
  end
22
23
  end
@@ -1,6 +1,6 @@
1
1
  class KuberKit::ServiceDeployer::StrategyDetector
2
2
  Contract KuberKit::Core::Service => Symbol
3
3
  def call(service)
4
- KuberKit.current_configuration.deploy_strategy
4
+ service.deploy_strategy || KuberKit.current_configuration.deploy_strategy
5
5
  end
6
6
  end
@@ -41,6 +41,12 @@ 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 delete_resource(shell, resource_type, resource_name, kubeconfig_path: nil, namespace: nil)
45
+ command = %Q{delete #{resource_type} #{resource_name}}
46
+
47
+ kubectl_run(shell, command, kubeconfig_path: kubeconfig_path, namespace: namespace)
48
+ end
49
+
44
50
  def rolling_restart(shell, deployment_name, kubeconfig_path: nil, namespace: nil)
45
51
  patch_deployment(shell, deployment_name, {
46
52
  spec: {
@@ -30,8 +30,8 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
30
30
  result
31
31
  end
32
32
 
33
- def sync(local_path, remote_path, exclude: nil)
34
- rsync_commands.rsync(self, local_path, remote_path, exclude: exclude)
33
+ def sync(local_path, remote_path, exclude: nil, delete: true)
34
+ rsync_commands.rsync(self, local_path, remote_path, exclude: exclude, delete: delete)
35
35
  end
36
36
 
37
37
  def read(file_path)
@@ -38,11 +38,12 @@ class KuberKit::Shell::SshShell < KuberKit::Shell::LocalShell
38
38
  raise ShellError.new(e.message)
39
39
  end
40
40
 
41
- def sync(local_path, remote_path, exclude: nil)
41
+ def sync(local_path, remote_path, exclude: nil, delete: true)
42
42
  rsync_commands.rsync(
43
43
  local_shell, local_path, remote_path,
44
44
  target_host: "#{ssh_session.user}@#{ssh_session.host}",
45
- exclude: exclude
45
+ exclude: exclude,
46
+ delete: delete
46
47
  )
47
48
  end
48
49
 
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev