kuber_kit 0.8.0 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5429f626563faf0dae4a1eea1b4eab7497830b428854bbdd848c65ec628cb19
4
- data.tar.gz: be07f4b3115b9466232ddf889bbbe747a6c9f8b77ea422e1ce39a2631c98dce0
3
+ metadata.gz: 15dac677730506e10fbb09705224f68c82e625a389bfbbab92f0292d26599ebb
4
+ data.tar.gz: '09d78c4155e4b625935b263969a21361093100b004da34741a671f579f79450f'
5
5
  SHA512:
6
- metadata.gz: 821a68b8717e7ae248406453c075bc1334a240bcfbed229ed3411a403e952e3b100e6b60ecbb2ec93fdf793f02818b390830f95b2f5d745c16833e09a26574fe
7
- data.tar.gz: b0a0d0ad446ae16e0c7580a39eb5efbe3fd5e312d75c699d73ef99f94c5c99a524f90ad8f8a0c9d4b133f0bd20bcbf291623c55f7c821b32120c6767d021a82e
6
+ metadata.gz: e82d1c7dfd78ecea8b00939ca04f75c189ac336f84f69b811613db6e272a821c66202cf882081344cd920153f00f99d5c74ebe2962b771619361380fed076a4b
7
+ data.tar.gz: af22dfcb438f9862adcbd4165ddf608c0db0c4580d7ae5b3a0b810d83193ce6caeb28a40671d58d4f064876058ae4a8503350c47a7e5ccc9f3efe1bcd06fc4b8
data/CHANGELOG.md CHANGED
@@ -1,9 +1,18 @@
1
- **0.8.0**
1
+ **0.8.4**
2
+ - Added initial services support, to deploy before all other servies
3
+
4
+ **0.8.3**
5
+ - Always load artifacts, if kubeconfig is an artifact
6
+
7
+ **0.8.2**
8
+ - Update Kit Env command to support kubeconfig path as artifact
9
+
10
+ **0.8.1**
2
11
  - Allow deploying services without dependecies
3
12
  - Default services should be first in the list
4
13
  - KubeConfig should be able to take file from artifact
5
14
 
6
- **0.7.0**
15
+ **0.7.1**
7
16
  - Added Ruby 3.0 support
8
17
 
9
18
  **0.6.4**
@@ -42,9 +42,11 @@ class KuberKit::Actions::ConfigurationLoader
42
42
  load_configurations(configurations_path, configuration_name)
43
43
  load_infrastructure(infra_path)
44
44
 
45
- if load_inventory
45
+ if load_inventory || KuberKit.current_configuration.kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
46
46
  update_artifacts(KuberKit.current_configuration.artifacts.values)
47
+ end
47
48
 
49
+ if load_inventory
48
50
  ui.create_task("Loading image definitions") do |task|
49
51
  files = image_store.load_definitions(images_path)
50
52
 
@@ -1,5 +1,6 @@
1
1
  class KuberKit::Actions::KubectlEnv
2
2
  include KuberKit::Import[
3
+ "core.artifact_path_resolver",
3
4
  "shell.local_shell",
4
5
  "ui"
5
6
  ]
@@ -8,6 +9,11 @@ class KuberKit::Actions::KubectlEnv
8
9
  def call(options)
9
10
  configuration = KuberKit.current_configuration
10
11
  kubeconfig_path = configuration.kubeconfig_path
12
+
13
+ if kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
14
+ kubeconfig_path = artifact_path_resolver.call(kubeconfig_path)
15
+ end
16
+
11
17
  ui.print_info("ENV", "export KUBECONFIG=#{kubeconfig_path}")
12
18
 
13
19
  true
@@ -28,9 +28,10 @@ class KuberKit::Actions::ServiceDeployer
28
28
  services, tags = deployment_options_selector.call()
29
29
  end
30
30
 
