kuber_kit 0.2.0 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/TODO.md +4 -0
- data/bin/kit +0 -1
- data/example/services/env_file.rb +1 -0
- data/example/services/ruby_app.rb +2 -1
- data/lib/kuber_kit.rb +1 -0
- data/lib/kuber_kit/actions/kubectl_applier.rb +3 -2
- data/lib/kuber_kit/actions/kubectl_attacher.rb +8 -1
- data/lib/kuber_kit/actions/service_deployer.rb +41 -0
- data/lib/kuber_kit/cli.rb +4 -1
- data/lib/kuber_kit/core/configuration.rb +5 -3
- data/lib/kuber_kit/core/configuration_definition.rb +8 -1
- data/lib/kuber_kit/core/configuration_factory.rb +1 -0
- 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/image_compiler/build_server_pool.rb +10 -9
- data/lib/kuber_kit/service_deployer/strategies/kubernetes.rb +5 -3
- data/lib/kuber_kit/service_deployer/strategies/kubernetes_runner.rb +27 -0
- data/lib/kuber_kit/service_deployer/strategy_detector.rb +1 -1
- data/lib/kuber_kit/shell/commands/kubectl_commands.rb +30 -25
- data/lib/kuber_kit/shell/local_shell.rb +2 -2
- data/lib/kuber_kit/shell/ssh_session.rb +2 -0
- data/lib/kuber_kit/shell/ssh_shell.rb +3 -2
- data/lib/kuber_kit/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f32cf040d33941d931b9e5fa2f67c8132f6538e4301f2f533531e2524410ee91
|
4
|
+
data.tar.gz: 2f769ec987b79ad51f594237968698515fea823cefdc0382d2631e3f7b0abbc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f532ee9af8a02191d4a895f30647fb7d30abf63573e93b3616ee17adb657ed6f220ac0fc79a8b2a1bdc2a7f542bfc341937ef631835f0e2c4534505ce38b55
|
7
|
+
data.tar.gz: 24f8f053b3ef45ab3dc277d6d255b9334f4afa3c68490df1dd47f4fc2198aaf4b53584eb06040319e5cd87822b179d979ebaf1e7a4f9a36cf7d92170be28d5e5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kuber_kit (0.2.
|
4
|
+
kuber_kit (0.2.5)
|
5
5
|
cli-ui
|
6
6
|
contracts-lite
|
7
7
|
dry-auto_inject
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
dry-container (0.7.2)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
28
|
dry-configurable (~> 0.1, >= 0.1.3)
|
29
|
-
dry-core (0.4.
|
29
|
+
dry-core (0.4.10)
|
30
30
|
concurrent-ruby (~> 1.0)
|
31
31
|
dry-equalizer (0.3.0)
|
32
32
|
method_source (1.0.0)
|
data/README.md
CHANGED
@@ -17,13 +17,13 @@ gem 'kuber_kit'
|
|
17
17
|
### Launch compilation
|
18
18
|
|
19
19
|
```
|
20
|
-
bin/kit compile ruby_app,ruby_app2 --path=./example
|
20
|
+
bundle exec bin/kit compile ruby_app,ruby_app2 --path=./example
|
21
21
|
```
|
22
22
|
|
23
23
|
### Launch deployment
|
24
24
|
|
25
25
|
```
|
26
|
-
bin/kit compile -s ruby_app,ruby_app2 --path=./example
|
26
|
+
bundle exec bin/kit compile -s ruby_app,ruby_app2 --path=./example
|
27
27
|
```
|
28
28
|
|
29
29
|
|
data/TODO.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
- find a way to launch job on each run, e.g. for migrations
|
2
|
+
- allow setting default configuration for kuberkit using env variable
|
3
|
+
- add ability to set container health checks
|
1
4
|
- implement interactive shell.exec!
|
5
|
+
- allow deploying only services enabled for specific configuration
|
2
6
|
- list services and require confirmation before deployment
|
3
7
|
- add build vars support (use images instead of containers)
|
4
8
|
- template should be able to set default attributes
|
data/bin/kit
CHANGED
data/lib/kuber_kit.rb
CHANGED
@@ -141,6 +141,7 @@ module KuberKit
|
|
141
141
|
module Strategies
|
142
142
|
autoload :Abstract, 'service_deployer/strategies/abstract'
|
143
143
|
autoload :Kubernetes, 'service_deployer/strategies/kubernetes'
|
144
|
+
autoload :KubernetesRunner, 'service_deployer/strategies/kubernetes_runner'
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
@@ -7,9 +7,10 @@ class KuberKit::Actions::KubectlApplier
|
|
7
7
|
|
8
8
|
Contract String, Hash => Any
|
9
9
|
def call(file_path, options)
|
10
|
-
kubeconfig_path
|
10
|
+
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
11
|
+
deploy_namespace = KuberKit.current_configuration.deploy_namespace
|
11
12
|
ui.create_task("Applying file: #{file_path}") do |task|
|
12
|
-
kubectl_commands.apply_file(local_shell, file_path, kubeconfig_path: kubeconfig_path)
|
13
|
+
kubectl_commands.apply_file(local_shell, file_path, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
|
13
14
|
task.update_title("Applied file: #{file_path}")
|
14
15
|
end
|
15
16
|
|
@@ -8,7 +8,14 @@ class KuberKit::Actions::KubectlAttacher
|
|
8
8
|
Contract String, Hash => Any
|
9
9
|
def call(pod_name, options)
|
10
10
|
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
11
|
-
|
11
|
+
deploy_namespace = KuberKit.current_configuration.deploy_namespace
|
12
|
+
|
13
|
+
kubectl_commands.exec(
|
14
|
+
local_shell, pod_name, "bash", args: "-it",
|
15
|
+
kubeconfig_path: kubeconfig_path,
|
16
|
+
interactive: true,
|
17
|
+
namespace: deploy_namespace
|
18
|
+
)
|
12
19
|
|
13
20
|
true
|
14
21
|
rescue KuberKit::Error => e
|
@@ -14,6 +14,10 @@ class KuberKit::Actions::ServiceDeployer
|
|
14
14
|
tags: Maybe[ArrayOf[String]],
|
15
15
|
] => Any
|
16
16
|
def call(services:, tags:)
|
17
|
+
if services.empty? && tags.empty?
|
18
|
+
services, tags = show_tags_selection
|
19
|
+
end
|
20
|
+
|
17
21
|
service_names = service_list_resolver.resolve(
|
18
22
|
services: services || [],
|
19
23
|
tags: tags || []
|
@@ -59,4 +63,41 @@ class KuberKit::Actions::ServiceDeployer
|
|
59
63
|
def compile_images(images_names)
|
60
64
|
image_compiler.call(images_names, {}) if images_names.any?
|
61
65
|
end
|
66
|
+
|
67
|
+
def show_tags_selection()
|
68
|
+
specific_service_option = "deploy specific service"
|
69
|
+
|
70
|
+
tags = [specific_service_option]
|
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)
|
80
|
+
|
81
|
+
ui.prompt("Please select which tag to deploy", tags) do |selected_tag|
|
82
|
+
if selected_tag == specific_service_option
|
83
|
+
show_service_selection
|
84
|
+
else
|
85
|
+
return [[], [selected_tag]]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def show_service_selection()
|
91
|
+
services = service_store
|
92
|
+
.all_definitions
|
93
|
+
.values
|
94
|
+
.map(&:service_name)
|
95
|
+
.uniq
|
96
|
+
.sort
|
97
|
+
.map(&:to_s)
|
98
|
+
|
99
|
+
ui.prompt("Please select which service to deploy", services) do |selected_service|
|
100
|
+
return [[selected_service], []]
|
101
|
+
end
|
102
|
+
end
|
62
103
|
end
|
data/lib/kuber_kit/cli.rb
CHANGED
@@ -37,7 +37,10 @@ class KuberKit::CLI < Thor
|
|
37
37
|
KuberKit.set_debug_mode(options[:debug])
|
38
38
|
|
39
39
|
if KuberKit::Container['actions.configuration_loader'].call(options)
|
40
|
-
result = KuberKit::Container['actions.service_deployer'].call(
|
40
|
+
result = KuberKit::Container['actions.service_deployer'].call(
|
41
|
+
services: options[:services] || [],
|
42
|
+
tags: options[:tags] || []
|
43
|
+
)
|
41
44
|
end
|
42
45
|
|
43
46
|
logger = KuberKit::Container['tools.logger']
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class KuberKit::Core::Configuration
|
2
2
|
attr_reader :name, :artifacts, :registries, :env_files, :templates, :kubeconfig_path,
|
3
|
-
:deploy_strategy, :services_attributes, :build_servers
|
3
|
+
:deploy_strategy, :deploy_namespace, :services_attributes, :build_servers
|
4
4
|
|
5
5
|
Contract KeywordArgs[
|
6
6
|
name: Symbol,
|
@@ -9,12 +9,13 @@ class KuberKit::Core::Configuration
|
|
9
9
|
env_files: Hash,
|
10
10
|
templates: Hash,
|
11
11
|
kubeconfig_path: Maybe[String],
|
12
|
-
deploy_strategy:
|
12
|
+
deploy_strategy: Symbol,
|
13
|
+
deploy_namespace: Maybe[Symbol],
|
13
14
|
services_attributes: HashOf[Symbol => Hash],
|
14
15
|
build_servers: ArrayOf[KuberKit::Core::BuildServers::AbstractBuildServer]
|
15
16
|
] => Any
|
16
17
|
def initialize(name:, artifacts:, registries:, env_files:, templates:, kubeconfig_path:,
|
17
|
-
deploy_strategy:, services_attributes:, build_servers:)
|
18
|
+
deploy_strategy:, deploy_namespace:, services_attributes:, build_servers:)
|
18
19
|
@name = name
|
19
20
|
@artifacts = artifacts
|
20
21
|
@registries = registries
|
@@ -22,6 +23,7 @@ class KuberKit::Core::Configuration
|
|
22
23
|
@templates = templates
|
23
24
|
@kubeconfig_path = kubeconfig_path
|
24
25
|
@deploy_strategy = deploy_strategy
|
26
|
+
@deploy_namespace = deploy_namespace
|
25
27
|
@services_attributes = services_attributes
|
26
28
|
@build_servers = build_servers
|
27
29
|
end
|
@@ -24,9 +24,10 @@ class KuberKit::Core::ConfigurationDefinition
|
|
24
24
|
templates: @templates,
|
25
25
|
kubeconfig_path: @kubeconfig_path,
|
26
26
|
deploy_strategy: @deploy_strategy,
|
27
|
+
deploy_namespace: @deploy_namespace,
|
27
28
|
enabled_services: @enabled_services,
|
28
29
|
build_servers: @build_servers,
|
29
|
-
services_attributes: @services_attributes
|
30
|
+
services_attributes: @services_attributes,
|
30
31
|
)
|
31
32
|
end
|
32
33
|
|
@@ -80,6 +81,12 @@ class KuberKit::Core::ConfigurationDefinition
|
|
80
81
|
self
|
81
82
|
end
|
82
83
|
|
84
|
+
def deploy_namespace(namespace)
|
85
|
+
@deploy_namespace = namespace
|
86
|
+
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
83
90
|
def deploy_strategy(path)
|
84
91
|
@deploy_strategy = path
|
85
92
|
|
@@ -27,6 +27,7 @@ class KuberKit::Core::ConfigurationFactory
|
|
27
27
|
templates: templates,
|
28
28
|
kubeconfig_path: configuration_attrs.kubeconfig_path,
|
29
29
|
deploy_strategy: configuration_attrs.deploy_strategy || configs.deploy_strategy,
|
30
|
+
deploy_namespace: configuration_attrs.deploy_namespace,
|
30
31
|
services_attributes: configuration_attrs.services_attributes,
|
31
32
|
build_servers: build_servers
|
32
33
|
)
|
@@ -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
|
@@ -4,12 +4,15 @@ class KuberKit::ImageCompiler::BuildServerPool
|
|
4
4
|
def initialize(local_shell:, build_servers:, ssh_shell_class:)
|
5
5
|
@local_shell = local_shell
|
6
6
|
@ssh_shell_class = ssh_shell_class
|
7
|
-
@
|
7
|
+
@build_servers = build_servers
|
8
|
+
@ssh_shells = []
|
8
9
|
end
|
9
10
|
|
10
11
|
def get_shell
|
11
|
-
if @
|
12
|
-
@
|
12
|
+
if @build_servers.any?
|
13
|
+
shell = connect_to_ssh_shell(@build_servers.sample)
|
14
|
+
@ssh_shells << shell
|
15
|
+
shell
|
13
16
|
else
|
14
17
|
@local_shell
|
15
18
|
end
|
@@ -20,11 +23,9 @@ class KuberKit::ImageCompiler::BuildServerPool
|
|
20
23
|
end
|
21
24
|
|
22
25
|
private
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
shell
|
28
|
-
end
|
26
|
+
def connect_to_ssh_shell(bs)
|
27
|
+
shell = @ssh_shell_class.new
|
28
|
+
shell.connect(host: bs.host, user: bs.user, port: bs.port)
|
29
|
+
shell
|
29
30
|
end
|
30
31
|
end
|
@@ -11,13 +11,15 @@ class KuberKit::ServiceDeployer::Strategies::Kubernetes < KuberKit::ServiceDeplo
|
|
11
11
|
config_path = "#{configs.service_config_dir}/#{service.name}.yml"
|
12
12
|
shell.write(config_path, service_config)
|
13
13
|
|
14
|
-
kubeconfig_path
|
15
|
-
|
14
|
+
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
15
|
+
deploy_namespace = KuberKit.current_configuration.deploy_namespace
|
16
|
+
|
17
|
+
kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
|
16
18
|
|
17
19
|
deployment_restart_enabled = service.attribute(:deployment_restart_enabled, default: true)
|
18
20
|
deployment_restart_name = service.attribute(:deployment_restart_name, default: service.uri)
|
19
21
|
if deployment_restart_enabled
|
20
|
-
kubectl_commands.rolling_restart(shell, deployment_restart_name, kubeconfig_path: kubeconfig_path)
|
22
|
+
kubectl_commands.rolling_restart(shell, deployment_restart_name, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class KuberKit::ServiceDeployer::Strategies::KubernetesRunner < KuberKit::ServiceDeployer::Strategies::Abstract
|
2
|
+
include KuberKit::Import[
|
3
|
+
"service_reader.reader",
|
4
|
+
"shell.kubectl_commands",
|
5
|
+
"configs",
|
6
|
+
]
|
7
|
+
|
8
|
+
Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
|
9
|
+
def deploy(shell, service)
|
10
|
+
service_config = reader.read(shell, service)
|
11
|
+
config_path = "#{configs.service_config_dir}/#{service.name}.yml"
|
12
|
+
shell.write(config_path, service_config)
|
13
|
+
|
14
|
+
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
15
|
+
deploy_namespace = KuberKit.current_configuration.deploy_namespace
|
16
|
+
|
17
|
+
deployment_resource_name = service.attribute(:deployment_resource_name, default: service.uri)
|
18
|
+
deployment_resource_type = service.attribute(:deployment_resource_type, default: "job")
|
19
|
+
|
20
|
+
deployment_delete_enabled = service.attribute(:deployment_delete_enabled, default: true)
|
21
|
+
if deployment_delete_enabled
|
22
|
+
kubectl_commands.delete_resource(shell, deployment_resource_type, deployment_resource_name, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
|
23
|
+
end
|
24
|
+
|
25
|
+
kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
|
26
|
+
end
|
27
|
+
end
|
@@ -2,25 +2,35 @@ require 'json'
|
|
2
2
|
require 'shellwords'
|
3
3
|
|
4
4
|
class KuberKit::Shell::Commands::KubectlCommands
|
5
|
-
def
|
5
|
+
def kubectl_run(shell, command_list, kubeconfig_path: nil, namespace: nil, interactive: false)
|
6
6
|
command_parts = []
|
7
7
|
if kubeconfig_path
|
8
8
|
command_parts << "KUBECONFIG=#{kubeconfig_path}"
|
9
9
|
end
|
10
10
|
|
11
|
-
command_parts << "kubectl
|
11
|
+
command_parts << "kubectl"
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
if namespace
|
14
|
+
command_parts << "-n #{namespace}"
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
command_parts = []
|
17
|
+
command_parts += Array(command_list)
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
# TODO: investigate how to do it with shell.
|
20
|
+
if interactive
|
21
|
+
system(command_parts.join(" "))
|
22
|
+
else
|
23
|
+
shell.exec!(command_parts.join(" "))
|
21
24
|
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def apply_file(shell, file_path, kubeconfig_path: nil, namespace: nil)
|
28
|
+
kubectl_run(shell, "apply -f #{file_path}", kubeconfig_path: kubeconfig_path, namespace: namespace)
|
29
|
+
end
|
22
30
|
|
23
|
-
|
31
|
+
def exec(shell, pod_name, command, args: nil, kubeconfig_path: nil, interactive: false, namespace: nil)
|
32
|
+
command_parts = []
|
33
|
+
command_parts << "exec"
|
24
34
|
|
25
35
|
if args
|
26
36
|
command_parts << args
|
@@ -28,16 +38,16 @@ class KuberKit::Shell::Commands::KubectlCommands
|
|
28
38
|
|
29
39
|
command_parts << pod_name
|
30
40
|
command_parts << "-- #{command}"
|
41
|
+
kubectl_run(shell, command_parts, kubeconfig_path: kubeconfig_path, interactive: interactive, namespace: namespace)
|
42
|
+
end
|
31
43
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
shell.exec!(command_parts.join(" "))
|
37
|
-
end
|
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)
|
38
48
|
end
|
39
49
|
|
40
|
-
def rolling_restart(shell, deployment_name, kubeconfig_path: nil)
|
50
|
+
def rolling_restart(shell, deployment_name, kubeconfig_path: nil, namespace: nil)
|
41
51
|
patch_deployment(shell, deployment_name, {
|
42
52
|
spec: {
|
43
53
|
template: {
|
@@ -48,19 +58,14 @@ class KuberKit::Shell::Commands::KubectlCommands
|
|
48
58
|
}
|
49
59
|
}
|
50
60
|
}
|
51
|
-
}, kubeconfig_path: kubeconfig_path)
|
61
|
+
}, kubeconfig_path: kubeconfig_path, namespace: namespace)
|
52
62
|
end
|
53
63
|
|
54
|
-
def patch_deployment(shell, deployment_name, specs, kubeconfig_path: nil)
|
55
|
-
command_parts = []
|
56
|
-
if kubeconfig_path
|
57
|
-
command_parts << "KUBECONFIG=#{kubeconfig_path}"
|
58
|
-
end
|
59
|
-
|
64
|
+
def patch_deployment(shell, deployment_name, specs, kubeconfig_path: nil, namespace: nil)
|
60
65
|
specs_json = JSON.dump(specs).gsub('"', '\"')
|
61
66
|
|
62
|
-
|
67
|
+
command = %Q{patch deployment #{deployment_name} -p "#{specs_json}"}
|
63
68
|
|
64
|
-
shell
|
69
|
+
kubectl_run(shell, command, kubeconfig_path: kubeconfig_path, namespace: namespace)
|
65
70
|
end
|
66
71
|
end
|
@@ -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
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|
@@ -257,6 +257,7 @@ files:
|
|
257
257
|
- lib/kuber_kit/service_deployer/service_list_resolver.rb
|
258
258
|
- lib/kuber_kit/service_deployer/strategies/abstract.rb
|
259
259
|
- lib/kuber_kit/service_deployer/strategies/kubernetes.rb
|
260
|
+
- lib/kuber_kit/service_deployer/strategies/kubernetes_runner.rb
|
260
261
|
- lib/kuber_kit/service_deployer/strategy_detector.rb
|
261
262
|
- lib/kuber_kit/service_reader/action_handler.rb
|
262
263
|
- lib/kuber_kit/service_reader/reader.rb
|
@@ -283,7 +284,7 @@ homepage: https://github.com/ArtStation/kuber_kit
|
|
283
284
|
licenses:
|
284
285
|
- MIT
|
285
286
|
metadata: {}
|
286
|
-
post_install_message:
|
287
|
+
post_install_message:
|
287
288
|
rdoc_options: []
|
288
289
|
require_paths:
|
289
290
|
- lib
|
@@ -299,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
300
|
version: '0'
|
300
301
|
requirements: []
|
301
302
|
rubygems_version: 3.0.8
|
302
|
-
signing_key:
|
303
|
+
signing_key:
|
303
304
|
specification_version: 4
|
304
305
|
summary: Docker Containers Build & Deployment
|
305
306
|
test_files: []
|