ruboty-k8s 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruboty/k8s/version.rb +1 -1
  3. data/ruboty-k8s.gemspec +1 -9
  4. metadata +4 -183
  5. data/lib/kubeclient/.gitignore +0 -15
  6. data/lib/kubeclient/.rubocop.yml +0 -16
  7. data/lib/kubeclient/.travis.yml +0 -12
  8. data/lib/kubeclient/Gemfile +0 -4
  9. data/lib/kubeclient/LICENSE.txt +0 -22
  10. data/lib/kubeclient/README.md +0 -428
  11. data/lib/kubeclient/Rakefile +0 -12
  12. data/lib/kubeclient/kubeclient.gemspec +0 -31
  13. data/lib/kubeclient/lib/kubeclient.rb +0 -32
  14. data/lib/kubeclient/lib/kubeclient/common.rb +0 -512
  15. data/lib/kubeclient/lib/kubeclient/config.rb +0 -126
  16. data/lib/kubeclient/lib/kubeclient/entity_list.rb +0 -16
  17. data/lib/kubeclient/lib/kubeclient/kube_exception.rb +0 -14
  18. data/lib/kubeclient/lib/kubeclient/missing_kind_compatibility.rb +0 -68
  19. data/lib/kubeclient/lib/kubeclient/version.rb +0 -4
  20. data/lib/kubeclient/lib/kubeclient/watch_notice.rb +0 -7
  21. data/lib/kubeclient/lib/kubeclient/watch_stream.rb +0 -80
  22. data/lib/kubeclient/test/cassettes/kubernetes_guestbook.yml +0 -879
  23. data/lib/kubeclient/test/config/allinone.kubeconfig +0 -20
  24. data/lib/kubeclient/test/config/external-ca.pem +0 -18
  25. data/lib/kubeclient/test/config/external-cert.pem +0 -19
  26. data/lib/kubeclient/test/config/external-key.rsa +0 -27
  27. data/lib/kubeclient/test/config/external.kubeconfig +0 -20
  28. data/lib/kubeclient/test/config/nouser.kubeconfig +0 -16
  29. data/lib/kubeclient/test/config/userauth.kubeconfig +0 -28
  30. data/lib/kubeclient/test/json/bindings_list.json +0 -10
  31. data/lib/kubeclient/test/json/component_status.json +0 -17
  32. data/lib/kubeclient/test/json/component_status_list.json +0 -52
  33. data/lib/kubeclient/test/json/config_map_list.json +0 -9
  34. data/lib/kubeclient/test/json/core_api_resource_list.json +0 -181
  35. data/lib/kubeclient/test/json/core_api_resource_list_without_kind.json +0 -129
  36. data/lib/kubeclient/test/json/core_oapi_resource_list_without_kind.json +0 -197
  37. data/lib/kubeclient/test/json/created_endpoint.json +0 -28
  38. data/lib/kubeclient/test/json/created_namespace.json +0 -20
  39. data/lib/kubeclient/test/json/created_secret.json +0 -16
  40. data/lib/kubeclient/test/json/created_service.json +0 -31
  41. data/lib/kubeclient/test/json/empty_pod_list.json +0 -9
  42. data/lib/kubeclient/test/json/endpoint_list.json +0 -48
  43. data/lib/kubeclient/test/json/entity_list.json +0 -56
  44. data/lib/kubeclient/test/json/event_list.json +0 -35
  45. data/lib/kubeclient/test/json/limit_range.json +0 -23
  46. data/lib/kubeclient/test/json/limit_range_list.json +0 -31
  47. data/lib/kubeclient/test/json/namespace.json +0 -13
  48. data/lib/kubeclient/test/json/namespace_exception.json +0 -8
  49. data/lib/kubeclient/test/json/namespace_list.json +0 -32
  50. data/lib/kubeclient/test/json/node.json +0 -29
  51. data/lib/kubeclient/test/json/node_list.json +0 -37
  52. data/lib/kubeclient/test/json/persistent_volume.json +0 -37
  53. data/lib/kubeclient/test/json/persistent_volume_claim.json +0 -32
  54. data/lib/kubeclient/test/json/persistent_volume_claim_list.json +0 -40
  55. data/lib/kubeclient/test/json/persistent_volume_claims_nil_items.json +0 -8
  56. data/lib/kubeclient/test/json/persistent_volume_list.json +0 -45
  57. data/lib/kubeclient/test/json/pod.json +0 -92
  58. data/lib/kubeclient/test/json/pod_list.json +0 -79
  59. data/lib/kubeclient/test/json/pod_template_list.json +0 -9
  60. data/lib/kubeclient/test/json/processed_template.json +0 -27
  61. data/lib/kubeclient/test/json/replication_controller.json +0 -57
  62. data/lib/kubeclient/test/json/replication_controller_list.json +0 -66
  63. data/lib/kubeclient/test/json/resource_quota.json +0 -46
  64. data/lib/kubeclient/test/json/resource_quota_list.json +0 -54
  65. data/lib/kubeclient/test/json/secret_list.json +0 -44
  66. data/lib/kubeclient/test/json/service.json +0 -33
  67. data/lib/kubeclient/test/json/service_account.json +0 -25
  68. data/lib/kubeclient/test/json/service_account_list.json +0 -82
  69. data/lib/kubeclient/test/json/service_illegal_json_404.json +0 -1
  70. data/lib/kubeclient/test/json/service_list.json +0 -97
  71. data/lib/kubeclient/test/json/service_patch.json +0 -25
  72. data/lib/kubeclient/test/json/service_update.json +0 -22
  73. data/lib/kubeclient/test/json/versions_list.json +0 -6
  74. data/lib/kubeclient/test/json/watch_stream.json +0 -3
  75. data/lib/kubeclient/test/test_common.rb +0 -32
  76. data/lib/kubeclient/test/test_component_status.rb +0 -30
  77. data/lib/kubeclient/test/test_config.rb +0 -72
  78. data/lib/kubeclient/test/test_endpoint.rb +0 -35
  79. data/lib/kubeclient/test/test_guestbook_go.rb +0 -238
  80. data/lib/kubeclient/test/test_helper.rb +0 -10
  81. data/lib/kubeclient/test/test_kubeclient.rb +0 -611
  82. data/lib/kubeclient/test/test_limit_range.rb +0 -27
  83. data/lib/kubeclient/test/test_missing_methods.rb +0 -42
  84. data/lib/kubeclient/test/test_namespace.rb +0 -61
  85. data/lib/kubeclient/test/test_node.rb +0 -33
  86. data/lib/kubeclient/test/test_persistent_volume.rb +0 -30
  87. data/lib/kubeclient/test/test_persistent_volume_claim.rb +0 -30
  88. data/lib/kubeclient/test/test_pod.rb +0 -29
  89. data/lib/kubeclient/test/test_pod_log.rb +0 -50
  90. data/lib/kubeclient/test/test_process_template.rb +0 -44
  91. data/lib/kubeclient/test/test_replication_controller.rb +0 -27
  92. data/lib/kubeclient/test/test_resource_list_without_kind.rb +0 -78
  93. data/lib/kubeclient/test/test_resource_quota.rb +0 -25
  94. data/lib/kubeclient/test/test_secret.rb +0 -70
  95. data/lib/kubeclient/test/test_service.rb +0 -293
  96. data/lib/kubeclient/test/test_service_account.rb +0 -28
  97. data/lib/kubeclient/test/test_watch.rb +0 -119
  98. data/lib/kubeclient/test/txt/pod_log.txt +0 -6
  99. data/lib/kubeclient/test/valid_token_file +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ab9daf2b45fadca0564cdd68af5a11314ab8174