31
- default_services = current_configuration.default_services.map(&:to_s)
32
31
  disabled_services = current_configuration.disabled_services.map(&:to_s)
33
32
  disabled_services += skip_services if skip_services
33
+ default_services = current_configuration.default_services.map(&:to_s) - disabled_services
34
+ initial_services = current_configuration.initial_services.map(&:to_s) - disabled_services
34
35
 
35
36
  service_names = service_list_resolver.resolve(
36
37
  services: services || [],
@@ -64,9 +65,20 @@ class KuberKit::Actions::ServiceDeployer
64
65
  return false unless compilation_result && compilation_result.succeeded?
65
66
  end
66
67
 
68
+ # First deploy initial services.
69
+ # This feature is used to deploy some services, required for deployment of other services, e.g. env files
70
+ # Note: Initial services are deployed without dependencies
71
+ initial_services.map(&:to_sym).each_slice(configs.deploy_simultaneous_limit) do |batch_service_names|
72
+ ui.print_debug("ServiceDeployer", "Scheduling to compile: #{batch_service_names.inspect}. Limit: #{configs.deploy_simultaneous_limit}")
73
+
74
+ if deployment_result.succeeded?
75
+ deploy_simultaneously(batch_service_names, deployment_result)
76
+ end
77
+ end
78
+
67
79
  if skip_dependencies
68
80
  service_names.each_slice(configs.deploy_simultaneous_limit) do |batch_service_names|
69
- ui.print_debug("ServiceDeployer", "Scheduling to compile: #{batch_service_names.inspect}. Limit: #{configs.deploy_simultaneous_limit}")
81
+ ui.print_debug("ServiceDeployer", "Scheduling to deploy: #{batch_service_names.inspect}. Limit: #{configs.deploy_simultaneous_limit}")
70
82
 
71
83
  if deployment_result.succeeded?
72
84
  deploy_simultaneously(batch_service_names, deployment_result)
@@ -74,7 +86,7 @@ class KuberKit::Actions::ServiceDeployer
74
86
  end
75
87
  else
76
88
  service_dependency_resolver.each_with_deps(service_names) do |dep_service_names|
77
- ui.print_debug("ServiceDeployer", "Scheduling to compile: #{dep_service_names.inspect}. Limit: #{configs.deploy_simultaneous_limit}")
89
+ ui.print_debug("ServiceDeployer", "Scheduling to deploy: #{dep_service_names.inspect}. Limit: #{configs.deploy_simultaneous_limit}")
78
90
 
79
91
  if deployment_result.succeeded?
80
92
  deploy_simultaneously(dep_service_names, deployment_result)
data/lib/kuber_kit/cli.rb CHANGED
@@ -54,8 +54,8 @@ class KuberKit::CLI < Thor
54
54
  tags: (options[:tags] || []).flatten.uniq,
55
55
  skip_services: (options[:skip_services] || []).flatten.uniq,
56
56
  skip_compile: options[:skip_compile] || false,
57
- skip_dependencies: options[:skip_dependencies] || false
58
- require_confirmation: require_confirmation,
57
+ skip_dependencies: options[:skip_dependencies] || false,
58
+ require_confirmation: require_confirmation
59
59
  )
60
60
  end
61
61
 
@@ -1,7 +1,7 @@
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, :default_services,
4
- :build_servers, :global_build_vars,
3
+ :services_attributes, :enabled_services, :disabled_services, :default_services,
4
+ :initial_services, :build_servers, :global_build_vars,
5
5
  :deployer_strategy, :deployer_namespace, :deployer_require_confirmation
6
6
 
