resque-kubernetes 1.3.0 → 2.0.0

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
  SHA1:
3
- metadata.gz: c90637618ea819269c20b91f9cc752e28b435da0
4
- data.tar.gz: 94391752da8c4a799442d22e31f5cfdf3ac8cc21
3
+ metadata.gz: 5b5eb837eae7cac78d84a9cdc246888a76b72757
4
+ data.tar.gz: fa20e71d90dd54d75f46ede6395426b8fdc5adac
5
5
  SHA512:
6
- metadata.gz: 9c3dcccddc78c704a909c2abba2b0acd7236ba8df30026dbaf4a0ce11958e4823064c25dfb8bdfaf3b923510fe3468088ad70d26ec799c6ca0fe037711db2f89
7
- data.tar.gz: f9257d78372f47e6a94be98d022095d05d3af32f960b402c126a760cf247060e28fd7dca34c402898e8db6d591fb79e63f6162042da130b77f4767da3c16ca02
6
+ metadata.gz: b7a5c03e3368267b04f3cf0027fb0e72a882cf36133b4ed2da7ca63a0528781baecfbfa4670113d196b4baaf3794b2711fa0dd30fc7e9d68ce48a8c803c1dc16
7
+ data.tar.gz: 1aec966a307c5619a07c56fd93549b18764b6fa239138af439e718a45c89b823550e68bf9f7d36e56ed2e9df77c658f2ad7b2de8484d759f0a1cc67bc438114d
@@ -1,3 +1,34 @@
1
+ # V2.0.0
2
+ **Breaking Change:**
3
+ - The `environments` configuration as been replaced by a more flexible `enabled` property.
4
+
5
+ Here's how to migrate from the `environments` property to the `enabled` property:
6
+
7
+ Before:
8
+ ```ruby
9
+ # config/initializers/resque-kubernetes.rb
10
+
11
+ Resque::Kubernetes.configuration do |config|
12
+ config.environments << "staging"
13
+ config.max_workers = 10
14
+ end
15
+ ```
16
+
17
+ After:
18
+ ```ruby
19
+ # config/initializers/resque-kubernetes.rb
20
+
21
+ Resque::Kubernetes.configuration do |config|
22
+ config.enabled = Rails.env.production? || Rails.env.staging?
23
+ config.max_workers = 10
24
+ end
25
+ ```
26
+
27
+ ⚠️ By default, this gem is not enabled.
28
+
29
+ **Changes:**
30
+ - Allow resque 2.0 but retain support for 1.26 or later.
31
+
1
32
  # v1.3.0
2
33
  - Retry when a timeout occurs connecting to the Kubernetes API server
3
34
 
data/README.md CHANGED
@@ -152,19 +152,16 @@ your project:
152
152
  # config/initializers/resque-kubernetes.rb
153
153
 
154
154
  Resque::Kubernetes.configuration do |config|
155
- config.environments << "staging"
155
+ config.enabled = Rails.env.production? || Rails.env.staging?
156
156
  config.max_workers = 10
157
157
  end
158
158
  ```
159
159
 
160
- ### `environments`
160
+ ### `enabled`
161
161
 
162
- > This only works under Rails, when `Rails.env` is set.
162
+ ⚠️ By default, the `enabled` property is set to `false` which means that, by default, this plugin will not be launched.
163
163
 
164
- By default `Resque::Kubernetes` will only manage Kubernetes Jobs in
165
- `:production`. If you want to add other environments you can update this list
166
- (`config.environments << "staging"`) or replace it (`config.environments =
167
- ["production", "development"]`).
164
+ You should not enable this Resque plugin in environments that are not run inside a Kubernetes cluster (for example, your CI env).
168
165
 
169
166
  ### `max_workers`
170
167
 
@@ -19,8 +19,8 @@ module Resque
19
19
  module Kubernetes
20
20
  extend Configurable
21
21
 
22
- # By default only manage kubernetes jobs in :production
23
- define_setting :environments, ["production"]
22
+ # By default, this plugin is not active.
23
+ define_setting :enabled, false
24
24
 
25
25
  # Limit the number of workers that should be spun up, default 10
26
26
  define_setting :max_workers, 10
@@ -10,7 +10,6 @@ module Resque
10
10
 
11
11
  class << self
12
12
  def context
13
- # TODO: Add ability to load this from config
14
13
  [
15
14
  Resque::Kubernetes::Context::WellKnown,
16
15
  Resque::Kubernetes::Context::Kubectl
@@ -18,6 +17,8 @@ module Resque
18
17
  context = context_type.new
19
18
  return context.context if context.applicable?
20
19
  end
20
+
21
+ nil
21
22
  end
22
23
  end
23
24
  end
@@ -83,9 +83,7 @@ module Resque
83
83
 
84
84
  # A before_enqueue hook that adds worker jobs to the cluster.
85
85
  def before_enqueue_kubernetes_job(*_args)
86
- if defined? Rails
87
- return unless Resque::Kubernetes.environments.include?(Rails.env)
88
- end
86
+ return unless Resque::Kubernetes.enabled
89
87
 
90
88
  manager = JobsManager.new(self)
91
89
  manager.reap_finished_jobs
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module Kubernetes
5
- VERSION = "1.3.0"
5
+ VERSION = "2.0.0"
6
6
  end
7
7
  end
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rubocop", "~> 0.52", ">= 0.52.1", "< 0.56.0"
34
34
 
35
35
  spec.add_dependency "kubeclient", ">= 3.1.2", "< 5.0"
36
- spec.add_dependency "resque", "~> 1.26"
36
+ spec.add_dependency "resque", ">= 1.26"
37
37
  spec.add_dependency "retriable", "~> 3.0"
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-kubernetes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Wadsack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -144,14 +144,14 @@ dependencies:
144
144
  name: resque
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - "~>"
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: '1.26'
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - "~>"
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '1.26'
157
157
  - !ruby/object:Gem::Dependency