kuber_kit 0.5.3 → 0.5.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: 9573dca431e801716912c8dd4a51ea9d5e948d99e91c53e64385b317bc22dbe9
4
- data.tar.gz: 7d162cc2036567c55ec9258d86dacb90354bc55c0914ed2c782d5aa0304ec50f
3
+ metadata.gz: 2e99c1ae700ec8b59f9a832d3c9131e85c7d05a60548d8bca032d4ce2c9178b2
4
+ data.tar.gz: e4233e8cf40a7980477d85f341320536725efd169ac4120e74de6c7ad651e436
5
5
  SHA512:
6
- metadata.gz: 76846e6ac4744e9267c1a6f34571edd43c63fb17398014c2916f9bba558f4e026e6663e515f3dfaef758acc0ed3b7915662920a696fa03b2f962f217befdf37d
7
- data.tar.gz: b348f513b6dc6448966b67c89babfb625387c0f1b272338cf0064db5c76ea6d8e036430a556cd2cace548198495f026ca13b6c29d7f1d20462ab0fd8b0f5cfbb
6
+ metadata.gz: 10a3f4b72a0d3a09c9a49842642e6f7a0457a5cb243d0c469c9792c7fcc70ff483b9ffbd6ecc7c278d20b3b7e22f603e45ad3360e701b1a9cf9696cff64d46ce
7
+ data.tar.gz: f857ce1a307375486c51cfaa67c22a929826b54a1ad572dc5a5ac64fb4febfe680fa27f3adddadf2d2b3d68325cd5dee7ba47facdf672c427640d048c23c950f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ **0.5.4**
2
+ - Added disabled services support
3
+
1
4
  **0.5.3**
2
5
  - Change the symbol to exclude service from "-" to "!", you can pass "-s !auth_app" to exclude "auth_app"
3
6
  - Added kit get command to find pods
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.5.3)
4
+ kuber_kit (0.5.4)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
@@ -16,10 +16,12 @@ class KuberKit::Actions::KubectlGet
16
16
  kubeconfig_path: kubeconfig_path,
17
17
  namespace: deployer_namespace
18
18
  )
19
+
20
+ if resource_name
21
+ resources = resources.select{|r| r.include?(resource_name) }
22
+ end
19
23
 
20
- matching_resources = resources.select{|r| r.include?(resource_name) }
21
-
22
- ui.print_info("Pods", matching_resources.join("\n"))
24
+ ui.print_info("Pods", resources.join("\n"))
23
25
 
24
26
  true
25
27
  rescue KuberKit::Error => e
@@ -15,6 +15,11 @@ class KuberKit::Actions::ServiceChecker
15
15
  services = services.select{ |s| enabled_services.include?(s) }
16
16
  end
17
17
 
18
+ disabled_services = KuberKit.current_configuration.disabled_services.map(&:to_s)
19
+ if disabled_services.any?
20
+ services = services.select{ |s| !disabled_services.include?(s) }
21
+ end
22
+
18
23
  resources = resources_fetcher.call("deployments") + resources_fetcher.call("cronjobs")
19
24
 
20
25
  missing_services = services.select{ |s| !resources.include?(s.gsub("_", "-")) }
@@ -18,6 +18,8 @@ class KuberKit::Actions::ServiceDeployer
18
18
  require_confirmation: Maybe[Bool],
19
19
  ] => Any
20
20
  def call(services:, tags:, skip_compile: false, require_confirmation: false)
21
+ current_configuration = KuberKit.current_configuration
22
+
21
23
  if services.empty? && tags.empty?
22
24
  services, tags = show_tags_selection
23
25
  end
@@ -25,7 +27,8 @@ class KuberKit::Actions::ServiceDeployer
25
27
  service_names = service_list_resolver.resolve(
26
28
  services: services || [],
27
29
  tags: tags || [],
28
- enabled_services: KuberKit.current_configuration.enabled_services.map(&:to_s)
30
+ enabled_services: current_configuration.enabled_services.map(&:to_s),
31
+ disabled_services: current_configuration.disabled_services.map(&:to_s)
29
32
  ).map(&:to_sym)
30
33
 
31
34
  # Return the list of services with all dependencies.
@@ -1,6 +1,6 @@
1
1
  class KuberKit::Core::Configuration
2
2
  attr_reader :name, :artifacts, :registries, :env_files, :templates, :kubeconfig_path,
3
- :services_attributes, :enabled_services, :build_servers, :global_build_vars,
3
+ :services_attributes, :enabled_services, :disabled_services, :build_servers, :global_build_vars,
4
4
  :deployer_strategy, :deployer_namespace, :deployer_require_confirimation
5
5
 
