kubeclient 0.5.1 → 0.6.0

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.

Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -11
  3. data/kubeclient.gemspec +1 -0
  4. data/lib/kubeclient.rb +1 -1
  5. data/lib/kubeclient/common.rb +3 -4
  6. data/lib/kubeclient/version.rb +1 -1
  7. data/test/cassettes/kubernetes_guestbook.yml +846 -0
  8. data/test/json/{created_namespace_b3.json → created_namespace.json} +2 -2
  9. data/test/json/{created_service_b3.json → created_service.json} +3 -3
  10. data/test/json/{empty_pod_list_b3.json → empty_pod_list.json} +2 -2
  11. data/test/json/{endpoint_list_b3.json → endpoint_list.json} +5 -5
  12. data/test/json/{entity_list_b3.json → entity_list.json} +6 -6
  13. data/test/json/{event_list_b3.json → event_list.json} +3 -3
  14. data/test/json/{namespace_b3.json → namespace.json} +2 -2
  15. data/test/json/{namespace_exception_b3.json → namespace_exception.json} +1 -1
  16. data/test/json/{namespace_list_b3.json → namespace_list.json} +4 -4
  17. data/test/json/{node_b3.json → node.json} +2 -2
  18. data/test/json/{node_list_b3.json → node_list.json} +3 -3
  19. data/test/json/persistent_volume_claims_nil_items.json +2 -2
  20. data/test/json/{pod_b3.json → pod.json} +2 -2
  21. data/test/json/{pod_list_b3.json → pod_list.json} +9 -5
  22. data/test/json/{replication_controller_b3.json → replication_controller.json} +2 -2
  23. data/test/json/{replication_controller_list_b3.json → replication_controller_list.json} +6 -4
  24. data/test/json/{secret_list_b3.json → secret_list.json} +4 -4
  25. data/test/json/{service_b3.json → service.json} +3 -3
  26. data/test/json/{service_list_b3.json → service_list.json} +8 -8
  27. data/test/json/{service_update_b3.json → service_update.json} +2 -2
  28. data/test/json/watch_stream.json +3 -0
  29. data/test/test_guestbook_go.rb +233 -0
  30. data/test/test_kubeclient.rb +37 -38
  31. data/test/test_limit_range.rb +1 -1
  32. data/test/test_namespace.rb +12 -12
  33. data/test/test_node.rb +5 -5
  34. data/test/test_persistent_volume.rb +1 -1
  35. data/test/test_persistent_volume_claim.rb +1 -1
  36. data/test/test_pod.rb +4 -4
  37. data/test/test_replication_controller.rb +4 -4
  38. data/test/test_resource_quota.rb +1 -1
  39. data/test/test_service.rb +13 -13
  40. data/test/test_watch.rb +3 -3
  41. metadata +61 -43
  42. data/test/json/watch_stream_b3.json +0 -3
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  # LimitRange tests
4
4
  class TestLimitRange < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/limitranges})
7
7
  .to_return(body: open_test_json_file('limit_range.json'),
8
8
  status: 200)
@@ -2,43 +2,43 @@ require 'test_helper'
2
2
 
3
3
  # Namespace entity tests
4
4
  class TestNamespace < MiniTest::Test
5
- def test_get_namespace_v1beta3
5
+ def test_get_namespace_v1
6
6
  stub_request(:get, %r{/namespaces})
