kuber_kit 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/TODO.md +5 -4
- data/example/images/ruby_app/Dockerfile +1 -1
- data/example/images/ruby_app/image.rb +3 -0
- data/lib/kuber_kit.rb +2 -2
- data/lib/kuber_kit/actions/configuration_loader.rb +5 -0
- data/lib/kuber_kit/configs.rb +3 -1
- data/lib/kuber_kit/core/configuration.rb +5 -0
- data/lib/kuber_kit/core/context_helper/context_helper_factory.rb +3 -2
- data/lib/kuber_kit/core/context_helper/{context_args.rb → context_vars.rb} +5 -5
- data/lib/kuber_kit/core/context_helper/image_helper.rb +17 -0
- data/lib/kuber_kit/core/image_definition.rb +4 -4
- data/lib/kuber_kit/extensions/indocker_compat.rb +4 -0
- data/lib/kuber_kit/image_compiler/compiler.rb +1 -1
- data/lib/kuber_kit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 050f5ef4e2ef34f21bd8d5d92593717770a82c54c40d929cdce949a9f2735171
|
4
|
+
data.tar.gz: 250684c19fc240e0f243ad3c5688cd170912b26c49559569d12717a0bd1655fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b80414736ee18eb858e383dde9219468b20953d98bbc61439974683b0a0287758e6a039719783ee6c132b94fa999c1e3f4eb9c6c020939313d29d100dc365c3
|
7
|
+
data.tar.gz: e7a7b01fea7a033bf14755dd597ca85079d51e235855c722c5ca8ddba1b25838d70469c2ae4089aca77b48394e5aca52dbcfdb9ef0706892a61437a3eaf8e7a9
|
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
- list services and require confirmation before deployment
|
2
|
+
- kit attach should list available deployments/pods, and ask for specific container if it has multiple containers
|
3
|
+
- add kit logs support, should work similar to kit attach
|
4
|
+
- allow deploying only services enabled for specific configuration
|
1
5
|
- find a way to always deploy some service, e.g. for migrations and env_files
|
2
6
|
- allow setting default configuration for kuberkit using env variable
|
3
|
-
- add ability to set container health
|
7
|
+
- add ability to set container health checks
|
4
8
|
- implement interactive shell.exec!
|
5
|
-
- allow deploying only services enabled for specific configuration
|
6
|
-
- list services and require confirmation before deployment
|
7
|
-
- add build vars support (use images instead of containers)
|
8
9
|
- template should be able to set default attributes
|
9
10
|
- template should be able to depend on image?
|
@@ -2,6 +2,9 @@ KuberKit
|
|
2
2
|
.define_image(:ruby_app)
|
3
3
|
.registry(:default)
|
4
4
|
.depends_on(:ruby, :app_sources)
|
5
|
+
.build_vars({
|
6
|
+
example_file_name: "example.txt"
|
7
|
+
})
|
5
8
|
.before_build do |context_helper, build_dir|
|
6
9
|
# copy file: local artifact
|
7
10
|
source_path = context_helper.artifact_path(:kuber_kit_example_data, "test.txt")
|
data/lib/kuber_kit.rb
CHANGED
@@ -57,7 +57,7 @@ module KuberKit
|
|
57
57
|
autoload :ImageHelper, 'core/context_helper/image_helper'
|
58
58
|
autoload :ServiceHelper, 'core/context_helper/service_helper'
|
59
59
|
autoload :ContextHelperFactory, 'core/context_helper/context_helper_factory'
|
60
|
-
autoload :
|
60
|
+
autoload :ContextVars, 'core/context_helper/context_vars'
|
61
61
|
end
|
62
62
|
|
63
63
|
module Registries
|
@@ -217,7 +217,7 @@ module KuberKit
|
|
217
217
|
end
|
218
218
|
|
219
219
|
def global_build_vars
|
220
|
-
KuberKit::Core::ContextHelper::
|
220
|
+
KuberKit::Core::ContextHelper::ContextVars.new(current_configuration.global_build_vars)
|
221
221
|
end
|
222
222
|
|
223
223
|
def add_registry(registry)
|
@@ -56,6 +56,11 @@ class KuberKit::Actions::ConfigurationLoader
|
|
56
56
|
|
57
57
|
ui.create_task("Loading image definitions") do |task|
|
58
58
|
files = image_store.load_definitions(images_path)
|
59
|
+
|
60
|
+
configs.additional_images_paths.each do |path|
|
61
|
+
files += image_store.load_definitions(path)
|
62
|
+
end
|
63
|
+
|
59
64
|
task.update_title("Loaded #{files.count} image definitions")
|
60
65
|
end
|
61
66
|
|
data/lib/kuber_kit/configs.rb
CHANGED
@@ -4,7 +4,8 @@ class KuberKit::Configs
|
|
4
4
|
AVAILABLE_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
|
-
:artifact_clone_dir, :service_config_dir, :deploy_strategy, :compile_simultaneous_limit
|
7
|
+
:artifact_clone_dir, :service_config_dir, :deploy_strategy, :compile_simultaneous_limit,
|
8
|
+
:additional_images_paths
|
8
9
|
]
|
9
10
|
DOCKER_IGNORE_LIST = [
|
10
11
|
'Dockerfile',
|
@@ -48,6 +49,7 @@ class KuberKit::Configs
|
|
48
49
|
set :service_config_dir, "/tmp/kuber_kit/services"
|
49
50
|
set :deploy_strategy, :kubernetes
|
50
51
|
set :compile_simultaneous_limit, 5
|
52
|
+
set :additional_images_paths, []
|
51
53
|
end
|
52
54
|
|
53
55
|
def items
|
@@ -35,4 +35,9 @@ class KuberKit::Core::Configuration
|
|
35
35
|
def service_attributes(service_name)
|
36
36
|
services_attributes[service_name.to_sym] || {}
|
37
37
|
end
|
38
|
+
|
39
|
+
def global_build_args
|
40
|
+
puts "WARNING: global_build_args is deprecated, please use global_build_vars instead"
|
41
|
+
global_build_vars
|
42
|
+
end
|
38
43
|
end
|
@@ -5,12 +5,13 @@ class KuberKit::Core::ContextHelper::ContextHelperFactory
|
|
5
5
|
env_file_reader: "env_file_reader.action_handler"
|
6
6
|
]
|
7
7
|
|
8
|
-
def build_image_context(shell)
|
8
|
+
def build_image_context(shell, image)
|
9
9
|
KuberKit::Core::ContextHelper::ImageHelper.new(
|
10
10
|
image_store: image_store,
|
11
11
|
artifact_store: artifact_store,
|
12
12
|
shell: shell,
|
13
|
-
env_file_reader: env_file_reader
|
13
|
+
env_file_reader: env_file_reader,
|
14
|
+
image: image
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
class KuberKit::Core::ContextHelper::
|
1
|
+
class KuberKit::Core::ContextHelper::ContextVars
|
2
2
|
attr_reader :parent, :parent_name
|
3
3
|
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(context_vars, parent_name = nil, parent = nil)
|
5
|
+
@context_vars = context_vars
|
6
6
|
@parent_name = parent_name
|
7
7
|
@parent = parent
|
8
8
|
end
|
@@ -12,8 +12,8 @@ class KuberKit::Core::ContextHelper::ContextArgs
|
|
12
12
|
raise ArgumentError.new("context args does not accept any arguments")
|
13
13
|
end
|
14
14
|
|
15
|
-
value = @
|
16
|
-
raise(KuberKit::Error, "build arg '#{format_arg(name)}' is not defined, available args: #{@
|
15
|
+
value = @context_vars.fetch(name) do
|
16
|
+
raise(KuberKit::Error, "build arg '#{format_arg(name)}' is not defined, available args: #{@context_vars.inspect}")
|
17
17
|
end
|
18
18
|
|
19
19
|
if value.is_a?(Hash)
|
@@ -1,2 +1,19 @@
|
|
1
1
|
class KuberKit::Core::ContextHelper::ImageHelper < KuberKit::Core::ContextHelper::BaseHelper
|
2
|
+
def initialize(image_store:, artifact_store:, shell:, env_file_reader:, image:)
|
3
|
+
super(
|
4
|
+
image_store: image_store,
|
5
|
+
artifact_store: artifact_store,
|
6
|
+
shell: shell,
|
7
|
+
env_file_reader: env_file_reader
|
8
|
+
)
|
9
|
+
@image = image
|
10
|
+
end
|
11
|
+
|
12
|
+
def image_name
|
13
|
+
@image.name.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
def build_vars
|
17
|
+
KuberKit::Core::ContextHelper::ContextVars.new(@image.build_vars)
|
18
|
+
end
|
2
19
|
end
|
@@ -66,14 +66,14 @@ class KuberKit::Core::ImageDefinition
|
|
66
66
|
self
|
67
67
|
end
|
68
68
|
|
69
|
-
def before_build(&block)
|
70
|
-
@before_build_callback = block
|
69
|
+
def before_build(lambda_arg = nil, &block)
|
70
|
+
@before_build_callback = lambda_arg || block
|
71
71
|
|
72
72
|
self
|
73
73
|
end
|
74
74
|
|
75
|
-
def after_build(&block)
|
76
|
-
@after_build_callback = block
|
75
|
+
def after_build(lambda_arg = nil, &block)
|
76
|
+
@after_build_callback = lambda_arg || block
|
77
77
|
|
78
78
|
self
|
79
79
|
end
|
@@ -9,7 +9,7 @@ class KuberKit::ImageCompiler::Compiler
|
|
9
9
|
def compile(shell, image, builds_dir)
|
10
10
|
image_build_dir = File.join(builds_dir, image.name.to_s)
|
11
11
|
|
12
|
-
context_helper = context_helper_factory.build_image_context(shell)
|
12
|
+
context_helper = context_helper_factory.build_image_context(shell, image)
|
13
13
|
image_build_dir_creator.create(shell, image, image_build_dir, context_helper: context_helper)
|
14
14
|
|
15
15
|
image_builder.build(shell, image, image_build_dir, context_helper: context_helper)
|
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.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: 2020-12-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|
@@ -212,8 +212,8 @@ files:
|
|
212
212
|
- lib/kuber_kit/core/configuration_factory.rb
|
213
213
|
- lib/kuber_kit/core/configuration_store.rb
|
214
214
|
- lib/kuber_kit/core/context_helper/base_helper.rb
|
215
|
-
- lib/kuber_kit/core/context_helper/context_args.rb
|
216
215
|
- lib/kuber_kit/core/context_helper/context_helper_factory.rb
|
216
|
+
- lib/kuber_kit/core/context_helper/context_vars.rb
|
217
217
|
- lib/kuber_kit/core/context_helper/image_helper.rb
|
218
218
|
- lib/kuber_kit/core/context_helper/service_helper.rb
|
219
219
|
- lib/kuber_kit/core/env_files/abstract_env_file.rb
|