4
- data.tar.gz: d90d1e116b4bba2f3380b91a3e69e58123dd72e3
3
+ metadata.gz: 86f8273d8c085d364ff5d9f38a4c550c6e6df7bf
4
+ data.tar.gz: 1ab524ecc65ab653fea0772651607d2e5249f8c3
5
5
  SHA512:
6
- metadata.gz: f3746bd838416f69d2c5e8f5f5fe9aa4736b4c2241c5677fa9755d9ac017ec0c4504bb54204898b6fa17c91a5ee46952fbf8d44c0ed53145861587e113eedf4b
7
- data.tar.gz: ef5383cc7c2655a04d9e8f2a25520248cb17d5b6e4e1a10e0fbde1255fa340c4317729f81abe7c769e40f50757e78c491bd166e8dd2c2375ebf124fe0fd29941
6
+ metadata.gz: f812a5cfd4079e9840a2874026f6f9fc039b9347ab37255ac235f6fc48808a83522f2784d98f06e5fa11f15fe209af2238c42eba9f5eb6106205755b7d33a0c1
7
+ data.tar.gz: 6362f74a0d774773d9cd00b747b1d862ded931cddc8e63acd88de1dd9d093419bbd22344c05cceac57763ee61fd04a846a6565bff90ced294cd9dde8d87894eb
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module K8s
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
- $:.push File.expand_path('../lib/kubeclient/lib', __FILE__)
4
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
4
  require 'ruboty/k8s/version'
