kubeclient-rollback-dev 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rubocop.yml +16 -0
  4. data/.travis.yml +12 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +428 -0
  8. data/Rakefile +12 -0
  9. data/kubeclient.gemspec +29 -0
  10. data/lib/kubeclient/common.rb +512 -0
  11. data/lib/kubeclient/config.rb +126 -0
  12. data/lib/kubeclient/entity_list.rb +16 -0
  13. data/lib/kubeclient/kube_exception.rb +14 -0
  14. data/lib/kubeclient/missing_kind_compatibility.rb +68 -0
  15. data/lib/kubeclient/version.rb +4 -0
  16. data/lib/kubeclient/watch_notice.rb +7 -0
  17. data/lib/kubeclient/watch_stream.rb +80 -0
  18. data/lib/kubeclient.rb +32 -0
  19. data/test/cassettes/kubernetes_guestbook.yml +879 -0
  20. data/test/config/allinone.kubeconfig +20 -0
  21. data/test/config/external-ca.pem +18 -0
  22. data/test/config/external-cert.pem +19 -0
  23. data/test/config/external-key.rsa +27 -0
  24. data/test/config/external.kubeconfig +20 -0
  25. data/test/config/nouser.kubeconfig +16 -0
  26. data/test/config/userauth.kubeconfig +28 -0
  27. data/test/json/bindings_list.json +10 -0
  28. data/test/json/component_status.json +17 -0
  29. data/test/json/component_status_list.json +52 -0
  30. data/test/json/config_map_list.json +9 -0
  31. data/test/json/core_api_resource_list.json +181 -0
  32. data/test/json/core_api_resource_list_without_kind.json +129 -0
  33. data/test/json/core_oapi_resource_list_without_kind.json +197 -0
  34. data/test/json/created_endpoint.json +28 -0
  35. data/test/json/created_namespace.json +20 -0
  36. data/test/json/created_secret.json +16 -0
  37. data/test/json/created_service.json +31 -0
  38. data/test/json/empty_pod_list.json +9 -0
  39. data/test/json/endpoint_list.json +48 -0
  40. data/test/json/entity_list.json +56 -0
  41. data/test/json/event_list.json +35 -0
  42. data/test/json/limit_range.json +23 -0
  43. data/test/json/limit_range_list.json +31 -0
  44. data/test/json/namespace.json +13 -0
  45. data/test/json/namespace_exception.json +8 -0
  46. data/test/json/namespace_list.json +32 -0
  47. data/test/json/node.json +29 -0
  48. data/test/json/node_list.json +37 -0
  49. data/test/json/persistent_volume.json +37 -0
  50. data/test/json/persistent_volume_claim.json +32 -0
  51. data/test/json/persistent_volume_claim_list.json +40 -0
  52. data/test/json/persistent_volume_claims_nil_items.json +8 -0
  53. data/test/json/persistent_volume_list.json +45 -0
  54. data/test/json/pod.json +92 -0
  55. data/test/json/pod_list.json +79 -0
  56. data/test/json/pod_template_list.json +9 -0
  57. data/test/json/processed_template.json +27 -0
  58. data/test/json/replication_controller.json +57 -0
  59. data/test/json/replication_controller_list.json +66 -0
  60. data/test/json/resource_quota.json +46 -0
  61. data/test/json/resource_quota_list.json +54 -0
  62. data/test/json/secret_list.json +44 -0
  63. data/test/json/service.json +33 -0
  64. data/test/json/service_account.json +25 -0
  65. data/test/json/service_account_list.json +82 -0
  66. data/test/json/service_illegal_json_404.json +1 -0
  67. data/test/json/service_list.json +97 -0
  68. data/test/json/service_patch.json +25 -0
  69. data/test/json/service_update.json +22 -0
  70. data/test/json/versions_list.json +6 -0
  71. data/test/json/watch_stream.json +3 -0
  72. data/test/test_common.rb +32 -0
  73. data/test/test_component_status.rb +30 -0
  74. data/test/test_config.rb +72 -0
  75. data/test/test_endpoint.rb +35 -0
  76. data/test/test_guestbook_go.rb +238 -0
  77. data/test/test_helper.rb +10 -0
  78. data/test/test_kubeclient.rb +611 -0
  79. data/test/test_limit_range.rb +27 -0
  80. data/test/test_missing_methods.rb +42 -0
  81. data/test/test_namespace.rb +61 -0
  82. data/test/test_node.rb +33 -0
  83. data/test/test_persistent_volume.rb +30 -0
  84. data/test/test_persistent_volume_claim.rb +30 -0
  85. data/test/test_pod.rb +29 -0
  86. data/test/test_pod_log.rb +50 -0
  87. data/test/test_process_template.rb +44 -0
  88. data/test/test_replication_controller.rb +27 -0
  89. data/test/test_resource_list_without_kind.rb +78 -0
  90. data/test/test_resource_quota.rb +25 -0
  91. data/test/test_secret.rb +70 -0
  92. data/test/test_service.rb +293 -0
  93. data/test/test_service_account.rb +28 -0
  94. data/test/test_watch.rb +119 -0
  95. data/test/txt/pod_log.txt +6 -0
  96. data/test/valid_token_file +1 -0
  97. metadata +343 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b319cd283dc3e1bb8da96163a14787f05f6b8da7
4
+ data.tar.gz: 2b9dd690549f32996114d682ff87ad992fd4821f
5
+ SHA512:
6
+ metadata.gz: c29fd1117d6275d8230d72950df48328082817df24c34061a20c56b47b594c903a0066ab6096ea93215bc5dd7e1292dfec9144f65c285791b265eff47984f0b4
7
+ data.tar.gz: 02ae7e3090142bde025ce077a56da6e8e8a8290963a78a752835b59b55b7eeaff8f24bd9b993e176f363845fb27c5358cce8de7ce5c613ae987f6d91cfca3a8f
data/.gitignore ADDED
@@ -0,0 +1,15 @@
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*
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
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
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kubeclient.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
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.
data/README.md ADDED
@@ -0,0 +1,428 @@
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
+ ```
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rubocop/rake_task'
4
+ require 'yaml'
5
+
6
+ task default: [:test, :rubocop] # same as .travis.yml
7
+
8
+ Rake::TestTask.new do |t|
9
+ t.libs << 'test'
10
+ end
11
+
12
+ RuboCop::RakeTask.new
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kubeclient/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kubeclient-rollback-dev'
8
+ spec.version = Kubeclient::VERSION
9
+ spec.authors = ['cnosuke']
10
+ spec.email = ['shinnosuke@gmail.com']
11
+ spec.summary = 'WARNING: THIS GEM IS NOT PRODUCTION READY.'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+ spec.required_ruby_version = '>= 2.0.0'
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.6'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'minitest'
23
+ spec.add_development_dependency 'webmock', '~> 1.24.2'
24
+ spec.add_development_dependency 'vcr'
25
+ spec.add_development_dependency 'rubocop', '= 0.46.0'
26
+ spec.add_dependency 'rest-client'
27
+ spec.add_dependency 'recursive-open-struct', '= 1.0.0'
28
+ spec.add_dependency 'http', '= 0.9.8'
29
+ end