7
- .to_return(body: open_test_json_file('namespace_b3.json'),
7
+ .to_return(body: open_test_json_file('namespace.json'),
8
8
  status: 200)
9
9
 
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
10
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
11
11
  namespace = client.get_namespace 'staging'
12
12
 
13
13
  assert_instance_of(Kubeclient::Namespace, namespace)
14
14
  assert_equal('e388bc10-c021-11e4-a514-3c970e4a436a', namespace.metadata.uid)
15
15
  assert_equal('staging', namespace.metadata.name)
16
16
  assert_equal('1168', namespace.metadata.resourceVersion)
17
- assert_equal('v1beta3', namespace.apiVersion)
17
+ assert_equal('v1', namespace.apiVersion)
18
18
 
19
19
  assert_requested(:get,
20
- 'http://localhost:8080/api/v1beta3/namespaces/staging',
20
+ 'http://localhost:8080/api/v1/namespaces/staging',
21
21
  times: 1)
22
22
  end
23
23
 
24
- def test_delete_namespace_v1beta3
24
+ def test_delete_namespace_v1
25
25
  our_namespace = Kubeclient::Namespace.new
26
- our_namespace.name = 'staging'
26
+ our_namespace.metadata = {}
27
+ our_namespace.metadata.name = 'staging'
27
28
 
28
29
  stub_request(:delete, %r{/namespaces})
29
30
  .to_return(status: 200)
30
-
31
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
32
- client.delete_namespace our_namespace.name
31
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
32
+ client.delete_namespace our_namespace.metadata.name
33
33
 
34
34
  assert_requested(:delete,
35
- 'http://localhost:8080/api/v1beta3/namespaces/staging',
35
+ 'http://localhost:8080/api/v1/namespaces/staging',
36
36
  times: 1)
37
37
  end
38
38
 
39
39
  def test_create_namespace
40
40
  stub_request(:post, %r{/namespaces})
41
- .to_return(body: open_test_json_file('created_namespace_b3.json'),
41
+ .to_return(body: open_test_json_file('created_namespace.json'),
42
42
  status: 201)
43
43
 
44
44
  namespace = Kubeclient::Namespace.new
data/test/test_node.rb CHANGED
@@ -2,12 +2,12 @@ require 'test_helper'
2
2
 
3
3
  # Node entity tests
4
4
  class TestNode < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/nodes})
7
- .to_return(body: open_test_json_file('node_b3.json'),
7
+ .to_return(body: open_test_json_file('node.json'),
8
8
  status: 200)
9
9
 
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
10
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
11
11
  node = client.get_node('127.0.0.1')
12
12
 
13
13
  assert_instance_of(Kubeclient::Node, node)
@@ -15,11 +15,11 @@ class TestNode < MiniTest::Test
15
15
  assert_equal('041143c5-ce39-11e4-ac24-3c970e4a436a', node.metadata.uid)
16
16
  assert_equal('127.0.0.1', node.metadata.name)
17
17
  assert_equal('1724', node.metadata.resourceVersion)
18
- assert_equal('v1beta3', node.apiVersion)
18
+ assert_equal('v1', node.apiVersion)
19
19
  assert_equal('2015-03-19T15:08:20+02:00', node.metadata.creationTimestamp)
20
20
 
21
21
  assert_requested(:get,
22
- 'http://localhost:8080/api/v1beta3/nodes/127.0.0.1',
22
+ 'http://localhost:8080/api/v1/nodes/127.0.0.1',
23
23
  times: 1)
24
24
  end
25
25
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  # PersistentVolume tests
4
4
  class TestPersistentVolume < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/persistentvolumes})
7
7
  .to_return(body: open_test_json_file('persistent_volume.json'),
8
8
  status: 200)
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  # PersistentVolumeClaim tests
4
4
  class TestPersistentVolumeClaim < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/persistentvolumeclaims})
7
7
  .to_return(body: open_test_json_file('persistent_volume_claim.json'),
8
8
  status: 200)
data/test/test_pod.rb CHANGED
@@ -2,12 +2,12 @@ require 'test_helper'
2
2
 
3
3
  # Pod entity tests
4
4
  class TestPod < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/pods})
7
- .to_return(body: open_test_json_file('pod_b3.json'),
7
+ .to_return(body: open_test_json_file('pod.json'),
8
8
  status: 200)
9
9
 
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
10
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
11
11
  pod = client.get_pod 'redis-master-pod', 'default'
12
12
 
13
13
  assert_instance_of(Kubeclient::Pod, pod)
@@ -15,7 +15,7 @@ class TestPod < MiniTest::Test
15
15
  assert_equal('dockerfile/redis', pod.spec.containers[0]['image'])
16
16
 
17
17
  assert_requested(:get,
18
- 'http://localhost:8080/api/v1beta3/namespaces/default/pods/redis-master-pod',
18
+ 'http://localhost:8080/api/v1/namespaces/default/pods/redis-master-pod',
19
19
  times: 1)
20
20
  end
21
21
  end
@@ -2,12 +2,12 @@ require 'test_helper'
2
2
 
3
3
  # Replication Controller entity tests
4
4
  class TestReplicationController < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/replicationcontrollers})