6
5
 
@@ -21,14 +20,7 @@ Gem::Specification.new do |spec|
21
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
21
  spec.require_paths = ["lib"]
23
22
 
24
- # Dependency for kubeclient
25
- spec.add_development_dependency 'minitest'
26
- spec.add_development_dependency 'webmock', '~> 1.24.2'
27
- spec.add_development_dependency 'vcr'
28
- spec.add_development_dependency 'rubocop', '= 0.46.0'
29
- spec.add_dependency 'rest-client'
30
- spec.add_dependency 'recursive-open-struct', '= 1.0.0'
31
- spec.add_dependency 'http', '= 0.9.8'
23
+ spec.add_dependency "kubeclient-rollback-dev", '2.3.1'
32
24
 
33
25
  spec.add_development_dependency "bundler", "~> 1.13"
34
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-k8s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cnosuke
@@ -11,103 +11,19 @@ cert_chain: []
11
11
  date: 2017-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: minitest
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: webmock
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.24.2
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.24.2
41
- - !ruby/object:Gem::Dependency
42
- name: vcr
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 0.46.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 0.46.0
69
- - !ruby/object:Gem::Dependency
70
- name: rest-client
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: recursive-open-struct
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 1.0.0
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 1.0.0
97
- - !ruby/object:Gem::Dependency
98
- name: http
14
+ name: kubeclient-rollback-dev
99
15
  requirement: !ruby/object:Gem::Requirement
100
16
  requirements:
101
17
  - - '='
102
18
  - !ruby/object:Gem::Version
103
- version: 0.9.8
19
+ version: 2.3.1
104
20
  type: :runtime
105
21
  prerelease: false
106
22
  version_requirements: !ruby/object:Gem::Requirement
107
23
  requirements:
108
24
  - - '='
109
25
  - !ruby/object:Gem::Version
110
- version: 0.9.8
26
+ version: 2.3.1
111
27
  - !ruby/object:Gem::Dependency
112
28
  name: bundler
113
29
  requirement: !ruby/object:Gem::Requirement
@@ -180,101 +96,6 @@ files:
180
96
  - Rakefile
181
97
  - bin/console
182
98
  - bin/setup
