kubeclient 0.7.0 → 0.8.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6cc6a52d6452f6d15c033635596aabc29af83ce
4
- data.tar.gz: e56dff1999ee19dcbdfb9b29ca4155dde859b9b2
3
+ metadata.gz: c58fdcc763f33940a6827013a09ee5d6e6eaf89b
4
+ data.tar.gz: e749e8956a3c52a92a6bca8924ec9b15d592acd7
5
5
  SHA512:
6
- metadata.gz: cd96f2bd1b7dd6c2abd752194550d398541f90a14a903c033e36d03073e1a7839aeedc3f1ed87d8cf6f9f3acbbdd3fe455395e896314fc95a524e673115366d4
7
- data.tar.gz: 33820065e18c7609bde8a4d7bc8c10f076110a07a62dbde40ea2a6b45ef3373ac9cf2adb564b16eff9800a0e457bb2cacc1f845fa3835b2800a1389247cbe70c
6
+ metadata.gz: 56b1514eb727a55d5ee17f3d29503fd2438b6dc06fdcf4139a63f6010a791ec5d18076cc223f16abd14c5611e46b2cdb8a2b4ff756bc2f14063c6a83288357ac
7
+ data.tar.gz: 8b1175e0133a4967eb39d186785d4c4ad2d2cb6747f20166902e093d30f00b525445c9d5c276cf341c8f2a3a7ecf4648f825791911bb6d267011d97e1ce665c1
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Dependency Status](https://gemnasium.com/abonas/kubeclient.svg)](https://gemnasium.com/abonas/kubeclient)
7
7
 
8
8
  A Ruby client for Kubernetes REST api.
9
- The client supports GET, POST, PUT, DELETE on nodes, pods, secrets, services, replication controllers, namespaces, resource quotas, limit ranges, endpoints, persistent volumes and persistent volume claims.
9
+ The client supports GET, POST, PUT, DELETE on nodes, pods, secrets, services, replication controllers, namespaces, resource quotas, limit ranges, endpoints, persistent volumes, persistent volume claims and component statuses.
10
10
  The client currently supports Kubernetes REST api version v1.
11
11
 
12
12
  ## Installation
@@ -118,7 +118,7 @@ client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
118
118
  ## Examples:
119
119
 
120
120
  #### Get all instances of a specific entity type
121
- Such as: `get_pods`, `get_secrets`, `get_services`, `get_nodes`, `get_replication_controllers`, `get_resource_quotas`, `get_limit_ranges`, `get_persistent_volumes`, `get_persistent_volume_claims`
121
+ Such as: `get_pods`, `get_secrets`, `get_services`, `get_nodes`, `get_replication_controllers`, `get_resource_quotas`, `get_limit_ranges`, `get_persistent_volumes`, `get_persistent_volume_claims`, `get_component_statuses`
122
122
 
123
123
  ```ruby
124
124
  pods = client.get_pods
@@ -142,7 +142,7 @@ pods = client.get_pods(label_selector: 'name=redis-master,app=redis')
142
142
  ```
143
143
 
144
144
  #### Get a specific instance of an entity (by name)
145
- Such as: `get_service "service name"` , `get_pod "pod name"` , `get_replication_controller "rc name"`, `get_secret "secret name"`, `get_resource_quota "resource quota name"`, `get_limit_range "limit range name"` , `get_persistent_volume "persistent volume name"` , `get_persistent_volume_claim "persistent volume claim name"`
145
+ Such as: `get_service "service name"` , `get_pod "pod name"` , `get_replication_controller "rc name"`, `get_secret "secret name"`, `get_resource_quota "resource quota name"`, `get_limit_range "limit range name"` , `get_persistent_volume "persistent volume name"` , `get_persistent_volume_claim "persistent volume claim name"`, `get_component_status "component name"`
146
146
 
147
147
  The GET request should include the namespace name, except for nodes and namespaces entities.
148
148
 
@@ -203,8 +203,7 @@ client.update_service service1
203
203
  ```
204
204
 
205
205
  #### Get all entities of all types : all_entities
206
- Returns a hash with 12 keys (node, secret, service, pod, replication_controller, namespace, resource_quota, limit_range, endpoint, event, persistent_volume and persistent_volume_claim). Each key points to an EntityList of same type.
207
-
206
+ Returns a hash with 13 keys (node, secret, service, pod, replication_controller, namespace, resource_quota, limit_range, endpoint, event, persistent_volume, persistent_volume_claim and component_status). Each key points to an EntityList of same type.
208
207
  This method is a convenience method instead of calling each entity's get method separately.
209
208
 
210
209
  ```ruby
@@ -1,4 +1,4 @@
1
1
  # Kubernetes REST-API Client
2
2
  module Kubeclient
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
data/lib/kubeclient.rb CHANGED
@@ -19,7 +19,7 @@ module Kubeclient
19
19
  # and especially since currently the class body is empty
20
20
  ENTITY_TYPES = %w(Pod Service ReplicationController Node Event Endpoint
21
21
  Namespace Secret ResourceQuota LimitRange PersistentVolume
22
- PersistentVolumeClaim).map do |et|
22
+ PersistentVolumeClaim ComponentStatus).map do |et|
23
23
  clazz = Class.new(RecursiveOpenStruct) do
24
24
  def initialize(hash = nil, args = {})
25
25
  args.merge!(recurse_over_arrays: true)
