kubeclient 0.1.12 → 0.1.13
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/lib/kubeclient/common.rb +7 -9
- data/lib/kubeclient/version.rb +1 -1
- data/test/test_kubeclient.rb +4 -0
- data/test/test_namespace.rb +8 -0
- data/test/test_node.rb +4 -0
- data/test/test_pod.rb +5 -1
- data/test/test_replication_controller.rb +5 -1
- data/test/test_service.rb +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e56c3b573a2c07c74aa8de8048af1dda5e579f8a
|
4
|
+
data.tar.gz: 1e05214d7d5873ebb19c18495ed4085a66dc47aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a1d759639dd39f6e9fb7c21108469f50a90116f8e4cc9b3725b9fe4d3fa241945c5f5523cb99bbee922db296f7d719bde706d9cd2fb4cddfefa2866348dbd20
|
7
|
+
data.tar.gz: 2fa195b4588382542a48cb80a68f161a5d609b594a4987a47fcc01edbad314b64876aa963bd78e0307f6d71a60aeaba9ef408aed3884ba61057328e1da190b40
|
data/lib/kubeclient/common.rb
CHANGED
@@ -50,8 +50,8 @@ module Kubeclient
|
|
50
50
|
get_entity(entity_type, klass, name, namespace)
|
51
51
|
end
|
52
52
|
|
53
|
-
define_method("delete_#{entity_name}") do |name|
|
54
|
-
delete_entity(entity_type, name)
|
53
|
+
define_method("delete_#{entity_name}") do |name, namespace = nil|
|
54
|
+
delete_entity(entity_type, name, namespace)
|
55
55
|
end
|
56
56
|
|
57
57
|
define_method("create_#{entity_name}") do |entity_config|
|
@@ -137,9 +137,11 @@ module Kubeclient
|
|
137
137
|
new_entity(result, klass)
|
138
138
|
end
|
139
139
|
|
140
|
-
def delete_entity(entity_type, name)
|
140
|
+
def delete_entity(entity_type, name, namespace = nil)
|
141
|
+
ns_prefix = build_namespace_prefix(namespace)
|
141
142
|
handle_exception do
|
142
|
-
rest_client[resource_name(entity_type) + "/#{name}"]
|
143
|
+
rest_client[ns_prefix + resource_name(entity_type) + "/#{name}"]
|
144
|
+
.delete
|
143
145
|
end
|
144
146
|
end
|
145
147
|
|
@@ -189,11 +191,7 @@ module Kubeclient
|
|
189
191
|
end
|
190
192
|
|
191
193
|
def resource_name(entity_type)
|
192
|
-
|
193
|
-
entity_type.pluralize.camelize(:lower)
|
194
|
-
else
|
195
|
-
entity_type.pluralize.downcase
|
196
|
-
end
|
194
|
+
entity_type.pluralize.downcase
|
197
195
|
end
|
198
196
|
|
199
197
|
def ssl_options(client_cert: nil, client_key: nil, ca_file: nil,
|
data/lib/kubeclient/version.rb
CHANGED
data/test/test_kubeclient.rb
CHANGED
@@ -150,6 +150,10 @@ class KubeClientTest < MiniTest::Test
|
|
150
150
|
assert_equal(2, services.size)
|
151
151
|
assert_instance_of(Kubeclient::Service, services[0])
|
152
152
|
assert_instance_of(Kubeclient::Service, services[1])
|
153
|
+
|
154
|
+
assert_requested(:get,
|
155
|
+
'http://localhost:8080/api/v1beta3/services',
|
156
|
+
times: 1)
|
153
157
|
end
|
154
158
|
|
155
159
|
def test_empty_list
|
data/test/test_namespace.rb
CHANGED
@@ -15,6 +15,10 @@ class TestNamespace < MiniTest::Test
|
|
15
15
|
assert_equal('staging', namespace.metadata.name)
|
16
16
|
assert_equal('1168', namespace.metadata.resourceVersion)
|
17
17
|
assert_equal('v1beta3', namespace.apiVersion)
|
18
|
+
|
19
|
+
assert_requested(:get,
|
20
|
+
'http://localhost:8080/api/v1beta3/namespaces/staging',
|
21
|
+
times: 1)
|
18
22
|
end
|
19
23
|
|
20
24
|
def test_delete_namespace_v1beta3
|
@@ -26,6 +30,10 @@ class TestNamespace < MiniTest::Test
|
|
26
30
|
|
27
31
|
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
28
32
|
client.delete_namespace our_namespace.name
|
33
|
+
|
34
|
+
assert_requested(:delete,
|
35
|
+
'http://localhost:8080/api/v1beta3/namespaces/staging',
|
36
|
+
times: 1)
|
29
37
|
end
|
30
38
|
|
31
39
|
def test_create_namespace
|
data/test/test_node.rb
CHANGED
@@ -17,5 +17,9 @@ class TestNode < MiniTest::Test
|
|
17
17
|
assert_equal('1724', node.metadata.resourceVersion)
|
18
18
|
assert_equal('v1beta3', node.apiVersion)
|
19
19
|
assert_equal('2015-03-19T15:08:20+02:00', node.metadata.creationTimestamp)
|
20
|
+
|
21
|
+
assert_requested(:get,
|
22
|
+
'http://localhost:8080/api/v1beta3/nodes/127.0.0.1',
|
23
|
+
times: 1)
|
20
24
|
end
|
21
25
|
end
|
data/test/test_pod.rb
CHANGED
@@ -8,10 +8,14 @@ class TestPod < MiniTest::Test
|
|
8
8
|
status: 200)
|
9
9
|
|
10
10
|
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
11
|
-
pod = client.get_pod 'redis-master-pod'
|
11
|
+
pod = client.get_pod 'redis-master-pod', 'default'
|
12
12
|
|
13
13
|
assert_instance_of(Kubeclient::Pod, pod)
|
14
14
|
assert_equal('redis-master3', pod.metadata.name)
|
15
15
|
assert_equal('dockerfile/redis', pod.spec.containers[0]['image'])
|
16
|
+
|
17
|
+
assert_requested(:get,
|
18
|
+
'http://localhost:8080/api/v1beta3/namespaces/default/pods/redis-master-pod',
|
19
|
+
times: 1)
|
16
20
|
end
|
17
21
|
end
|
@@ -8,7 +8,7 @@ class TestReplicationController < MiniTest::Test
|
|
8
8
|
status: 200)
|
9
9
|
|
10
10
|
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
11
|
-
rc = client.get_replication_controller 'frontendController'
|
11
|
+
rc = client.get_replication_controller 'frontendController', 'default'
|
12
12
|
|
13
13
|
assert_instance_of(Kubeclient::ReplicationController, rc)
|
14
14
|
assert_equal('guestbook-controller', rc.metadata.name)
|
@@ -16,5 +16,9 @@ class TestReplicationController < MiniTest::Test
|
|
16
16
|
assert_equal('default', rc.metadata.namespace)
|
17
17
|
assert_equal(3, rc.spec.replicas)
|
18
18
|
assert_equal('guestbook', rc.spec.selector.name)
|
19
|
+
|
20
|
+
assert_requested(:get,
|
21
|
+
'http://localhost:8080/api/v1beta3/namespaces/default/replicationcontrollers/frontendController',
|
22
|
+
times: 1)
|
19
23
|
end
|
20
24
|
end
|
data/test/test_service.rb
CHANGED
@@ -41,7 +41,7 @@ class TestService < MiniTest::Test
|
|
41
41
|
status: 200)
|
42
42
|
|
43
43
|
client = Kubeclient::Client.new 'http://localhost:8080/api/'
|
44
|
-
service = client.get_service '
|
44
|
+
service = client.get_service 'redis-slave', 'development'
|
45
45
|
|
46
46
|
assert_instance_of(Kubeclient::Service, service)
|
47
47
|
assert_equal('2015-04-05T13:00:31Z',
|
@@ -57,6 +57,10 @@ class TestService < MiniTest::Test
|
|
57
57
|
assert_equal(6379, service.spec.ports[0].port)
|
58
58
|
assert_equal('', service.spec.ports[0].name)
|
59
59
|
assert_equal('redis-server', service.spec.ports[0].targetPort)
|
60
|
+
|
61
|
+
assert_requested(:get,
|
62
|
+
'http://localhost:8080/api/v1beta3/namespaces/development/services/redis-slave',
|
63
|
+
times: 1)
|
60
64
|
end
|
61
65
|
|
62
66
|
def test_delete_service
|
@@ -67,11 +71,15 @@ class TestService < MiniTest::Test
|
|
67
71
|
our_service.labels.component = 'apiserver'
|
68
72
|
our_service.labels.provider = 'kubernetes'
|
69
73
|
|
70
|
-
stub_request(:delete, %r{/services})
|
74
|
+
stub_request(:delete, %r{/namespaces/default/services})
|
71
75
|
.to_return(status: 200)
|
72
76
|
|
73
77
|
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
74
|
-
client.delete_service our_service.
|
78
|
+
client.delete_service our_service.name, 'default'
|
79
|
+
|
80
|
+
assert_requested(:delete,
|
81
|
+
'http://localhost:8080/api/v1beta3/namespaces/default/services/redis-service',
|
82
|
+
times: 1)
|
75
83
|
end
|
76
84
|
|
77
85
|
def test_get_service_no_ns
|
@@ -96,5 +104,9 @@ class TestService < MiniTest::Test
|
|
96
104
|
client = Kubeclient::Client.new 'http://localhost:8080/api/'
|
97
105
|
service = client.get_service 'redis-slave', 'development'
|
98
106
|
assert_equal('redis-slave', service.metadata.name)
|
107
|
+
|
108
|
+
assert_requested(:get,
|
109
|
+
'http://localhost:8080/api/v1beta3/namespaces/development/services/redis-slave',
|
110
|
+
times: 1)
|
99
111
|
end
|
100
112
|
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.1.
|
4
|
+
version: 0.1.13
|
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-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|