kuber_kit 0.3.8 → 0.3.9
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/lib/kuber_kit/configs.rb +2 -1
- data/lib/kuber_kit/container.rb +1 -1
- data/lib/kuber_kit/core/service.rb +5 -5
- data/lib/kuber_kit/core/service_factory.rb +0 -6
- data/lib/kuber_kit/service_deployer/strategies/docker.rb +8 -8
- data/lib/kuber_kit/service_deployer/strategies/docker_compose.rb +3 -0
- data/lib/kuber_kit/service_reader/reader.rb +6 -0
- data/lib/kuber_kit/shell/commands/docker_commands.rb +8 -4
- data/lib/kuber_kit/shell/commands/docker_compose_commands.rb +4 -5
- data/lib/kuber_kit/tools/logger_factory.rb +6 -2
- data/lib/kuber_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8321dfb87de00ef987aa2c826e5310fd721664135b90e194562a9c9f26ad044e
|
4
|
+
data.tar.gz: dccbfdc6df8ed8bedd6e6d30ddfd576c42c1a12ec36aa465769a1fcc207d38af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde945512a525f1ef577f540ae3919bc602d442fb44eb14505fe2a4761ad1c15061f9bab1540b9b8de2592cf4d4f4f7396bfe451499af45cd6198659ad7cfaeb
|
7
|
+
data.tar.gz: cca667290f77ff94934ce302666655d1bdefc414f074915c8a6d091590786b20ff2aa26a04c02f9d07b5e3c88f2e48439c3cbe71add7d374ea255deda753e125
|
data/Gemfile.lock
CHANGED
data/lib/kuber_kit/configs.rb
CHANGED
@@ -5,7 +5,7 @@ class KuberKit::Configs
|
|
5
5
|
:image_dockerfile_name, :image_build_context_dir, :image_tag, :docker_ignore_list, :image_compile_dir,
|
6
6
|
:kuber_kit_dirname, :kuber_kit_min_version, :images_dirname, :services_dirname, :infra_dirname, :configurations_dirname,
|
7
7
|
:artifact_clone_dir, :service_config_dir, :deployer_strategy, :compile_simultaneous_limit,
|
8
|
-
:additional_images_paths, :deprecation_warnings_disabled
|
8
|
+
:additional_images_paths, :deprecation_warnings_disabled, :log_file_path
|
9
9
|
]
|
10
10
|
DOCKER_IGNORE_LIST = [
|
11
11
|
'Dockerfile',
|
@@ -51,6 +51,7 @@ class KuberKit::Configs
|
|
51
51
|
set :compile_simultaneous_limit, 5
|
52
52
|
set :additional_images_paths, []
|
53
53
|
set :deprecation_warnings_disabled, false
|
54
|
+
set :log_file_path, "/tmp/kuber_kit.log"
|
54
55
|
end
|
55
56
|
|
56
57
|
def items
|
data/lib/kuber_kit/container.rb
CHANGED
@@ -114,7 +114,7 @@ class KuberKit::Container
|
|
114
114
|
end
|
115
115
|
|
116
116
|
register "tools.logger" do
|
117
|
-
KuberKit::Container["tools.logger_factory"].create(
|
117
|
+
KuberKit::Container["tools.logger_factory"].create()
|
118
118
|
end
|
119
119
|
|
120
120
|
register "shell.bash_commands" do
|
@@ -4,11 +4,11 @@ class KuberKit::Core::Service
|
|
4
4
|
attr_reader :name, :template_name, :tags, :images, :attributes, :deployer_strategy
|
5
5
|
|
6
6
|
Contract KeywordArgs[
|
7
|
-
name:
|
8
|
-
template_name:
|
9
|
-
tags:
|
10
|
-
images:
|
11
|
-
attributes:
|
7
|
+
name: Symbol,
|
8
|
+
template_name: Maybe[Symbol],
|
9
|
+
tags: ArrayOf[Symbol],
|
10
|
+
images: ArrayOf[Symbol],
|
11
|
+
attributes: HashOf[Symbol => Any],
|
12
12
|
deployer_strategy: Maybe[Symbol]
|
13
13
|
] => Any
|
14
14
|
def initialize(name:, template_name:, tags:, images:, attributes:, deployer_strategy:)
|
@@ -1,13 +1,7 @@
|
|
1
1
|
class KuberKit::Core::ServiceFactory
|
2
|
-
AttributeNotSetError = Class.new(KuberKit::Error)
|
3
|
-
|
4
2
|
def create(definition)
|
5
3
|
service_attrs = definition.to_service_attrs
|
6
4
|
|
7
|
-
if service_attrs.template_name.nil?
|
8
|
-
raise AttributeNotSetError, "Please set template for service using #template method"
|
9
|
-
end
|
10
|
-
|
11
5
|
configuration_attributes = KuberKit.current_configuration.service_attributes(service_attrs.name)
|
12
6
|
attributes = (service_attrs.attributes || {}).merge(configuration_attributes)
|
13
7
|
|
@@ -9,8 +9,8 @@ class KuberKit::ServiceDeployer::Strategies::Docker < KuberKit::ServiceDeployer:
|
|
9
9
|
:container_name,
|
10
10
|
:image_name,
|
11
11
|
:detached,
|
12
|
-
:
|
13
|
-
:
|
12
|
+
:command_name,
|
13
|
+
:command_args,
|
14
14
|
:delete_if_exists
|
15
15
|
]
|
16
16
|
|
@@ -22,9 +22,9 @@ class KuberKit::ServiceDeployer::Strategies::Docker < KuberKit::ServiceDeployer:
|
|
22
22
|
raise KuberKit::Error, "Unknow options for deploy strategy: #{unknown_options}. Available options: #{STRATEGY_OPTIONS}"
|
23
23
|
end
|
24
24
|
|
25
|
-
container_name
|
26
|
-
|
27
|
-
|
25
|
+
container_name = strategy_options.fetch(:container_name, service.uri)
|
26
|
+
command_name = strategy_options.fetch(:command_name, "bash")
|
27
|
+
command_args = strategy_options.fetch(:command_args, nil)
|
28
28
|
|
29
29
|
image_name = strategy_options.fetch(:image_name, nil)
|
30
30
|
if image_name.nil?
|
@@ -39,9 +39,9 @@ class KuberKit::ServiceDeployer::Strategies::Docker < KuberKit::ServiceDeployer:
|
|
39
39
|
|
40
40
|
docker_commands.run(
|
41
41
|
shell, image.remote_registry_url,
|
42
|
-
|
43
|
-
|
44
|
-
detached:
|
42
|
+
command: command_name,
|
43
|
+
args: command_args,
|
44
|
+
detached: !!strategy_options[:detached]
|
45
45
|
)
|
46
46
|
end
|
47
47
|
end
|
@@ -8,6 +8,7 @@ class KuberKit::ServiceDeployer::Strategies::DockerCompose < KuberKit::ServiceDe
|
|
8
8
|
STRATEGY_OPTIONS = [
|
9
9
|
:service_name,
|
10
10
|
:command_name,
|
11
|
+
:command_args,
|
11
12
|
:detached
|
12
13
|
]
|
13
14
|
|
@@ -25,10 +26,12 @@ class KuberKit::ServiceDeployer::Strategies::DockerCompose < KuberKit::ServiceDe
|
|
25
26
|
|
26
27
|
service_name = strategy_options.fetch(:service_name, service.name.to_s)
|
27
28
|
command_name = strategy_options.fetch(:command_name, "bash")
|
29
|
+
command_args = strategy_options.fetch(:command_args, nil)
|
28
30
|
|
29
31
|
docker_compose_commands.run(shell, config_path,
|
30
32
|
service: service_name,
|
31
33
|
command: command_name,
|
34
|
+
args: command_args,
|
32
35
|
detached: !!strategy_options[:detached]
|
33
36
|
)
|
34
37
|
end
|
@@ -6,8 +6,14 @@ class KuberKit::ServiceReader::Reader
|
|
6
6
|
"preprocessing.text_preprocessor"
|
7
7
|
]
|
8
8
|
|
9
|
+
AttributeNotSetError = Class.new(KuberKit::Error)
|
10
|
+
|
9
11
|
Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
|
10
12
|
def read(shell, service)
|
13
|
+
if service.template_name.nil?
|
14
|
+
raise AttributeNotSetError, "Please set template for service using #template method"
|
15
|
+
end
|
16
|
+
|
11
17
|
template = template_store.get(service.template_name)
|
12
18
|
|
13
19
|
context_helper = context_helper_factory.build_service_context(shell, service)
|
@@ -14,15 +14,19 @@ class KuberKit::Shell::Commands::DockerCommands
|
|
14
14
|
shell.exec!(%Q{docker push #{tag_name}})
|
15
15
|
end
|
16
16
|
|
17
|
-
def run(shell, image_name,
|
17
|
+
def run(shell, image_name, args: nil, command: nil, detached: false, interactive: false)
|
18
18
|
command_parts = []
|
19
19
|
command_parts << "docker run"
|
20
20
|
command_parts << "-d" if detached
|
21
|
-
command_parts <<
|
21
|
+
command_parts << args if args
|
22
22
|
command_parts << image_name
|
23
|
-
command_parts <<
|
23
|
+
command_parts << command if command
|
24
24
|
|
25
|
-
|
25
|
+
if interactive
|
26
|
+
shell.interactive!(command_parts.join(" "))
|
27
|
+
else
|
28
|
+
shell.exec!(command_parts.join(" "))
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
def container_exists?(shell, container_name)
|
@@ -1,17 +1,16 @@
|
|
1
1
|
class KuberKit::Shell::Commands::DockerComposeCommands
|
2
|
-
def run(shell, path, service:, command
|
2
|
+
def run(shell, path, service:, args: nil, command: nil, detached: false, interactive: false)
|
3
3
|
command_parts = [
|
4
4
|
"docker-compose",
|
5
5
|
"-f #{path}",
|
6
6
|
"run",
|
7
7
|
]
|
8
8
|
|
9
|
-
if detached
|
10
|
-
command_parts << "-d"
|
11
|
-
end
|
12
9
|
|
10
|
+
command_parts << "-d" if detached
|
11
|
+
command_parts << args if args
|
13
12
|
command_parts << service
|
14
|
-
command_parts << command
|
13
|
+
command_parts << command if command
|
15
14
|
|
16
15
|
if interactive
|
17
16
|
shell.interactive!(command_parts.join(" "))
|
@@ -9,8 +9,12 @@ class KuberKit::Tools::LoggerFactory
|
|
9
9
|
Logger::FATAL => String::Colors::PURPLE,
|
10
10
|
}
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
include KuberKit::Import[
|
13
|
+
"configs",
|
14
|
+
]
|
15
|
+
|
16
|
+
def create(stdout = nil, level = nil)
|
17
|
+
logger = Logger.new(stdout || configs.log_file_path)
|
14
18
|
|
15
19
|
logger.level = level || Logger::DEBUG
|
16
20
|
|
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.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|