6
6
  Contract KeywordArgs[
@@ -12,6 +12,7 @@ class KuberKit::Core::Configuration
12
12
  kubeconfig_path: Maybe[String],
13
13
  services_attributes: HashOf[Symbol => Hash],
14
14
  enabled_services: ArrayOf[Symbol],
15
+ disabled_services: ArrayOf[Symbol],
15
16
  build_servers: ArrayOf[KuberKit::Core::BuildServers::AbstractBuildServer],
16
17
  global_build_vars: HashOf[Symbol => Any],
17
18
  deployer_strategy: Symbol,
@@ -19,7 +20,7 @@ class KuberKit::Core::Configuration
19
20
  deployer_require_confirimation: Bool,
20
21
  ] => Any
21
22
  def initialize(name:, artifacts:, registries:, env_files:, templates:, kubeconfig_path:,
22
- services_attributes:, enabled_services:, build_servers:, global_build_vars:,
23
+ services_attributes:, enabled_services:, disabled_services:, build_servers:, global_build_vars:,
23
24
  deployer_strategy:, deployer_namespace:, deployer_require_confirimation:)
24
25
  @name = name
25
26
  @artifacts = artifacts
@@ -30,6 +31,7 @@ class KuberKit::Core::Configuration
30
31
  @build_servers = build_servers
31
32
  @services_attributes = services_attributes
32
33
  @enabled_services = enabled_services
34
+ @disabled_services = disabled_services
33
35
  @global_build_vars = global_build_vars
34
36
  @deployer_strategy = deployer_strategy
35
37
  @deployer_namespace = deployer_namespace
@@ -12,6 +12,7 @@ class KuberKit::Core::ConfigurationDefinition
12
12
  @templates = {}
13
13
  @build_servers = []
14
14
  @enabled_services = []
15
+ @disabled_services = []
15
16
  @services_attributes = {}
16
17
  end
17
18
 
@@ -24,6 +25,7 @@ class KuberKit::Core::ConfigurationDefinition
24
25
  templates: @templates,
25
26
  kubeconfig_path: @kubeconfig_path,
26
27
  enabled_services: @enabled_services,
28
+ disabled_services: @disabled_services,
27
29
  build_servers: @build_servers,
28
30
  services_attributes: @services_attributes,
29
31
  global_build_vars: @global_build_vars,
@@ -116,6 +118,11 @@ class KuberKit::Core::ConfigurationDefinition
116
118
  raise KuberKit::Error, "#enabled_services method accepts only Array or Hash"
117
119
  end
118
120
 
121
+ def disabled_services(services)
122
+ @disabled_services += services.map(&:to_sym)
123
+ return self
124
+ end
125
+
119
126
  def service_attributes(services)
120
127
  @services_attributes = @services_attributes.merge(services)
121
128
  self
@@ -29,6 +29,7 @@ class KuberKit::Core::ConfigurationFactory
29
29
  build_servers: build_servers,
30
30
  services_attributes: configuration_attrs.services_attributes,
31
31
  enabled_services: configuration_attrs.enabled_services,
32
+ disabled_services: configuration_attrs.disabled_services,
32
33
  global_build_vars: configuration_attrs.global_build_vars || {},
33
34
  deployer_strategy: configuration_attrs.deployer_strategy || configs.deployer_strategy,
34
35
  deployer_namespace: configuration_attrs.deployer_namespace,
@@ -4,11 +4,12 @@ class KuberKit::ServiceDeployer::ServiceListResolver
4
4
  ]
5
5
 
6
6
  Contract KeywordArgs[
7
- services: Optional[ArrayOf[String]],
8
- tags: Optional[ArrayOf[String]],
9
- enabled_services: Optional[ArrayOf[String]]
7
+ services: Optional[ArrayOf[String]],
8
+ tags: Optional[ArrayOf[String]],
9
+ enabled_services: Optional[ArrayOf[String]],
10
+ disabled_services: Optional[ArrayOf[String]]
10
11
  ] => ArrayOf[String]
11
- def resolve(services: [], tags: [], enabled_services: [])
12
+ def resolve(services: [], tags: [], enabled_services: [], disabled_services: [])
12
13
  all_definitions = service_store.all_definitions.values
13
14
 
14
15
  included_services, excluded_services = split_by_inclusion(services)
@@ -36,6 +37,10 @@ class KuberKit::ServiceDeployer::ServiceListResolver
36
37
  included_services = included_services.select{ |s| enabled_services.include?(s) }
37
38
  end
38
39
 
40
+ if disabled_services.any?
41
+ included_services = included_services.select{ |s| !disabled_services.include?(s) }
42
+ end
43
+
39
44
  included_services
40
45
  end
41
46
 
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
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.5.3
4
+ version: 0.5.4
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-03-17 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts-lite