resque-kubernetes 1.2.0 → 1.3.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: bbfbc8c610d079165438b6a635043070730ecc0a
4
- data.tar.gz: a409a4638079687074703bbe70e0acb7ab92d40f
3
+ metadata.gz: c90637618ea819269c20b91f9cc752e28b435da0
4
+ data.tar.gz: 94391752da8c4a799442d22e31f5cfdf3ac8cc21
5
5
  SHA512:
6
- metadata.gz: 03e42650b7af55aca5d0eacb803cc58b30f70ebc4148dc8226e39242c266b061824d1a38f3291b5e5b2a8961d216703d5d03fd2ea31faef4027ddc4b1e097d81
7
- data.tar.gz: 849ebc1a05f62eb3676d7dfc6550b975f15da62172cdaba86339ad3c8974cf9610c889f72084de908d8739598ff5447b1f5dcaf1e595ede9af6c32c0802685a2
6
+ metadata.gz: 9c3dcccddc78c704a909c2abba2b0acd7236ba8df30026dbaf4a0ce11958e4823064c25dfb8bdfaf3b923510fe3468088ad70d26ec799c6ca0fe037711db2f89
7
+ data.tar.gz: f9257d78372f47e6a94be98d022095d05d3af32f960b402c126a760cf247060e28fd7dca34c402898e8db6d591fb79e63f6162042da130b77f4767da3c16ca02
@@ -1,3 +1,6 @@
1
+ # v1.3.0
2
+ - Retry when a timeout occurs connecting to the Kubernetes API server
3
+
1
4
  # v1.2.0
2
5
  - Clean up finished pods that have successfully completed
3
6
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "retriable"
4
+
3
5
  require "resque/kubernetes/configurable"
4
6
  require "resque/kubernetes/context/kubectl"
5
7
  require "resque/kubernetes/context/well_known"
@@ -9,6 +11,7 @@ require "resque/kubernetes/dns_safe_random"
9
11
  require "resque/kubernetes/job"
10
12
  require "resque/kubernetes/jobs_manager"
11
13
  require "resque/kubernetes/manifest_conformance"
14
+ require "resque/kubernetes/retriable_client"
12
15
  require "resque/kubernetes/version"
13
16
 
14
17
  module Resque
@@ -62,8 +62,12 @@ module Resque
62
62
  end
63
63
 
64
64
  def client(scope)
65
- return Resque::Kubernetes.kubeclient if Resque::Kubernetes.kubeclient
65
+ return RetriableClient.new(Resque::Kubernetes.kubeclient) if Resque::Kubernetes.kubeclient
66
+ client = build_client(scope)
67
+ RetriableClient.new(client) if client
68
+ end
66
69
 
70
+ def build_client(scope)
67
71
  context = ContextFactory.context
68
72
  return unless context
69
73
  @default_namespace = context.namespace if context.namespace
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Resque
4
4
  module Kubernetes
5
- # Provides methods to ensure a mannifest conforms to a job specification
5
+ # Provides functions to ensure a manifest conforms to a job specification
6
6
  # and includes details needed for resque-kubernetes
7
7
  module ManifestConformance
8
8
  def adjust_manifest(manifest)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Resque
4
+ module Kubernetes
5
+ # Wraps Kubeclient::Client to retry timeout errors
6
+ class RetriableClient
7
+ attr_accessor :kubeclient
8
+
9
+ def initialize(client)
10
+ self.kubeclient = client
11
+ end
12
+
13
+ def method_missing(method, *args, &block)
14
+ if kubeclient.respond_to?(method)
15
+ Retriable.retriable(on: {Kubeclient::HttpError => /Timed out/}) do
16
+ kubeclient.send(method, *args, &block)
17
+ end
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ def respond_to_missing?(method)
24
+ kubeclient.respond_to?(method)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module Kubernetes
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_dependency "kubeclient", ">= 3.1.2", "< 5.0"
36
36
  spec.add_dependency "resque", "~> 1.26"
37
+ spec.add_dependency "retriable", "~> 3.0"
37
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.2.0
4
+ version: 1.3.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-11-13 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -154,6 +154,20 @@ dependencies:
154
154
  - - "~>"
155
155
  - !ruby/object:Gem::Version
156
156
  version: '1.26'
157
+ - !ruby/object:Gem::Dependency
158
+ name: retriable
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '3.0'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '3.0'
157
171
  description: Launches a Kubernetes Job when a Resque Job is enqueued, then terminates
158
172
  the worker when there are no more jobs in the queue.
159
173
  email:
@@ -187,6 +201,7 @@ files:
187
201
  - lib/resque/kubernetes/job.rb
188
202
  - lib/resque/kubernetes/jobs_manager.rb
189
203
  - lib/resque/kubernetes/manifest_conformance.rb
204
+ - lib/resque/kubernetes/retriable_client.rb
190
205
  - lib/resque/kubernetes/version.rb
191
206
  - resque-kubernetes.gemspec
192
207
  homepage: https://github.com/keylimetoolbox/resque-kubernetes