183
- - lib/kubeclient/.gitignore
184
- - lib/kubeclient/.rubocop.yml
185
- - lib/kubeclient/.travis.yml
186
- - lib/kubeclient/Gemfile
187
- - lib/kubeclient/LICENSE.txt
188
- - lib/kubeclient/README.md
189
- - lib/kubeclient/Rakefile
190
- - lib/kubeclient/kubeclient.gemspec
191
- - lib/kubeclient/lib/kubeclient.rb
192
- - lib/kubeclient/lib/kubeclient/common.rb
193
- - lib/kubeclient/lib/kubeclient/config.rb
194
- - lib/kubeclient/lib/kubeclient/entity_list.rb
195
- - lib/kubeclient/lib/kubeclient/kube_exception.rb
196
- - lib/kubeclient/lib/kubeclient/missing_kind_compatibility.rb
197
- - lib/kubeclient/lib/kubeclient/version.rb
198
- - lib/kubeclient/lib/kubeclient/watch_notice.rb
199
- - lib/kubeclient/lib/kubeclient/watch_stream.rb
200
- - lib/kubeclient/test/cassettes/kubernetes_guestbook.yml
201
- - lib/kubeclient/test/config/allinone.kubeconfig
202
- - lib/kubeclient/test/config/external-ca.pem
203
- - lib/kubeclient/test/config/external-cert.pem
204
- - lib/kubeclient/test/config/external-key.rsa
205
- - lib/kubeclient/test/config/external.kubeconfig
206
- - lib/kubeclient/test/config/nouser.kubeconfig
207
- - lib/kubeclient/test/config/userauth.kubeconfig
208
- - lib/kubeclient/test/json/bindings_list.json
209
- - lib/kubeclient/test/json/component_status.json
210
- - lib/kubeclient/test/json/component_status_list.json
211
- - lib/kubeclient/test/json/config_map_list.json
212
- - lib/kubeclient/test/json/core_api_resource_list.json
213
- - lib/kubeclient/test/json/core_api_resource_list_without_kind.json
214
- - lib/kubeclient/test/json/core_oapi_resource_list_without_kind.json
215
- - lib/kubeclient/test/json/created_endpoint.json
216
- - lib/kubeclient/test/json/created_namespace.json
217
- - lib/kubeclient/test/json/created_secret.json
218
- - lib/kubeclient/test/json/created_service.json
219
- - lib/kubeclient/test/json/empty_pod_list.json
220
- - lib/kubeclient/test/json/endpoint_list.json
221
- - lib/kubeclient/test/json/entity_list.json
222
- - lib/kubeclient/test/json/event_list.json
223
- - lib/kubeclient/test/json/limit_range.json
224
- - lib/kubeclient/test/json/limit_range_list.json
225
- - lib/kubeclient/test/json/namespace.json
226
- - lib/kubeclient/test/json/namespace_exception.json
227
- - lib/kubeclient/test/json/namespace_list.json
228
- - lib/kubeclient/test/json/node.json
229
- - lib/kubeclient/test/json/node_list.json
230
- - lib/kubeclient/test/json/persistent_volume.json
231
- - lib/kubeclient/test/json/persistent_volume_claim.json
232
- - lib/kubeclient/test/json/persistent_volume_claim_list.json
233
- - lib/kubeclient/test/json/persistent_volume_claims_nil_items.json
234
- - lib/kubeclient/test/json/persistent_volume_list.json
235
- - lib/kubeclient/test/json/pod.json
236
- - lib/kubeclient/test/json/pod_list.json
237
- - lib/kubeclient/test/json/pod_template_list.json
238
- - lib/kubeclient/test/json/processed_template.json
239
- - lib/kubeclient/test/json/replication_controller.json
240
- - lib/kubeclient/test/json/replication_controller_list.json
241
- - lib/kubeclient/test/json/resource_quota.json
242
- - lib/kubeclient/test/json/resource_quota_list.json
243
- - lib/kubeclient/test/json/secret_list.json
244
- - lib/kubeclient/test/json/service.json
245
- - lib/kubeclient/test/json/service_account.json
246
- - lib/kubeclient/test/json/service_account_list.json
247
- - lib/kubeclient/test/json/service_illegal_json_404.json
248
- - lib/kubeclient/test/json/service_list.json
249
- - lib/kubeclient/test/json/service_patch.json
250
- - lib/kubeclient/test/json/service_update.json
251
- - lib/kubeclient/test/json/versions_list.json
252
- - lib/kubeclient/test/json/watch_stream.json
253
- - lib/kubeclient/test/test_common.rb
254
- - lib/kubeclient/test/test_component_status.rb
255
- - lib/kubeclient/test/test_config.rb
256
- - lib/kubeclient/test/test_endpoint.rb
257
- - lib/kubeclient/test/test_guestbook_go.rb
258
- - lib/kubeclient/test/test_helper.rb
259
- - lib/kubeclient/test/test_kubeclient.rb
260
- - lib/kubeclient/test/test_limit_range.rb
261
- - lib/kubeclient/test/test_missing_methods.rb
262
- - lib/kubeclient/test/test_namespace.rb
263
- - lib/kubeclient/test/test_node.rb
264
- - lib/kubeclient/test/test_persistent_volume.rb
265
- - lib/kubeclient/test/test_persistent_volume_claim.rb
266
- - lib/kubeclient/test/test_pod.rb
267
- - lib/kubeclient/test/test_pod_log.rb
268
- - lib/kubeclient/test/test_process_template.rb
269
- - lib/kubeclient/test/test_replication_controller.rb
270
- - lib/kubeclient/test/test_resource_list_without_kind.rb
271
- - lib/kubeclient/test/test_resource_quota.rb
272
- - lib/kubeclient/test/test_secret.rb
273
- - lib/kubeclient/test/test_service.rb
274
- - lib/kubeclient/test/test_service_account.rb
275
- - lib/kubeclient/test/test_watch.rb
276
- - lib/kubeclient/test/txt/pod_log.txt
277
- - lib/kubeclient/test/valid_token_file
278
99
  - lib/ruboty/handlers/k8s.rb