7
7
  Contract KeywordArgs[
@@ -10,11 +10,12 @@ class KuberKit::Core::Configuration
10
10
  registries: Hash,
11
11
  env_files: Hash,
12
12
  templates: Hash,
13
- kubeconfig_path: Maybe[String],
13
+ kubeconfig_path: Maybe[Or[String, KuberKit::Core::ArtifactPath]],
14
14
  services_attributes: HashOf[Symbol => Hash],
15
15
  enabled_services: ArrayOf[Symbol],
16
16
  disabled_services: ArrayOf[Symbol],
17
17
  default_services: ArrayOf[Symbol],
18
+ initial_services: ArrayOf[Symbol],
18
19
  build_servers: ArrayOf[KuberKit::Core::BuildServers::AbstractBuildServer],
19
20
  global_build_vars: HashOf[Symbol => Any],
20
21
  deployer_strategy: Symbol,
@@ -23,7 +24,7 @@ class KuberKit::Core::Configuration
23
24
  ] => Any
24
25
  def initialize(name:, artifacts:, registries:, env_files:, templates:, kubeconfig_path:,
25
26
  services_attributes:, enabled_services:, disabled_services:, default_services:,
26
- build_servers:, global_build_vars:,
27
+ initial_services:, build_servers:, global_build_vars:,
27
28
  deployer_strategy:, deployer_namespace:, deployer_require_confirmation:)
28
29
  @name = name
29
30
  @artifacts = artifacts
@@ -36,6 +37,7 @@ class KuberKit::Core::Configuration
36
37
  @enabled_services = enabled_services
37
38
  @disabled_services = disabled_services
38
39
  @default_services = default_services
40
+ @initial_services = initial_services
39
41
  @global_build_vars = global_build_vars
40
42
  @deployer_strategy = deployer_strategy
41
43
  @deployer_namespace = deployer_namespace
@@ -14,6 +14,7 @@ class KuberKit::Core::ConfigurationDefinition
14
14
  @enabled_services = []
15
15
  @disabled_services = []
16
16
  @default_services = []
17
+ @initial_services = []
17
18
  @services_attributes = {}
18
19
  end
19
20
 
@@ -28,6 +29,7 @@ class KuberKit::Core::ConfigurationDefinition
28
29
  enabled_services: @enabled_services,
29
30
  disabled_services: @disabled_services,
30
31
  default_services: @default_services,
32
+ initial_services: @initial_services,
31
33
  build_servers: @build_servers,
32
34
  services_attributes: @services_attributes,
33
35
  global_build_vars: @global_build_vars,
@@ -126,6 +128,11 @@ class KuberKit::Core::ConfigurationDefinition
126
128
  return self
127
129
  end
128
130
 
131
+ def initial_services(services)
132
+ @initial_services += services.map(&:to_sym)
133
+ return self
134
+ end
135
+
129
136
  def disabled_services(services)
130
137
  @disabled_services += services.map(&:to_sym)
131
138
  return self
@@ -31,6 +31,7 @@ class KuberKit::Core::ConfigurationFactory
31
31
  enabled_services: configuration_attrs.enabled_services,
32
32
  disabled_services: configuration_attrs.disabled_services,
33
33
  default_services: configuration_attrs.default_services,
34
+ initial_services: configuration_attrs.initial_services,
34
35
  global_build_vars: configuration_attrs.global_build_vars || {},
35
36
  deployer_strategy: configuration_attrs.deployer_strategy || configs.deployer_strategy,
36
37
  deployer_namespace: configuration_attrs.deployer_namespace,
@@ -16,10 +16,11 @@ class KuberKit::Shell::Commands::KubectlCommands
16
16
  def kubectl_run(shell, command_list, kubeconfig_path: nil, namespace: nil, interactive: false)
17
17
  command_parts = []
18
18
 
19
+ if kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
20
+ kubeconfig_path = artifact_path_resolver.call(kubeconfig_path)
21
+ end
22
+
19
23
  if kubeconfig_path
20
- if kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
21
- kubeconfig_path = artifact_path_resolver.call(kubeconfig_path)
22
- end
23
24
  command_parts << "KUBECONFIG=#{kubeconfig_path}"
24
25
  end
25
26
 
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuber_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev