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 +4 -4
- data/Gemfile.lock +1 -1
- data/TODO.md +1 -0
- data/lib/kuber_kit/actions/service_deployer.rb +16 -2
- data/lib/kuber_kit/core/service.rb +9 -7
- data/lib/kuber_kit/core/service_definition.rb +12 -5
- data/lib/kuber_kit/core/service_factory.rb +6 -5
- data/lib/kuber_kit/service_deployer/strategy_detector.rb +1 -1
- data/lib/kuber_kit/shell/commands/kubectl_commands.rb +6 -0
- data/lib/kuber_kit/shell/local_shell.rb +2 -2
- data/lib/kuber_kit/shell/ssh_shell.rb +3 -2
- data/lib/kuber_kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88cc2d5d20c0f1bc958f8ecd8682ff66069cd95867b44e717c29adde0378c0c2
|
|
4
|
+
data.tar.gz: a3ebb9fd30393f45fab0f0ddfcd6aa8569777655a6a407bfe4df653b94e31123
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 275c26b658b4f0739a364bbbc58e1ec03bc45bbeeb7d4dec8988ff8f2f7c598ef43e96a15991f0201c271259380a3949b48dccd6f5f3ab6a88c541f3f38f5a68
|
|
7
|
+
data.tar.gz: 7f3780629d0836443d20914551b427ce557e35f336c7640a4da6c70eee0380616a4fbeefab23154306254bf6c86693f44388c527ed7e2490139f5210353a2357
|
data/Gemfile.lock
CHANGED
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
|
|
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
|
|
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:
|
|
8
|
-
template_name:
|
|
9
|
-
tags:
|
|
10
|
-
images:
|
|
11
|
-
attributes:
|
|
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:
|
|
12
|
-
template_name:
|
|
13
|
-
tags:
|
|
14
|
-
images:
|
|
15
|
-
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:
|
|
16
|
-
template_name:
|
|
17
|
-
tags:
|
|
18
|
-
images:
|
|
19
|
-
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
|
|
@@ -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
|
|
data/lib/kuber_kit/version.rb
CHANGED