279
100
  - lib/ruboty/k8s.rb
280
101
  - lib/ruboty/k8s/client.rb
@@ -1,15 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- *.idea*
@@ -1,16 +0,0 @@
1
- AllCops:
2
- DisplayCopNames: true
3
- MethodLength:
4
- Enabled: false
5
- ClassLength:
6
- Enabled: false
7
- Metrics/AbcSize:
8
- Enabled: false
9
- Metrics/LineLength:
10
- Max: 100
11
- Metrics/ParameterLists:
12
- Max: 8
13
- Metrics/CyclomaticComplexity:
14
- Max: 8
15
- Metrics/ModuleLength:
16
- Enabled: false
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.0"
4
- - "2.1"
5
- - "2.2"
6
- - "2.3.0"
7
- sudo: false
8
- cache: bundler
9
- script: bundle exec rake $TASK
10
- env:
11
- - TASK=test
12
- - TASK=rubocop
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in kubeclient.gemspec
4
- gemspec
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Alissa Bonas
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,428 +0,0 @@
1
- # Kubeclient
2
-
3
- [![Gem Version](https://badge.fury.io/rb/kubeclient.svg)](http://badge.fury.io/rb/kubeclient)
4
- [![Build Status](https://travis-ci.org/abonas/kubeclient.svg?branch=master)](https://travis-ci.org/abonas/kubeclient)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/abonas/kubeclient.svg)](https://codeclimate.com/github/abonas/kubeclient)
6
- [![Dependency Status](https://gemnasium.com/abonas/kubeclient.svg)](https://gemnasium.com/abonas/kubeclient)
7
-
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, persistent volume claims, component statuses and service accounts.
10
- The client currently supports Kubernetes REST api version v1.
11
-
12
- ## Installation
13
-
14
- Add this line to your application's Gemfile:
15
-
16
- ```ruby
17
- gem 'kubeclient'
18
- ```
19
-
20
- And then execute:
21
-
22
- $ bundle
23
-
24
- Or install it yourself as:
25
-
26
- $ gem install kubeclient
27
-
28
- ## Usage
29
-
30
- Initialize the client:
31
- ```ruby
32
- client = Kubeclient::Client.new 'http://localhost:8080/api/' , "v1"
33
- ```
34
-
35
- Or without specifying version (it will be set by default to "v1")
36
-
37
- ```ruby
38
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
39
- ```
40
-
41
- For A Group Api:
42
-
43
- ```ruby
44
- client = Kubeclient::Client.new('http://localhost:8080/apis/batch', 'v1')
45
- ```
46
-
47
- Another option is to initialize the client with URI object:
48
-
49
- ```ruby
50
- uri = URI::HTTP.build(host: "somehostname", port: 8080)
51
- client = Kubeclient::Client.new uri
52
- ```
53
-
54
- It is also possible to use https and configure ssl with:
55
-
56
- ```ruby
57
- ssl_options = {
58
- client_cert: OpenSSL::X509::Certificate.new(File.read('/path/to/client.crt')),
59
- client_key: OpenSSL::PKey::RSA.new(File.read('/path/to/client.key')),
60
- ca_file: '/path/to/ca.crt',
61
- verify_ssl: OpenSSL::SSL::VERIFY_PEER
62
- }
63
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , "v1",
64
- ssl_options: ssl_options
65
- ```
66
-
67
- As an alternative to the `ca_file` it's possible to use the `cert_store`:
68
-
69
- ```ruby
70
- cert_store = OpenSSL::X509::Store.new
71
- cert_store.add_cert(OpenSSL::X509::Certificate.new(ca_cert_data))
72
- ssl_options = {
73
- cert_store: cert_store,
74
- verify_ssl: OpenSSL::SSL::VERIFY_PEER
75
- }
76
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , "v1",
77
- ssl_options: ssl_options
78
- ```
79
-
80
- For testing and development purpose you can disable the ssl check with:
81
-
82
- ```ruby
83
- ssl_options = { verify_ssl: OpenSSL::SSL::VERIFY_NONE }
84
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
85
- ssl_options: ssl_options
86
- ```
87
-
88
- If you are using basic authentication or bearer tokens as described
89
- [here](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md) then you can specify one
90
- of the following:
91
-
92
- ```ruby
93
- auth_options = {
94
- username: 'username',
95
- password: 'password'
96
- }
97
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
98
- auth_options: auth_options
99
- ```
100
-
101
- or
102
-
103
- ```ruby
104
- auth_options = {
105
- bearer_token: 'MDExMWJkMjItOWY1Ny00OGM5LWJlNDEtMjBiMzgxODkxYzYz'
106
- }
107
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
108
- auth_options: auth_options
109
- ```
110
-
111
- or
112
-
113
- ```ruby
114
- auth_options = {
115
- bearer_token_file: '/path/to/token_file'
116
- }
117
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
118
- auth_options: auth_options
119
- ```
120
-
121
- If you are running your app using kubeclient inside a Kubernetes cluster, then you can have a bearer token file
122
- mounted inside your pod by using a
123
- [Service Account](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/service_accounts.md). This
124
- will mount a bearer token [secret](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/secrets.md)
125
- a/ `/var/run/secrets/kubernetes.io/serviceaccount/token` (see [here](https://github.com/GoogleCloudPlatform/kubernetes/pull/7101)
126
- for more details). For example:
127
-
128
- ```ruby
129
- auth_options = {
130
- bearer_token_file: '/var/run/secrets/kubernetes.io/serviceaccount/token'
131
- }
132
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
133
- auth_options: auth_options
134
- ```
135
-
136
- You can find information about token in [this guide](http://kubernetes.io/docs/user-guide/accessing-the-cluster/) and in [this reference](http://kubernetes.io/docs/admin/authentication/).
137
-
138
- You can also use kubeclient with non-blocking sockets such as Celluloid::IO, see [here](https://github.com/httprb/http/wiki/Parallel-requests-with-Celluloid%3A%3AIO)
139
- for details. For example:
140
-
141
- ```ruby
142
- require 'celluloid/io'
143
- socket_options = {
144
- socket_class: Celluloid::IO::TCPSocket,
145
- ssl_socket_class: Celluloid::IO::SSLSocket
146
- }
147
- client = Kubeclient::Client.new 'https://localhost:8443/api/' , 'v1',
148
- socket_options: socket_options
149
- ```
150
-
151
- You can also use kubeclient with an http proxy server such as tinyproxy. It can be entered as a string or a URI object
152
- For example:
153
- ```ruby
154
- proxy_uri = URI::HTTP.build(host: "myproxyhost", port: 8443)
155
- client = Kubeclient::Client.new('https://localhost:8443/api/',
156
- :http_proxy_uri => proxy_uri)
157
- ```
158
-
159
- ### Discovery
160
-
161
- Discovery from the kube-apiserver is done lazily on method calls so it would not change behavior.
162
-
163
- It can also be done explicitly:
164
- ```
165
- client = Kubeclient::Client.new('http://localhost:8080/api', 'v1')
166
- client.discover
167
- ```
168
-
169
- It is possible to check the status of discovery
170
- ```
171
- unless client.discovered
172
- client.discover
173
- end
174
- ```
175
-
176
- ### Kubeclient::Config
177
-
178
- If you've been using `kubectl` and have a `.kube/config` file, you can auto-populate a config object using `Kubeclient::Config`:
179
- ```ruby
180
- config = Kubeclient::Config.read('/path/to/.kube/config')
181
- ```
182
-
183
- ...and then pass that object to `Kubeclient::Client`:
184
-
185
- ```
186
- Kubeclient::Client.new(
187
- config.context.api_endpoint,
188
- config.context.api_version,
189
- {
190
- ssl_options: config.context.ssl_options,
191
- auth_options: config.context.auth_options
192
- }
193
- )
194
- ```
195
-
196
- You can also load your JSONified config in from an ENV variable (e.g. `KUBE_CONFIG`) like so:
197
-
198
- ```
199
- Kubeclient::Config.new(JSON.parse(ENV['KUBE_CONFIG']), nil)
200
- ```
201
- ###Supported kubernetes versions
202
-
203
- For 1.1 only the core api v1 is supported, all api groups are supported in later versions.
204
-
205
- ## Examples:
206
-
207
- #### Get all instances of a specific entity type
208
- 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`, `get_service_accounts`
209
-
210
- ```ruby
211
- pods = client.get_pods
212
- ```
213
-
214
- Get all entities of a specific type in a namespace:<br>
215
-
216
- ```ruby
217
- services = client.get_services(namespace: 'development')
218
- ```
219
-
220
- You can get entities which have specific labels by specifying a parameter named `label_selector` (named `labelSelector` in Kubernetes server):
221
-
222
- ```ruby
223
- pods = client.get_pods(label_selector: 'name=redis-master')
224
- ```
225
-
226
- You can specify multiple labels (that option will return entities which have both labels:
227
- ```ruby
228
- pods = client.get_pods(label_selector: 'name=redis-master,app=redis')
229
- ```
230
-
231
- #### Get a specific instance of an entity (by name)
232
- 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"`, `get_service_account "service account name"`
233
-
234
- The GET request should include the namespace name, except for nodes and namespaces entities.
235
-
236
- ```ruby
237
- node = client.get_node "127.0.0.1"
238
- ```
239
-
240
- ```ruby
241
- service = client.get_service "guestbook", 'development'
242
- ```
243
-
244
- Note - Kubernetes doesn't work with the uid, but rather with the 'name' property.
245
- Querying with uid causes 404.
246
-
247
- #### Delete an entity (by name)
248
-
249
- For example: `delete_pod "pod name"` , `delete_replication_controller "rc name"`, `delete_node "node name"`, `delete_secret "secret name"`
250
-
251
- Input parameter - name (string) specifying service name, pod name, replication controller name.
252
- ```ruby
253
- client.delete_service "redis-service"
254
- ```
255
-
256
- #### Create an entity
257
- For example: `create_pod pod_object`, `create_replication_controller rc_obj`, `create_secret secret_object`, `create_resource_quota resource_quota_object`, `create_limit_range limit_range_object`, `create_persistent_volume persistent_volume_object`, `create_persistent_volume_claim persistent_volume_claim_object`, `create_service_account service_account_object`
258
-
259
- Input parameter - object of type `Service`, `Pod`, `ReplicationController`.
260
-
261
- The below example is for v1
262
-
263
- ```ruby
264
- service = Service.new
265
- service.metadata = {}
266
- service.metadata.name = "redis-master"
267
- service.metadata.namespace = 'staging'
268
- service.spec = {}
269
- service.spec.ports = [{ 'port' => 6379,
270
- 'targetPort' => 'redis-server'
271
- }]
272
- service.spec.selector = {}
273
- service.spec.selector.name = "redis"
274
- service.spec.selector.role = "master"
275
- service.metadata.labels = {}
276
- service.metadata.labels.app = 'redis'
277
- service.metadata.labels.role = 'slave'
278
- client.create_service service`
279
- ```
280
-
281
- #### Update an entity
282
- For example: `update_pod`, `update_service`, `update_replication_controller`, `update_secret`, `update_resource_quota`, `update_limit_range`, `update_persistent_volume`, `update_persistent_volume_claim`, `update_service_account`
283
-
284
- Input parameter - object of type `Pod`, `Service`, `ReplicationController` etc.
285
-
286
- The below example is for v1
287
-
288
- ```ruby
289
- client.update_service service1
290
- ```
291
-
292
- #### Patch an entity (by name)
293
- For example: `patch_pod`, `patch_service`, `patch_secret`, `patch_resource_quota`, `patch_persistent_volume`
294
-
295
- Input parameters - name (string) specifying the entity name, patch (hash) to be applied to the resource, optional: namespace name (string)
296
-
297
- The PATCH request should include the namespace name, except for nodes and namespaces entities.
298
-
299
- The below example is for v1
300
-
301
- ```ruby
302
- client.patch_pod "docker-registry", {:metadata => {:annotations => {:key => 'value'}}}, "default"
303
- ```
304
-
305
- #### Get all entities of all types : all_entities
306
- Returns a hash with the following keys (node, secret, service, pod, replication_controller, namespace, resource_quota, limit_range, endpoint, event, persistent_volume, persistent_volume_claim, component_status and service_account). Each key points to an EntityList of same type.
307
- This method is a convenience method instead of calling each entity's get method separately.
308
-
309
- ```ruby
310
- client.all_entities
311
- ```
312
-
313
- #### Receive entity updates
314
- It is possible to receive live update notices watching the relevant entities:
315
-
316
- ```ruby
317
- watcher = client.watch_pods
318
- watcher.each do |notice|
319
- # process notice data
320
- end
321
- ```
322
-
323
- It is possible to interrupt the watcher from another thread with:
324
-
325
- ```ruby
326
- watcher.finish
327
- ```
328
-
329
- #### Watch events for a particular object
330
- You can use the `field_selector` option as part of the watch methods.
331
-
332
- ```ruby
333
- watcher = client.watch_events(namespace: 'development', field_selector: 'involvedObject.name=redis-master')
334
- watcher.each do |notice|
335
- # process notice date
336
- end
337
- ```
338
-
339
- #### Get a proxy URL
340
- You can get a complete URL for connecting a kubernetes entity via the proxy.
341
-
342
- ```ruby
343
- client.proxy_url('service', 'srvname', 'srvportname', 'ns')
344
- => "https://localhost.localdomain:8443/api/v1/proxy/namespaces/ns/services/srvname:srvportname"
345
- ```
346
-
347
- Note the third parameter, port, is a port name for services and an integer for pods:
348
-
349
- ```ruby
350
- client.proxy_url('pod', 'podname', 5001, 'ns')
351
- => "https://localhost.localdomain:8443/api/v1/namespaces/ns/pods/podname:5001/proxy"
352
- ```
353
-
354
- #### Get the logs of a pod
355
- You can get the logs of a running pod, specifying the name of the pod and the
356
- namespace where the pod is running:
357
-
358
- ```ruby
359
- client.get_pod_log('pod-name', 'default')
360
- => "Running...\nRunning...\nRunning...\n"
361
- ```
362
-
363
- If that pod has more than one container, you must specify the container:
364
-
365
- ```ruby
366
- client.get_pod_log('pod-name', 'default', container: 'ruby')
367
- => "..."
368
- ```
369
-
370
- If a container in a pod terminates, a new container is started, and you want to
371
- retrieve the logs of the dead container, you can pass in the `:previous` option:
372
-
373
- ```ruby
374
- client.get_pod_log('pod-name', 'default', previous: true)
375
- => "..."
376
- ```
377
-
378
- You can also watch the logs of a pod to get a stream of data:
379
-
380
- ```ruby
381
- watcher = client.watch_pod_log('pod-name', 'default', container: 'ruby')
382
- watcher.each do |line|
383
- puts line
384
- end
385
- ```
386
-
387
- #### Process a template
388
- Returns a processed template containing a list of objects to create.
389
- Input parameter - template (hash)
390
- Besides its metadata, the template should include a list of objects to be processed and a list of parameters
391
- to be substituted. Note that for a required parameter that does not provide a generated value, you must supply a value.
392
-
393
- ```ruby
394
- client.process_template template
395
- ```
396
-
397
- ## Upgrading
398
-
399
- #### past version 1.2.0
400
- Replace Specific Entity class references:
401
- ```ruby
402
- Kubeclient::Service
403
- ```
404
- with the generic
405
- ```ruby
406
- Kubeclient::Resource.new
407
- ```
408
- Where ever possible.
409
-
410
- ## Contributing
411
-
412
- 1. Fork it ( https://github.com/[my-github-username]/kubeclient/fork )
413
- 2. Create your feature branch (`git checkout -b my-new-feature`)
414
- 3. Test your changes with `rake test rubocop`, add new tests if needed.
415
- 4. If you added a new functionality, add it to README
416
- 5. Commit your changes (`git commit -am 'Add some feature'`)
417
- 6. Push to the branch (`git push origin my-new-feature`)
418
- 7. Create a new Pull Request
419
-
420
- ## Tests
421
-
422
- This client is tested with Minitest and also uses VCR recordings in some tests.
423
- Please run all tests before submitting a Pull Request, and add new tests for new functionality.
424
-
425
- Running tests:
426
- ```ruby
427
- rake test
428
- ```