kubeclient 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kubeclient might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +21 -0
- data/kubeclient.gemspec +2 -2
- data/lib/kubeclient/version.rb +1 -1
- data/lib/kubeclient/watch_notice.rb +5 -0
- data/lib/kubeclient/watch_stream.rb +1 -1
- data/test/json/node_notice.json +160 -0
- data/test/test_watch.rb +21 -0
- data/test/test_watch_notice.rb +37 -0
- metadata +20 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d647693b6947c9d717f0b19dad1c1cadc46f14b7
|
4
|
+
data.tar.gz: 1355734798902a5b0f890568df9276cc390205b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0f30f0903cbb179aee65b8a5e28f743e45ea6500752df248694f4ae57aaa46b98a6561638a83c915ce20cf0787159457ad85a2d7ac5573eec6913d83fe0989e
|
7
|
+
data.tar.gz: 6a696571fe8281b2dad5d6f01f429c7d02a51913272a711dd315bbbd27f9f291e41ab60a89d8dd92a0a96f7a91931ddbedb880c691b653f6498d44480d5d0268
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,8 @@ MethodLength:
|
|
2
2
|
Enabled: false
|
3
3
|
ClassLength:
|
4
4
|
Enabled: false
|
5
|
+
Documentation:
|
6
|
+
Enabled: false
|
5
7
|
Metrics/AbcSize:
|
6
8
|
Enabled: false
|
7
9
|
Metrics/LineLength:
|
@@ -13,3 +15,5 @@ Metrics/CyclomaticComplexity:
|
|
13
15
|
Max: 8
|
14
16
|
Style/FileName:
|
15
17
|
Exclude: [Gemfile*]
|
18
|
+
Style/SignalException:
|
19
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
Notable changes to this project will be documented in this file.
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
5
|
+
|
6
|
+
## 2.5.2 - 2018-02-04
|
7
|
+
### Fixed
|
8
|
+
- Watch results are now `RecursiveOpenStruct` inside arrays too (#279).
|
9
|
+
- Fixed watch `.finish` sometimes caused `Errno::EBADF` exception from the reading loop (#280).
|
10
|
+
- Easing dependency version (#287, #301)
|
11
|
+
|
12
|
+
## 2.5.1 - 2017-10-12
|
13
|
+
No changes since 2.5.0, fixed packaging mistake.
|
14
|
+
|
15
|
+
## [2.5.0 - 2017-10-12 was YANKED]
|
16
|
+
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- `as: raw` option for `get_*` methods returning a string (#262 via #271)
|
20
|
+
|
21
|
+
## 2.4.0 - 2017-05-10
|
data/kubeclient.gemspec
CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'vcr'
|
27
27
|
spec.add_development_dependency 'rubocop', '= 0.30.0'
|
28
28
|
spec.add_dependency 'rest-client'
|
29
|
-
spec.add_dependency 'recursive-open-struct', '
|
30
|
-
spec.add_dependency 'http', '
|
29
|
+
spec.add_dependency 'recursive-open-struct', '~> 1.0.0'
|
30
|
+
spec.add_dependency 'http', '< 3', '>= 0.98'
|
31
31
|
end
|
data/lib/kubeclient/version.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'recursive_open_struct'
|
2
2
|
module Kubeclient
|
3
3
|
module Common
|
4
|
+
# Represents an individual notice received from a Kubernetes watch
|
4
5
|
class WatchNotice < RecursiveOpenStruct
|
6
|
+
def initialize(hash = nil, args = {})
|
7
|
+
args[:recurse_over_arrays] = true
|
8
|
+
super(hash, args)
|
9
|
+
end
|
5
10
|
end
|
6
11
|
end
|
7
12
|
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
{
|
2
|
+
"type": "ADDED",
|
3
|
+
"object": {
|
4
|
+
"apiVersion": "v1",
|
5
|
+
"kind": "Node",
|
6
|
+
"metadata": {
|
7
|
+
"annotations": {
|
8
|
+
"volumes.kubernetes.io/controller-managed-attach-detach": "true"
|
9
|
+
},
|
10
|
+
"creationTimestamp": "2017-12-11T12:00:13Z",
|
11
|
+
"labels": {
|
12
|
+
"beta.kubernetes.io/arch": "amd64",
|
13
|
+
"beta.kubernetes.io/os": "linux",
|
14
|
+
"kubernetes.io/hostname": "openshift.local",
|
15
|
+
"openshift-infra": "apiserver"
|
16
|
+
},
|
17
|
+
"name": "openshift.local",
|
18
|
+
"resourceVersion": "367410",
|
19
|
+
"selfLink": "/api/v1/nodes/openshift.local",
|
20
|
+
"uid": "d88c7af6-de6a-11e7-8725-52540080f1d2"
|
21
|
+
},
|
22
|
+
"spec": {
|
23
|
+
"externalID": "openshift.local"
|
24
|
+
},
|
25
|
+
"status": {
|
26
|
+
"addresses": [
|
27
|
+
{
|
28
|
+
"address": "192.168.122.40",
|
29
|
+
"type": "InternalIP"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"address": "openshift.local",
|
33
|
+
"type": "Hostname"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"allocatable": {
|
37
|
+
"cpu": "2",
|
38
|
+
"memory": "8072896Ki",
|
39
|
+
"pods": "20"
|
40
|
+
},
|
41
|
+
"capacity": {
|
42
|
+
"cpu": "2",
|
43
|
+
"memory": "8175296Ki",
|
44
|
+
"pods": "20"
|
45
|
+
},
|
46
|
+
"conditions": [
|
47
|
+
{
|
48
|
+
"lastHeartbeatTime": "2017-12-15T00:36:13Z",
|
49
|
+
"lastTransitionTime": "2017-12-11T12:00:13Z",
|
50
|
+
"message": "kubelet has sufficient disk space available",
|
51
|
+
"reason": "KubeletHasSufficientDisk",
|
52
|
+
"status": "False",
|
53
|
+
"type": "OutOfDisk"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"lastHeartbeatTime": "2017-12-15T00:36:13Z",
|
57
|
+
"lastTransitionTime": "2017-12-11T12:00:13Z",
|
58
|
+
"message": "kubelet has sufficient memory available",
|
59
|
+
"reason": "KubeletHasSufficientMemory",
|
60
|
+
"status": "False",
|
61
|
+
"type": "MemoryPressure"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"lastHeartbeatTime": "2017-12-15T00:36:13Z",
|
65
|
+
"lastTransitionTime": "2017-12-11T12:00:13Z",
|
66
|
+
"message": "kubelet has no disk pressure",
|
67
|
+
"reason": "KubeletHasNoDiskPressure",
|
68
|
+
"status": "False",
|
69
|
+
"type": "DiskPressure"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"lastHeartbeatTime": "2017-12-15T00:36:13Z",
|
73
|
+
"lastTransitionTime": "2017-12-14T15:43:39Z",
|
74
|
+
"message": "kubelet is posting ready status",
|
75
|
+
"reason": "KubeletReady",
|
76
|
+
"status": "True",
|
77
|
+
"type": "Ready"
|
78
|
+
}
|
79
|
+
],
|
80
|
+
"daemonEndpoints": {
|
81
|
+
"kubeletEndpoint": {
|
82
|
+
"Port": 10250
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"images": [
|
86
|
+
{
|
87
|
+
"names": [
|
88
|
+
"docker.io/openshift/origin@sha256:908c6c9ccf0e0feefe2658899656c6e73d2854777fa340738fb903f0a40c328d",
|
89
|
+
"docker.io/openshift/origin:latest"
|
90
|
+
],
|
91
|
+
"sizeBytes": 1222636603
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"names": [
|
95
|
+
"docker.io/openshift/origin-deployer@sha256:3d324bce1870047edc418041cefdec88e0a5bbb5b3b9f6fd35b43f14919a656c",
|
96
|
+
"docker.io/openshift/origin-deployer:v3.7.0"
|
97
|
+
],
|
98
|
+
"sizeBytes": 1098951248
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"names": [
|
102
|
+
"docker.io/cockpit/kubernetes@sha256:a8e58cd5e6f5a4d12d1e2dfd339686b74f3c22586952ca7aa184dc254ab49714",
|
103
|
+
"docker.io/cockpit/kubernetes:latest"
|
104
|
+
],
|
105
|
+
"sizeBytes": 375926556
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"names": [
|
109
|
+
"docker.io/cockpit/kubernetes@sha256:0745b3823efc57e03a5ef378614dfcb6c2b1e3964220bbf908fb3046a91cef70"
|
110
|
+
],
|
111
|
+
"sizeBytes": 350062743
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"names": [
|
115
|
+
"docker.io/openshift/origin-service-catalog@sha256:ef851e06276af96838a93320d0e4be51cc8de6e5afb2fb0efd4e56cec114b937"
|
116
|
+
],
|
117
|
+
"sizeBytes": 284732029
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"names": [
|
121
|
+
"docker.io/openshift/origin-service-catalog@sha256:8addfd742d92d8da819b091d6bda40edc45e88d1446ffd1ad658b6d21b3c36fd"
|
122
|
+
],
|
123
|
+
"sizeBytes": 284731998
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"names": [
|
127
|
+
"docker.io/openshift/origin-service-catalog@sha256:b3a737cc346b3cae85ef2f5d020b607781a1cac38fe70678cb78fee2c2a3bf8a"
|
128
|
+
],
|
129
|
+
"sizeBytes": 284731943
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"names": [
|
133
|
+
"docker.io/openshift/origin-service-catalog@sha256:957934537721da33362693d4f1590dc79dc5da7438799bf14d645165768e53ef",
|
134
|
+
"docker.io/openshift/origin-service-catalog:latest"
|
135
|
+
],
|
136
|
+
"sizeBytes": 283929631
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"names": [
|
140
|
+
"docker.io/openshift/origin-pod@sha256:2c257d83a01607b229ef5e3dca09f52c3a2a2788c09dc33f0444ec4e572a9e1d",
|
141
|
+
"docker.io/openshift/origin-pod:v3.7.0"
|
142
|
+
],
|
143
|
+
"sizeBytes": 218423400
|
144
|
+
}
|
145
|
+
],
|
146
|
+
"nodeInfo": {
|
147
|
+
"architecture": "amd64",
|
148
|
+
"bootID": "75be791d-88a2-4f56-a588-c071a80bf7cf",
|
149
|
+
"containerRuntimeVersion": "docker://1.12.6",
|
150
|
+
"kernelVersion": "3.10.0-693.11.1.el7.x86_64",
|
151
|
+
"kubeProxyVersion": "v1.7.6+a08f5eeb62",
|
152
|
+
"kubeletVersion": "v1.7.6+a08f5eeb62",
|
153
|
+
"machineID": "adf09ffc2de2624aa5ed335727c7400d",
|
154
|
+
"operatingSystem": "linux",
|
155
|
+
"osImage": "CentOS Linux 7 (Core)",
|
156
|
+
"systemUUID": "FC9FF0AD-E22D-4A62-A5ED-335727C7400D"
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
data/test/test_watch.rb
CHANGED
@@ -116,4 +116,25 @@ class TestWatch < MiniTest::Test
|
|
116
116
|
"#{api_host}/v1/watch/events?fieldSelector=#{selector}",
|
117
117
|
times: 1)
|
118
118
|
end
|
119
|
+
|
120
|
+
def test_watch_with_finish_and_ebadf
|
121
|
+
api_host = 'http://localhost:8080/api'
|
122
|
+
|
123
|
+
stub_request(:get, %r{/api/v1$})
|
124
|
+
.to_return(body: open_test_file('core_api_resource_list.json'),
|
125
|
+
status: 200)
|
126
|
+
stub_request(:get, %r{.*\/watch/events})
|
127
|
+
.to_return(body: open_test_file('watch_stream.json'), status: 200)
|
128
|
+
|
129
|
+
client = Kubeclient::Client.new(api_host, 'v1')
|
130
|
+
watcher = client.watch_events
|
131
|
+
|
132
|
+
# explodes when Errno::EBADF is not caught
|
133
|
+
watcher.each do
|
134
|
+
watcher.finish
|
135
|
+
raise Errno::EBADF
|
136
|
+
end
|
137
|
+
|
138
|
+
assert_requested(:get, "#{api_host}/v1/watch/events", times: 1)
|
139
|
+
end
|
119
140
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestWatchNotice < MiniTest::Test
|
4
|
+
#
|
5
|
+
# Checks that elements of arrays are converted to instances of `RecursiveOpenStruct`, and that the
|
6
|
+
# items can be accessed using the dot notation.
|
7
|
+
#
|
8
|
+
def test_recurse_over_arrays
|
9
|
+
json = JSON.parse(open_test_file('node_notice.json').read)
|
10
|
+
notice = Kubeclient::Common::WatchNotice.new(json)
|
11
|
+
assert_kind_of(Array, notice.object.status.addresses)
|
12
|
+
notice.object.status.addresses.each do |address|
|
13
|
+
assert_kind_of(RecursiveOpenStruct, address)
|
14
|
+
end
|
15
|
+
assert_equal('InternalIP', notice.object.status.addresses[0].type)
|
16
|
+
assert_equal('192.168.122.40', notice.object.status.addresses[0].address)
|
17
|
+
assert_equal('Hostname', notice.object.status.addresses[1].type)
|
18
|
+
assert_equal('openshift.local', notice.object.status.addresses[1].address)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Checks that even when arrays are converted to instances of `RecursiveOpenStruct` the items can
|
23
|
+
# be accessed using the hash notation.
|
24
|
+
#
|
25
|
+
def test_access_array_items_as_hash
|
26
|
+
json = JSON.parse(open_test_file('node_notice.json').read)
|
27
|
+
notice = Kubeclient::Common::WatchNotice.new(json)
|
28
|
+
assert_kind_of(Array, notice.object.status.addresses)
|
29
|
+
notice.object.status.addresses.each do |address|
|
30
|
+
assert_kind_of(RecursiveOpenStruct, address)
|
31
|
+
end
|
32
|
+
assert_equal('InternalIP', notice.object.status.addresses[0]['type'])
|
33
|
+
assert_equal('192.168.122.40', notice.object.status.addresses[0]['address'])
|
34
|
+
assert_equal('Hostname', notice.object.status.addresses[1]['type'])
|
35
|
+
assert_equal('openshift.local', notice.object.status.addresses[1]['address'])
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubeclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alissa Bonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,30 +112,36 @@ dependencies:
|
|
112
112
|
name: recursive-open-struct
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.0.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.0.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: http
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - "<"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '3'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0.98'
|
132
135
|
type: :runtime
|
133
136
|
prerelease: false
|
134
137
|
version_requirements: !ruby/object:Gem::Requirement
|
135
138
|
requirements:
|
136
|
-
- -
|
139
|
+
- - "<"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '3'
|
142
|
+
- - ">="
|
137
143
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
144
|
+
version: '0.98'
|
139
145
|
description: A client for Kubernetes REST api
|
140
146
|
email:
|
141
147
|
- abonas@redhat.com
|
@@ -146,6 +152,7 @@ files:
|
|
146
152
|
- ".gitignore"
|
147
153
|
- ".rubocop.yml"
|
148
154
|
- ".travis.yml"
|
155
|
+
- CHANGELOG.md
|
149
156
|
- Gemfile
|
150
157
|
- Gemfile-rest-client-1.8.rb
|
151
158
|
- LICENSE.txt
|
@@ -191,6 +198,7 @@ files:
|
|
191
198
|
- test/json/namespace_list.json
|
192
199
|
- test/json/node.json
|
193
200
|
- test/json/node_list.json
|
201
|
+
- test/json/node_notice.json
|
194
202
|
- test/json/persistent_volume.json
|
195
203
|
- test/json/persistent_volume_claim.json
|
196
204
|
- test/json/persistent_volume_claim_list.json
|
@@ -237,6 +245,7 @@ files:
|
|
237
245
|
- test/test_service.rb
|
238
246
|
- test/test_service_account.rb
|
239
247
|
- test/test_watch.rb
|
248
|
+
- test/test_watch_notice.rb
|
240
249
|
- test/txt/pod_log.txt
|
241
250
|
- test/valid_token_file
|
242
251
|
homepage: https://github.com/abonas/kubeclient
|
@@ -259,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
268
|
version: '0'
|
260
269
|
requirements: []
|
261
270
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.5.2
|
263
272
|
signing_key:
|
264
273
|
specification_version: 4
|
265
274
|
summary: A client for Kubernetes REST api
|
@@ -294,6 +303,7 @@ test_files:
|
|
294
303
|
- test/json/namespace_list.json
|
295
304
|
- test/json/node.json
|
296
305
|
- test/json/node_list.json
|
306
|
+
- test/json/node_notice.json
|
297
307
|
- test/json/persistent_volume.json
|
298
308
|
- test/json/persistent_volume_claim.json
|
299
309
|
- test/json/persistent_volume_claim_list.json
|
@@ -340,5 +350,6 @@ test_files:
|
|
340
350
|
- test/test_service.rb
|
341
351
|
- test/test_service_account.rb
|
342
352
|
- test/test_watch.rb
|
353
|
+
- test/test_watch_notice.rb
|
343
354
|
- test/txt/pod_log.txt
|
344
355
|
- test/valid_token_file
|