k8s-client 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/k8s-client.gemspec +1 -0
- data/lib/k8s/client/version.rb +1 -1
- data/lib/k8s/client.rb +1 -0
- data/lib/k8s/resource_client.rb +10 -12
- data/lib/k8s/transport.rb +2 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d7cce8f8084f9e3cd235ac55f5df20258050e7187567aa20d1fec847d4a5cf2
|
4
|
+
data.tar.gz: 5a7ea616dbf3dbe85fd9482686f97ff2b06d878ad2e86c9dce5956692bed42e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfed2d41bdd6ce8f36da105f3277327afb2344ad480fdf8e5361c1c0df5826168b2f16546a9db9d76f22460dab09b7a724610e55e72a6c4860569d9938ef28c8
|
7
|
+
data.tar.gz: b758e50f969330760d4846c9c42ad899f6d540fd0a475ef78562b86b071d17f3dc85068ffb5e83597957b324861a05ace3622ec46b922c3ab91b8d3cd5e20866
|
data/k8s-client.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency "recursive-open-struct", "~> 1.1.0"
|
30
30
|
spec.add_runtime_dependency 'hashdiff', '~> 0.3.7'
|
31
31
|
spec.add_runtime_dependency 'jsonpath', '~> 0.9.5'
|
32
|
+
spec.add_runtime_dependency 'yajl-ruby', '~> 1.4.0'
|
32
33
|
|
33
34
|
spec.add_development_dependency "bundler", "~> 1.16"
|
34
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/k8s/client/version.rb
CHANGED
data/lib/k8s/client.rb
CHANGED
data/lib/k8s/resource_client.rb
CHANGED
@@ -221,28 +221,26 @@ module K8s
|
|
221
221
|
def watch(labelSelector: nil, fieldSelector: nil, resourceVersion: nil, timeout: nil, namespace: @namespace)
|
222
222
|
method = 'GET'
|
223
223
|
path = path(namespace: namespace)
|
224
|
+
parser = Yajl::Parser.new
|
225
|
+
parser.on_parse_complete = lambda do |data|
|
226
|
+
event = K8s::API::MetaV1::WatchEvent.new(data)
|
227
|
+
yield event
|
228
|
+
end
|
224
229
|
@transport.request(
|
225
230
|
method: method,
|
226
231
|
path: path,
|
227
|
-
|
232
|
+
read_timeout: nil,
|
228
233
|
query: make_query(
|
229
234
|
'labelSelector' => selector_query(labelSelector),
|
230
235
|
'fieldSelector' => selector_query(fieldSelector),
|
231
236
|
'resourceVersion' => resourceVersion,
|
232
|
-
'watch' => '1'
|
237
|
+
'watch' => '1',
|
238
|
+
'timeoutSeconds' => timeout
|
233
239
|
),
|
234
240
|
response_block: lambda do |chunk, _, _|
|
235
|
-
|
236
|
-
|
237
|
-
resourceVersion = event.resource&.metadata&.resourceVersion
|
238
|
-
yield event
|
239
|
-
end,
|
240
|
-
read_timeout: timeout
|
241
|
+
parser << chunk
|
242
|
+
end
|
241
243
|
)
|
242
|
-
rescue Excon::Error::Timeout
|
243
|
-
retry if timeout.nil?
|
244
|
-
|
245
|
-
raise K8s::Error::Timeout.new(method, path, 408, 'timeout')
|
246
244
|
end
|
247
245
|
|
248
246
|
# @return [Bool]
|
data/lib/k8s/transport.rb
CHANGED
@@ -181,7 +181,7 @@ module K8s
|
|
181
181
|
|
182
182
|
case content_type
|
183
183
|
when 'application/json'
|
184
|
-
response_data =
|
184
|
+
response_data = Yajl::Parser.parse(response.body)
|
185
185
|
|
186
186
|
when 'text/plain'
|
187
187
|
response_data = response.body # XXX: broken if status 2xx
|
@@ -223,8 +223,7 @@ module K8s
|
|
223
223
|
response = excon.request(**excon_options)
|
224
224
|
t = Time.now - start
|
225
225
|
|
226
|
-
obj = parse_response(response, options,
|
227
|
-
response_class: response_class)
|
226
|
+
obj = options[:response_block] ? {} : parse_response(response, options, response_class: response_class)
|
228
227
|
rescue K8s::Error::API => exc
|
229
228
|
logger.warn { "#{format_request(options)} => HTTP #{exc.code} #{exc.reason} in #{'%.3f' % t}s" }
|
230
229
|
logger.debug { "Request: #{excon_options[:body]}" } if excon_options[:body]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k8s-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.9.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yajl-ruby
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.4.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.4.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|