7
- .to_return(body: open_test_json_file('replication_controller_b3.json'),
7
+ .to_return(body: open_test_json_file('replication_controller.json'),
8
8
  status: 200)
9
9
 
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
10
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
11
11
  rc = client.get_replication_controller 'frontendController', 'default'
12
12
 
13
13
  assert_instance_of(Kubeclient::ReplicationController, rc)
@@ -18,7 +18,7 @@ class TestReplicationController < MiniTest::Test
18
18
  assert_equal('guestbook', rc.spec.selector.name)
19
19
 
20
20
  assert_requested(:get,
21
- 'http://localhost:8080/api/v1beta3/namespaces/default/replicationcontrollers/frontendController',
21
+ 'http://localhost:8080/api/v1/namespaces/default/replicationcontrollers/frontendController',
22
22
  times: 1)
23
23
  end
24
24
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  # ResourceQuota tests
4
4
  class TestResourceQuota < MiniTest::Test
5
- def test_get_from_json_v3
5
+ def test_get_from_json_v1
6
6
  stub_request(:get, %r{/resourcequotas})
7
7
  .to_return(body: open_test_json_file('resource_quota.json'),
8
8
  status: 200)
data/test/test_service.rb CHANGED
@@ -24,7 +24,7 @@ class TestService < MiniTest::Test
24
24
  hash[:metadata][:labels][:name]
25
25
 
26
26
  stub_request(:post, %r{namespaces/staging/services})
27
- .to_return(body: open_test_json_file('created_service_b3.json'),
27
+ .to_return(body: open_test_json_file('created_service.json'),
28
28
  status: 201)
29
29
 
30
30
  client = Kubeclient::Client.new 'http://localhost:8080/api/'
@@ -35,9 +35,9 @@ class TestService < MiniTest::Test
35
35
  assert_equal(created.spec.ports.size, our_service.spec.ports.size)
36
36
  end
37
37
 
38
- def test_conversion_from_json_v3
38
+ def test_conversion_from_json_v1
39
39
  stub_request(:get, %r{/services})
40
- .to_return(body: open_test_json_file('service_b3.json'),
40
+ .to_return(body: open_test_json_file('service.json'),
41
41
  status: 200)
42
42
 
43
43
  client = Kubeclient::Client.new 'http://localhost:8080/api/'
@@ -49,8 +49,8 @@ class TestService < MiniTest::Test
49
49
  assert_equal('bdb80a8f-db93-11e4-b293-f8b156af4ae1', service.metadata.uid)
50
50
  assert_equal('redis-slave', service.metadata.name)
51
51
  assert_equal('2815', service.metadata.resourceVersion)
52
- assert_equal('v1beta3', service.apiVersion)
53
- assert_equal('10.0.0.140', service.spec.portalIP)
52
+ assert_equal('v1', service.apiVersion)
53
+ assert_equal('10.0.0.140', service.spec.clusterIP)
54
54
  assert_equal('development', service.metadata.namespace)
55
55
 
56
56
  assert_equal('TCP', service.spec.ports[0].protocol)
@@ -59,7 +59,7 @@ class TestService < MiniTest::Test
59
59
  assert_equal('redis-server', service.spec.ports[0].targetPort)
60
60
 
61
61
  assert_requested(:get,
62
- 'http://localhost:8080/api/v1beta3/namespaces/development/services/redis-slave',
62
+ 'http://localhost:8080/api/v1/namespaces/development/services/redis-slave',
63
63
  times: 1)
64
64
  end
65
65
 
@@ -74,11 +74,11 @@ class TestService < MiniTest::Test
74
74
  stub_request(:delete, %r{/namespaces/default/services})
75
75
  .to_return(status: 200)
76
76
 
77
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
77
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
78
78
  client.delete_service our_service.name, 'default'
79
79
 
80
80
  assert_requested(:delete,
81
- 'http://localhost:8080/api/v1beta3/namespaces/default/services/redis-service',
81
+ 'http://localhost:8080/api/v1/namespaces/default/services/redis-service',
82
82
  times: 1)
83
83
  end
84
84
 
@@ -98,7 +98,7 @@ class TestService < MiniTest::Test
98
98
 
99
99
  def test_get_service
100
100
  stub_request(:get, %r{/namespaces/development/services/redis-slave})
101
- .to_return(body: open_test_json_file('service_b3.json'),
101
+ .to_return(body: open_test_json_file('service.json'),
102
102
  status: 200)
103
103
 
104
104
  client = Kubeclient::Client.new 'http://localhost:8080/api/'
@@ -106,7 +106,7 @@ class TestService < MiniTest::Test
106
106
  assert_equal('redis-slave', service.metadata.name)
107
107
 
108
108
  assert_requested(:get,
109
- 'http://localhost:8080/api/v1beta3/namespaces/development/services/redis-slave',
109
+ 'http://localhost:8080/api/v1/namespaces/development/services/redis-slave',
110
110
  times: 1)
111
111
  end
112
112
 
@@ -120,16 +120,16 @@ class TestService < MiniTest::Test
120
120
 
121
121
  stub_request(:put, %r{/services/#{name}})\
122
122
  .to_return(
123
- body: open_test_json_file('service_update_b3.json'),
123
+ body: open_test_json_file('service_update.json'),
124
124
  status: 200
125
125
  )
126
126
 
127
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
127
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
128
128
  client.update_entity entity, object
129
129
 
130
130
  assert_requested(
131
131
  :put,
132
- "http://localhost:8080/api/v1beta3/services/#{name}",
132
+ "http://localhost:8080/api/v1/services/#{name}",
133
133
  times: 1
134
134
  )
135
135
  end
data/test/test_watch.rb CHANGED
@@ -10,10 +10,10 @@ class TestWatch < MiniTest::Test
10
10
  ]
11
11
 
12
12
  stub_request(:get, %r{.*\/watch/pods})
13
- .to_return(body: open_test_json_file('watch_stream_b3.json'),
13
+ .to_return(body: open_test_json_file('watch_stream.json'),
14
14
  status: 200)
15
15
 
16
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
16
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
17
17
 
18
18
  client.watch_pods.to_enum.with_index do |notice, index|
19
19
  assert_instance_of(Kubeclient::Common::WatchNotice, notice)
@@ -28,7 +28,7 @@ class TestWatch < MiniTest::Test
28
28
  def test_watch_pod_failure
29
29
  stub_request(:get, %r{.*\/watch/pods}).to_return(status: 404)
30
30
 
31
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
31
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
32
32
  assert_raises KubeException do
33
33
  client.watch_pods.each do
34
34
  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: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alissa Bonas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,38 +172,40 @@ files:
158
172
  - lib/kubeclient/version.rb
159
173
  - lib/kubeclient/watch_notice.rb
160
174
  - lib/kubeclient/watch_stream.rb
161
- - test/json/created_namespace_b3.json
175
+ - test/cassettes/kubernetes_guestbook.yml
176
+ - test/json/created_namespace.json
162
177
  - test/json/created_secret.json
163
- - test/json/created_service_b3.json
164
- - test/json/empty_pod_list_b3.json
165
- - test/json/endpoint_list_b3.json
166
- - test/json/entity_list_b3.json
167
- - test/json/event_list_b3.json
178
+ - test/json/created_service.json
179
+ - test/json/empty_pod_list.json
180
+ - test/json/endpoint_list.json
181
+ - test/json/entity_list.json
182
+ - test/json/event_list.json
168
183
  - test/json/limit_range.json
169
184
  - test/json/limit_range_list.json
170
- - test/json/namespace_b3.json
171
- - test/json/namespace_exception_b3.json
172
- - test/json/namespace_list_b3.json
173
- - test/json/node_b3.json
174
- - test/json/node_list_b3.json
185
+ - test/json/namespace.json
186
+ - test/json/namespace_exception.json
187
+ - test/json/namespace_list.json
188
+ - test/json/node.json
189
+ - test/json/node_list.json
175
190
  - test/json/persistent_volume.json
176
191
  - test/json/persistent_volume_claim.json
177
192
  - test/json/persistent_volume_claim_list.json
178
193
  - test/json/persistent_volume_claims_nil_items.json
179
194
  - test/json/persistent_volume_list.json
180
- - test/json/pod_b3.json
181
- - test/json/pod_list_b3.json
182
- - test/json/replication_controller_b3.json
183
- - test/json/replication_controller_list_b3.json
195
+ - test/json/pod.json
196
+ - test/json/pod_list.json
197
+ - test/json/replication_controller.json
198
+ - test/json/replication_controller_list.json
184
199
  - test/json/resource_quota.json
185
200
  - test/json/resource_quota_list.json
186
- - test/json/secret_list_b3.json
187
- - test/json/service_b3.json
201
+ - test/json/secret_list.json
202
+ - test/json/service.json
188
203
  - test/json/service_illegal_json_404.json
189
- - test/json/service_list_b3.json
190
- - test/json/service_update_b3.json
204
+ - test/json/service_list.json
205
+ - test/json/service_update.json
191
206
  - test/json/versions_list.json
192
- - test/json/watch_stream_b3.json
207
+ - test/json/watch_stream.json
208
+ - test/test_guestbook_go.rb
193
209
  - test/test_helper.rb
194
210
  - test/test_kubeclient.rb
195
211
  - test/test_limit_range.rb
@@ -224,43 +240,45 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
240
  version: '0'
225
241
  requirements: []
226
242
  rubyforge_project:
227
- rubygems_version: 2.0.14
243
+ rubygems_version: 2.4.5
228
244
  signing_key:
229
245
  specification_version: 4
230
246
  summary: A client for Kubernetes REST api
231
247
  test_files:
232
- - test/json/created_namespace_b3.json
248
+ - test/cassettes/kubernetes_guestbook.yml
249
+ - test/json/created_namespace.json
233
250
  - test/json/created_secret.json
234
- - test/json/created_service_b3.json
235
- - test/json/empty_pod_list_b3.json
236
- - test/json/endpoint_list_b3.json
237
- - test/json/entity_list_b3.json
238
- - test/json/event_list_b3.json
251
+ - test/json/created_service.json
252
+ - test/json/empty_pod_list.json
253
+ - test/json/endpoint_list.json
254
+ - test/json/entity_list.json
255
+ - test/json/event_list.json
239
256
  - test/json/limit_range.json
240
257
  - test/json/limit_range_list.json
241
- - test/json/namespace_b3.json
242
- - test/json/namespace_exception_b3.json
243
- - test/json/namespace_list_b3.json
244
- - test/json/node_b3.json
245
- - test/json/node_list_b3.json
258
+ - test/json/namespace.json
259
+ - test/json/namespace_exception.json
260
+ - test/json/namespace_list.json
261
+ - test/json/node.json
262
+ - test/json/node_list.json
246
263
  - test/json/persistent_volume.json
247
264
  - test/json/persistent_volume_claim.json
248
265
  - test/json/persistent_volume_claim_list.json
249
266
  - test/json/persistent_volume_claims_nil_items.json
250
267
  - test/json/persistent_volume_list.json
251
- - test/json/pod_b3.json
252
- - test/json/pod_list_b3.json
253
- - test/json/replication_controller_b3.json
254
- - test/json/replication_controller_list_b3.json
268
+ - test/json/pod.json
269
+ - test/json/pod_list.json
270
+ - test/json/replication_controller.json
271
+ - test/json/replication_controller_list.json
255
272
  - test/json/resource_quota.json
256
273
  - test/json/resource_quota_list.json
257
- - test/json/secret_list_b3.json
258
- - test/json/service_b3.json
274
+ - test/json/secret_list.json
275
+ - test/json/service.json
259
276
  - test/json/service_illegal_json_404.json
260
- - test/json/service_list_b3.json
261
- - test/json/service_update_b3.json
277
+ - test/json/service_list.json
278
+ - test/json/service_update.json
262
279
  - test/json/versions_list.json
263
- - test/json/watch_stream_b3.json
280
+ - test/json/watch_stream.json
281
+ - test/test_guestbook_go.rb
264
282
  - test/test_helper.rb
265
283
  - test/test_kubeclient.rb
266
284
  - test/test_limit_range.rb