@@ -0,0 +1,17 @@
1
+ {
2
+ "kind": "ComponentStatus",
3
+ "apiVersion": "v1",
4
+ "metadata": {
5
+ "name": "etcd-0",
6
+ "selfLink": "/api/v1/namespaces/componentstatuses/etcd-0",
7
+ "creationTimestamp": null
8
+ },
9
+ "conditions": [
10
+ {
11
+ "type": "Healthy",
12
+ "status": "True",
13
+ "message": "{\"health\": \"true\"}",
14
+ "error": "nil"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "kind": "ComponentStatusList",
3
+ "apiVersion": "v1",
4
+ "metadata": {
5
+ "selfLink": "/api/v1/componentstatuses"
6
+ },
7
+ "items": [
8
+ {
9
+ "metadata": {
10
+ "name": "controller-manager",
11
+ "selfLink": "/api/v1/namespaces/componentstatuses/controller-manager",
12
+ "creationTimestamp": null
13
+ },
14
+ "conditions": [
15
+ {
16
+ "type": "Healthy",
17
+ "status": "Unknown",
18
+ "error": "Get http://127.0.0.1:10252/healthz: dial tcp 127.0.0.1:10252: connection refused"
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "metadata": {
24
+ "name": "scheduler",
25
+ "selfLink": "/api/v1/namespaces/componentstatuses/scheduler",
26
+ "creationTimestamp": null
27
+ },
28
+ "conditions": [
29
+ {
30
+ "type": "Healthy",
31
+ "status": "Unknown",
32
+ "error": "Get http://127.0.0.1:10251/healthz: dial tcp 127.0.0.1:10251: connection refused"
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "metadata": {
38
+ "name": "etcd-0",
39
+ "selfLink": "/api/v1/namespaces/componentstatuses/etcd-0",
40
+ "creationTimestamp": null
41
+ },
42
+ "conditions": [
43
+ {
44
+ "type": "Healthy",
45
+ "status": "True",
46
+ "message": "{\"health\": \"true\"}",
47
+ "error": "nil"
48
+ }
49
+ ]
50
+ }
51
+ ]
52
+ }
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ # ComponentStatus tests
4
+ class TestComponentStatus < MiniTest::Test
5
+ def test_get_from_json_v3
6
+ stub_request(:get, %r{/componentstatuses})
7
+ .to_return(body: open_test_file('component_status.json'),
8
+ status: 200)
9
+
10
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
11
+ component_status = client.get_component_status 'etcd-0', 'default'
12
+
13
+ assert_instance_of(Kubeclient::ComponentStatus, component_status)
14
+ assert_equal('etcd-0', component_status.metadata.name)
15
+ assert_equal('Healthy', component_status.conditions[0].type)
16
+ assert_equal('True', component_status.conditions[0].status)
17
+
18
+ assert_requested(:get,
19
+ 'http://localhost:8080/api/v1/namespaces/default/componentstatuses/etcd-0',
20
+ times: 1)
21
+ end
22
+ end
@@ -230,9 +230,13 @@ class KubeClientTest < MiniTest::Test
230
230
  .to_return(body: open_test_file('persistent_volume_claim_list.json'),
231
231
  status: 200)
232
232
 
233
+ stub_request(:get, %r{/componentstatuses})
234
+ .to_return(body: open_test_file('component_status_list.json'),
235
+ status: 200)
236
+
233
237
  client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
234
238
  result = client.all_entities
235
- assert_equal(12, result.keys.size)
239
+ assert_equal(13, result.keys.size)
236
240
  assert_instance_of(Kubeclient::Common::EntityList, result['node'])
237
241
  assert_instance_of(Kubeclient::Common::EntityList, result['service'])
238
242
  assert_instance_of(Kubeclient::Common::EntityList,
@@ -251,6 +255,7 @@ class KubeClientTest < MiniTest::Test
251
255
  assert_instance_of(Kubeclient::LimitRange, result['limit_range'][0])
252
256
  assert_instance_of(Kubeclient::PersistentVolume, result['persistent_volume'][0])
253
257
  assert_instance_of(Kubeclient::PersistentVolumeClaim, result['persistent_volume_claim'][0])
258
+ assert_instance_of(Kubeclient::ComponentStatus, result['component_status'][0])
254
259
  end
255
260
 
256
261
  def test_api_bearer_token_with_params_success
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.7.0
4
+ version: 0.8.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-10-15 00:00:00.000000000 Z
11
+ date: 2015-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,6 +173,8 @@ files:
173
173
  - lib/kubeclient/watch_notice.rb
174
174
  - lib/kubeclient/watch_stream.rb
175
175
  - test/cassettes/kubernetes_guestbook.yml
176
+ - test/json/component_status.json
177
+ - test/json/component_status_list.json
176
178
  - test/json/created_namespace.json
177
179
  - test/json/created_secret.json
178
180
  - test/json/created_service.json
@@ -205,6 +207,7 @@ files:
205
207
  - test/json/service_update.json
206
208
  - test/json/versions_list.json
207
209
  - test/json/watch_stream.json
210
+ - test/test_component_status.rb
208
211
  - test/test_guestbook_go.rb
209
212
  - test/test_helper.rb
210
213
  - test/test_kubeclient.rb
@@ -247,6 +250,8 @@ specification_version: 4
247
250
  summary: A client for Kubernetes REST api
248
251
  test_files:
249
252
  - test/cassettes/kubernetes_guestbook.yml
253
+ - test/json/component_status.json
254
+ - test/json/component_status_list.json
250
255
  - test/json/created_namespace.json
251
256
  - test/json/created_secret.json
252
257
  - test/json/created_service.json
@@ -279,6 +284,7 @@ test_files:
279
284
  - test/json/service_update.json
280
285
  - test/json/versions_list.json
281
286
  - test/json/watch_stream.json
287
+ - test/test_component_status.rb
282
288
  - test/test_guestbook_go.rb
283
289
  - test/test_helper.rb
284
290
  - test/test_kubeclient.rb