kuber_kit 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/TODO.md +1 -3
- data/lib/kuber_kit.rb +1 -1
- data/lib/kuber_kit/actions/configuration_loader.rb +15 -6
- data/lib/kuber_kit/actions/service_deployer.rb +4 -1
- data/lib/kuber_kit/artifacts_sync/{artifacts_updater.rb → artifact_updater.rb} +7 -9
- data/lib/kuber_kit/cli.rb +1 -1
- data/lib/kuber_kit/container.rb +2 -2
- data/lib/kuber_kit/core/configuration.rb +10 -6
- data/lib/kuber_kit/core/configuration_definition.rb +11 -3
- data/lib/kuber_kit/core/configuration_factory.rb +2 -1
- data/lib/kuber_kit/service_deployer/service_list_resolver.rb +7 -2
- 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: 03c60b8fd02854d59ccad27ac3e512b726049d55f87f41d9c0ac0256344705ba
|
4
|
+
data.tar.gz: e60f2f47da61e2b5c3942878c19c863c2537bd5a6513476bb4a26aea81259674
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85bfd81c3419a8a44960c89e9e31d06a4775aa143141fdc8da8f46ea207d60a2be53310213a5cc96cf1fe034097c13f09d10256a72d0535bb6ee363d0a12c987
|
7
|
+
data.tar.gz: 7182215530a9ee4908e4e483c578764c3bbc63f4d510c89b68bf8a2cb15a5e41bf714eb553b1497ad2236af4e585feb0e6aa810b00bb8e0f3b3ff1357e9717bf
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
- env files should use a separate deployment method (with change detection)
|
2
1
|
- add automatical confirmation support for service deployer
|
3
2
|
- template should be able to set default attributes
|
4
|
-
- template should be able to depend on image?
|
5
|
-
- kit status should show the list of services and their status, with ability to select & view logs
|
3
|
+
- template should be able to depend on image?
|
data/lib/kuber_kit.rb
CHANGED
@@ -122,7 +122,7 @@ module KuberKit
|
|
122
122
|
|
123
123
|
module ArtifactsSync
|
124
124
|
autoload :AbstractArtifactResolver, 'artifacts_sync/abstract_artifact_resolver'
|
125
|
-
autoload :
|
125
|
+
autoload :ArtifactUpdater, 'artifacts_sync/artifact_updater'
|
126
126
|
autoload :GitArtifactResolver, 'artifacts_sync/git_artifact_resolver'
|
127
127
|
autoload :NullArtifactResolver, 'artifacts_sync/null_artifact_resolver'
|
128
128
|
end
|
@@ -5,7 +5,7 @@ class KuberKit::Actions::ConfigurationLoader
|
|
5
5
|
"core.service_store",
|
6
6
|
"core.configuration_store",
|
7
7
|
"tools.workdir_detector",
|
8
|
-
"artifacts_sync.
|
8
|
+
"artifacts_sync.artifact_updater",
|
9
9
|
"shell.local_shell",
|
10
10
|
"ui",
|
11
11
|
"configs"
|
@@ -43,11 +43,7 @@ class KuberKit::Actions::ConfigurationLoader
|
|
43
43
|
load_infrastructure(infra_path)
|
44
44
|
|
45
45
|
if load_inventory
|
46
|
-
|
47
|
-
artifacts = KuberKit.current_configuration.artifacts.values
|
48
|
-
artifacts_updater.update(local_shell, artifacts)
|
49
|
-
task.update_title("Updated #{artifacts.count} artifacts")
|
50
|
-
end
|
46
|
+
update_artifacts(KuberKit.current_configuration.artifacts.values)
|
51
47
|
|
52
48
|
ui.create_task("Loading image definitions") do |task|
|
53
49
|
files = image_store.load_definitions(images_path)
|
@@ -101,4 +97,17 @@ class KuberKit::Actions::ConfigurationLoader
|
|
101
97
|
rescue KuberKit::Shell::AbstractShell::DirNotFoundError
|
102
98
|
ui.print_warning("ConfigurationLoader", "Directory with infrastructure not found: #{infra_path}")
|
103
99
|
end
|
100
|
+
|
101
|
+
def update_artifacts(artifacts)
|
102
|
+
return unless artifacts.any?
|
103
|
+
|
104
|
+
artifact_task_group = ui.create_task_group
|
105
|
+
artifacts.each do |artifact|
|
106
|
+
artifact_task_group.add("Updating #{artifact.name.to_s.yellow}") do |task|
|
107
|
+
artifact_updater.update(local_shell, artifact)
|
108
|
+
task.update_title("Updated #{artifact.name.to_s.green}")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
artifact_task_group.wait
|
112
|
+
end
|
104
113
|
end
|
@@ -27,14 +27,17 @@ class KuberKit::Actions::ServiceDeployer
|
|
27
27
|
services, tags = deployment_options_selector.call()
|
28
28
|
end
|
29
29
|
|
30
|
+
default_services = current_configuration.default_services.map(&:to_s)
|
30
31
|
disabled_services = current_configuration.disabled_services.map(&:to_s)
|
31
32
|
disabled_services += skip_services if skip_services
|
33
|
+
|
32
34
|
|
33
35
|
service_names = service_list_resolver.resolve(
|
34
36
|
services: services || [],
|
35
37
|
tags: tags || [],
|
36
38
|
enabled_services: current_configuration.enabled_services.map(&:to_s),
|
37
|
-
disabled_services: disabled_services
|
39
|
+
disabled_services: disabled_services,
|
40
|
+
default_services: default_services
|
38
41
|
).map(&:to_sym)
|
39
42
|
|
40
43
|
# Return the list of services with all dependencies.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class KuberKit::ArtifactsSync::
|
1
|
+
class KuberKit::ArtifactsSync::ArtifactUpdater
|
2
2
|
ResolverNotFoundError = Class.new(KuberKit::NotFoundError)
|
3
3
|
|
4
4
|
include KuberKit::Import[
|
@@ -18,18 +18,16 @@ class KuberKit::ArtifactsSync::ArtifactsUpdater
|
|
18
18
|
@@resolvers[artifact_class] = artifact_resolver
|
19
19
|
end
|
20
20
|
|
21
|
-
def update(shell,
|
21
|
+
def update(shell, artifact)
|
22
22
|
add_default_resolvers
|
23
23
|
|
24
|
-
|
25
|
-
resolver = @@resolvers[artifact.class]
|
24
|
+
resolver = @@resolvers[artifact.class]
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
ui.print_debug "ArtifactUpdater", "Updating artifact #{artifact.name.to_s.green}"
|
27
|
+
|
28
|
+
raise ResolverNotFoundError, "Can't find resolver for artifact #{artifact}" if resolver.nil?
|
30
29
|
|
31
|
-
|
32
|
-
end
|
30
|
+
resolver.resolve(shell, artifact)
|
33
31
|
end
|
34
32
|
|
35
33
|
def add_default_resolvers
|
data/lib/kuber_kit/cli.rb
CHANGED
@@ -45,7 +45,7 @@ class KuberKit::CLI < Thor
|
|
45
45
|
|
46
46
|
if KuberKit::Container['actions.configuration_loader'].call(options)
|
47
47
|
require_confirmation = options[:require_confirmation] ||
|
48
|
-
KuberKit.current_configuration.
|
48
|
+
KuberKit.current_configuration.deployer_require_confirmation ||
|
49
49
|
false
|
50
50
|
started_at = Time.now.to_i
|
51
51
|
action_result = KuberKit::Container['actions.service_deployer'].call(
|
data/lib/kuber_kit/container.rb
CHANGED
@@ -217,8 +217,8 @@ class KuberKit::Container
|
|
217
217
|
KuberKit::ImageCompiler::VersionTagBuilder.new
|
218
218
|
end
|
219
219
|
|
220
|
-
register "artifacts_sync.
|
221
|
-
KuberKit::ArtifactsSync::
|
220
|
+
register "artifacts_sync.artifact_updater" do
|
221
|
+
KuberKit::ArtifactsSync::ArtifactUpdater.new
|
222
222
|
end
|
223
223
|
|
224
224
|
register "artifacts_sync.git_artifact_resolver" do
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class KuberKit::Core::Configuration
|
2
2
|
attr_reader :name, :artifacts, :registries, :env_files, :templates, :kubeconfig_path,
|
3
|
-
:services_attributes, :enabled_services, :disabled_services, :
|
4
|
-
:
|
3
|
+
:services_attributes, :enabled_services, :disabled_services, :default_services,
|
4
|
+
:build_servers, :global_build_vars,
|
5
|
+
:deployer_strategy, :deployer_namespace, :deployer_require_confirmation
|
5
6
|
|
6
7
|
Contract KeywordArgs[
|
7
8
|
name: Symbol,
|
@@ -13,15 +14,17 @@ class KuberKit::Core::Configuration
|
|
13
14
|
services_attributes: HashOf[Symbol => Hash],
|
14
15
|
enabled_services: ArrayOf[Symbol],
|
15
16
|
disabled_services: ArrayOf[Symbol],
|
17
|
+
default_services: ArrayOf[Symbol],
|
16
18
|
build_servers: ArrayOf[KuberKit::Core::BuildServers::AbstractBuildServer],
|
17
19
|
global_build_vars: HashOf[Symbol => Any],
|
18
20
|
deployer_strategy: Symbol,
|
19
21
|
deployer_namespace: Maybe[Symbol],
|
20
|
-
|
22
|
+
deployer_require_confirmation: Bool,
|
21
23
|
] => Any
|
22
24
|
def initialize(name:, artifacts:, registries:, env_files:, templates:, kubeconfig_path:,
|
23
|
-
services_attributes:, enabled_services:, disabled_services:,
|
24
|
-
|
25
|
+
services_attributes:, enabled_services:, disabled_services:, default_services:,
|
26
|
+
build_servers:, global_build_vars:,
|
27
|
+
deployer_strategy:, deployer_namespace:, deployer_require_confirmation:)
|
25
28
|
@name = name
|
26
29
|
@artifacts = artifacts
|
27
30
|
@registries = registries
|
@@ -32,10 +35,11 @@ class KuberKit::Core::Configuration
|
|
32
35
|
@services_attributes = services_attributes
|
33
36
|
@enabled_services = enabled_services
|
34
37
|
@disabled_services = disabled_services
|
38
|
+
@default_services = default_services
|
35
39
|
@global_build_vars = global_build_vars
|
36
40
|
@deployer_strategy = deployer_strategy
|
37
41
|
@deployer_namespace = deployer_namespace
|
38
|
-
@
|
42
|
+
@deployer_require_confirmation = deployer_require_confirmation
|
39
43
|
end
|
40
44
|
|
41
45
|
def service_attributes(service_name)
|
@@ -13,6 +13,7 @@ class KuberKit::Core::ConfigurationDefinition
|
|
13
13
|
@build_servers = []
|
14
14
|
@enabled_services = []
|
15
15
|
@disabled_services = []
|
16
|
+
@default_services = []
|
16
17
|
@services_attributes = {}
|
17
18
|
end
|
18
19
|
|
@@ -26,12 +27,13 @@ class KuberKit::Core::ConfigurationDefinition
|
|
26
27
|
kubeconfig_path: @kubeconfig_path,
|
27
28
|
enabled_services: @enabled_services,
|
28
29
|
disabled_services: @disabled_services,
|
30
|
+
default_services: @default_services,
|
29
31
|
build_servers: @build_servers,
|
30
32
|
services_attributes: @services_attributes,
|
31
33
|
global_build_vars: @global_build_vars,
|
32
34
|
deployer_strategy: @deployer_strategy,
|
33
35
|
deployer_namespace: @deployer_namespace,
|
34
|
-
|
36
|
+
deployer_require_confirmation: @deployer_require_confirmation || false,
|
35
37
|
)
|
36
38
|
end
|
37
39
|
|
@@ -97,11 +99,12 @@ class KuberKit::Core::ConfigurationDefinition
|
|
97
99
|
self
|
98
100
|
end
|
99
101
|
|
100
|
-
def
|
101
|
-
@
|
102
|
+
def deployer_require_confirmation
|
103
|
+
@deployer_require_confirmation = true
|
102
104
|
|
103
105
|
self
|
104
106
|
end
|
107
|
+
alias_method :deployer_require_confirimation, :deployer_require_confirmation
|
105
108
|
|
106
109
|
def enabled_services(services)
|
107
110
|
if services.is_a?(Hash)
|
@@ -118,6 +121,11 @@ class KuberKit::Core::ConfigurationDefinition
|
|
118
121
|
raise KuberKit::Error, "#enabled_services method accepts only Array or Hash"
|
119
122
|
end
|
120
123
|
|
124
|
+
def default_services(services)
|
125
|
+
@default_services += services.map(&:to_sym)
|
126
|
+
return self
|
127
|
+
end
|
128
|
+
|
121
129
|
def disabled_services(services)
|
122
130
|
@disabled_services += services.map(&:to_sym)
|
123
131
|
return self
|
@@ -30,10 +30,11 @@ class KuberKit::Core::ConfigurationFactory
|
|
30
30
|
services_attributes: configuration_attrs.services_attributes,
|
31
31
|
enabled_services: configuration_attrs.enabled_services,
|
32
32
|
disabled_services: configuration_attrs.disabled_services,
|
33
|
+
default_services: configuration_attrs.default_services,
|
33
34
|
global_build_vars: configuration_attrs.global_build_vars || {},
|
34
35
|
deployer_strategy: configuration_attrs.deployer_strategy || configs.deployer_strategy,
|
35
36
|
deployer_namespace: configuration_attrs.deployer_namespace,
|
36
|
-
|
37
|
+
deployer_require_confirmation: configuration_attrs.deployer_require_confirmation,
|
37
38
|
)
|
38
39
|
end
|
39
40
|
|
@@ -7,9 +7,10 @@ class KuberKit::ServiceDeployer::ServiceListResolver
|
|
7
7
|
services: Optional[ArrayOf[String]],
|
8
8
|
tags: Optional[ArrayOf[String]],
|
9
9
|
enabled_services: Optional[ArrayOf[String]],
|
10
|
-
disabled_services: Optional[ArrayOf[String]]
|
10
|
+
disabled_services: Optional[ArrayOf[String]],
|
11
|
+
default_services: Optional[ArrayOf[String]]
|
11
12
|
] => ArrayOf[String]
|
12
|
-
def resolve(services: [], tags: [], enabled_services: [], disabled_services: [])
|
13
|
+
def resolve(services: [], tags: [], enabled_services: [], disabled_services: [], default_services: [])
|
13
14
|
all_definitions = service_store.all_definitions.values
|
14
15
|
|
15
16
|
included_services, excluded_services = split_by_inclusion(services)
|
@@ -41,6 +42,10 @@ class KuberKit::ServiceDeployer::ServiceListResolver
|
|
41
42
|
included_services = included_services.select{ |s| !disabled_services.include?(s) }
|
42
43
|
end
|
43
44
|
|
45
|
+
if included_services.any?
|
46
|
+
included_services += default_services
|
47
|
+
end
|
48
|
+
|
44
49
|
included_services
|
45
50
|
end
|
46
51
|
|
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.6.
|
4
|
+
version: 0.6.1
|
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-07-
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|
@@ -236,7 +236,7 @@ files:
|
|
236
236
|
- lib/kuber_kit/actions/service_reader.rb
|
237
237
|
- lib/kuber_kit/actions/template_reader.rb
|
238
238
|
- lib/kuber_kit/artifacts_sync/abstract_artifact_resolver.rb
|
239
|
-
- lib/kuber_kit/artifacts_sync/
|
239
|
+
- lib/kuber_kit/artifacts_sync/artifact_updater.rb
|
240
240
|
- lib/kuber_kit/artifacts_sync/git_artifact_resolver.rb
|
241
241
|
- lib/kuber_kit/artifacts_sync/null_artifact_resolver.rb
|
242
242
|
- lib/kuber_kit/cli.rb
|