ruby-kubernetes-controller 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e1d7bfdc1de0725fb1f2d4cad6780c71f58bc8dd619836d80514f81f80c706ac
4
+ data.tar.gz: 4650e322ec9b9ef297e782e17f0b245f16e05d8432aecb8ef1c02d6b6896e054
5
+ SHA512:
6
+ metadata.gz: b6637290fee0b38a28187a4f4f9ca100eef89de7476ebe7feacda2b23e97697111532ceb9a66358b3f0b389def34ce5fedbf77b3229366cc5ad6279cc676dc4d
7
+ data.tar.gz: dc1339715316475a8600ab9d5d5eeec4259a2554a42dd95e2fcf9579e250095093cc48324249174e1de407176b5b564cf32de9512bd1ab368932790a3c5f39c5
@@ -0,0 +1,131 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ jobs:
6
+ build:
7
+ docker:
8
+ - image: circleci/ruby:2.6.3
9
+
10
+ working_directory: ~/repo
11
+ steps:
12
+ - checkout
13
+ - run:
14
+ name: Install Bundler
15
+ command: gem install bundler
16
+ - restore_cache:
17
+ keys:
18
+ - ruby-kubernetes-controller-{{ checksum "ruby-kubernetes-controller.gemspec" }}
19
+ # fallback to using the latest cache if no exact match is found
20
+ - ruby-kubernetes-controller-
21
+ - run:
22
+ name: Install Bundles
23
+ command: bundle check || bundle install
24
+ - save_cache:
25
+ paths:
26
+ - ./vendor/bundle
27
+ key: ruby-kubernetes-controller-{{ checksum "ruby-kubernetes-controller.gemspec" }}
28
+ - run:
29
+ name: Build gem
30
+ command: gem build ruby-kubernetes-controller.gemspec
31
+
32
+ test:
33
+ docker:
34
+ - image: circleci/ruby:2.6.3
35
+
36
+ working_directory: ~/repo
37
+ steps:
38
+ - checkout
39
+ - run:
40
+ name: Install Bundler
41
+ command: gem install bundler
42
+ - restore_cache:
43
+ keys:
44
+ - ruby-kubernetes-controller-{{ checksum "ruby-kubernetes-controller.gemspec" }}
45
+ # fallback to using the latest cache if no exact match is found
46
+ - ruby-kubernetes-controller-
47
+ - run:
48
+ name: Install Bundles
49
+ command: bundle check || bundle install
50
+ - save_cache:
51
+ paths:
52
+ - ./vendor/bundle
53
+ key: ruby-kubernetes-controller-{{ checksum "ruby-kubernetes-controller.gemspec" }}
54
+ - run:
55
+ name:
56
+ command: bundle exec rake test
57
+ when: always
58
+ - store_test_results:
59
+ path: test/reports
60
+
61
+ publish:
62
+ docker:
63
+ - image: circleci/ruby:2.6.3
64
+
65
+ working_directory: ~/repo
66
+ steps:
67
+ - checkout
68
+ - run:
69
+ name: Setup Rubygems
70
+ command: bash .circleci/setup-rubygems.sh
71
+
72
+ - run:
73
+ name: Publish to Rubygems
74
+ command: |
75
+ gem build ruby-kubernetes-controller.gemspec
76
+ gem push ruby-kubernetes-controller-$CIRCLE_TAG.gem
77
+
78
+ workflows:
79
+ version: 2
80
+ development-build:
81
+ jobs:
82
+ - build:
83
+ filters:
84
+ tags:
85
+ only: /^dev.*/
86
+ branches:
87
+ ignore: /.*/
88
+ - test:
89
+ requires:
90
+ - build
91
+ filters:
92
+ tags:
93
+ only: /^dev.*/
94
+ branches:
95
+ ignore: /.*/
96
+ production-build:
97
+ jobs:
98
+ - build:
99
+ filters:
100
+ tags:
101
+ only: /^\d+(\.\d+)*$/
102
+ branches:
103
+ ignore: /.*/
104
+ - test:
105
+ requires:
106
+ - build
107
+ filters:
108
+ tags:
109
+ only: /^\d+(\.\d+)*$/
110
+ branches:
111
+ ignore: /.*/
112
+ - hold:
113
+ type: approval
114
+ requires:
115
+ - test
116
+ - build
117
+ filters:
118
+ tags:
119
+ only: /^\d+(\.\d+)*$/
120
+ branches:
121
+ ignore: /.*/
122
+ - publish:
123
+ requires:
124
+ - build
125
+ - test
126
+ - hold
127
+ filters:
128
+ tags:
129
+ only: /^\d+(\.\d+)*$/
130
+ branches:
131
+ ignore: /.*/
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ mkdir ~/.gem
4
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
5
+ chmod 0600 /home/circleci/.gem/credentials
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea/
10
+ ruby-kubernetes-controller-*.gem
11
+ Gemfile.lock
12
+ .DS_Store
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at shivanshvij@ibm.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4/][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,1606 @@
1
+ # Documentation
2
+
3
+ ## Pre-requisites
4
+ Before beginning, you must generate a bearer token for the Ruby Kubernetes Controller to use:
5
+
6
+
7
+ 1. Save the following as `serviceaccount.yaml` (file available [here][SERVICEACCOUNT])
8
+ <p align="center"><img width=100% src="./serviceaccount.png"></p>
9
+ 2. Run the following in a terminal, with `kubectl` pre-configured for your existing cluster
10
+ ```bash
11
+ $ kubectl apply -f serviceaccount.yaml
12
+ $ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
13
+ ```
14
+ 3. Copy down your bearer token
15
+ 4. You can get your endpoint by running `kubectl cluster-info`
16
+
17
+ ###### Source: https://github.com/kubernetes/dashboard/wiki/Creating-sample-user
18
+ #### Get Nodes
19
+ * List all nodes
20
+ ```ruby
21
+ require 'ruby-kubernetes-controller'
22
+
23
+ endpoint = "localhost"
24
+ bearer_token = "token"
25
+ ssl = false
26
+
27
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
28
+
29
+ puts client.get_nodes # Returns JSON
30
+ ```
31
+ #### Create Namespace
32
+ * Create new Namespace
33
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_namespace
34
+ ```ruby
35
+ require 'ruby-kubernetes-controller'
36
+
37
+ endpoint = "localhost"
38
+ bearer_token = "token"
39
+ ssl = false
40
+
41
+ # With JSON
42
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
43
+ json_config =
44
+ '{
45
+ "kind": "Namespace",
46
+ "apiVersion": "v1",
47
+ ...
48
+ }'
49
+
50
+ puts json_client.create_new_namespace(json_config) # Returns JSON
51
+
52
+ # With YAML
53
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
54
+ yaml_file_path = '/path/to/file.yaml'
55
+
56
+ puts yaml_client.create_new_namespace(yaml_file_path) # Returns JSON
57
+ ```
58
+
59
+ #### Get Namespaces
60
+ * List all Namespaces
61
+ ```ruby
62
+ require 'ruby-kubernetes-controller'
63
+
64
+ endpoint = "localhost"
65
+ bearer_token = "token"
66
+ ssl = false
67
+
68
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
69
+
70
+ puts client.get_all_namespaces # Returns JSON
71
+ ```
72
+
73
+ #### Update Namespace
74
+ * Update existing Namespace
75
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_namespace
76
+ ```ruby
77
+ require 'ruby-kubernetes-controller'
78
+
79
+ endpoint = "localhost"
80
+ bearer_token = "token"
81
+ ssl = false
82
+
83
+ # With JSON
84
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
85
+ namespace = "default"
86
+ json_update =
87
+ '{
88
+ "kind": "Namespace",
89
+ "apiVersion": "v1",
90
+ ...
91
+ }'
92
+
93
+ puts json_client.update_namespace(namespace, json_update) # Returns JSON
94
+
95
+ # With YAML
96
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
97
+ namespace = "default"
98
+ yaml_file_path = '/path/to/file.yaml'
99
+
100
+ puts yaml_client.update_namespace(namespace, yaml_file_path) # Returns JSON
101
+ ```
102
+
103
+ #### Patch Namespace
104
+ * Patch existing Namespace
105
+ * Patch Format documentation available at: http://jsonpatch.com/
106
+ ```ruby
107
+ require 'ruby-kubernetes-controller'
108
+
109
+ endpoint = "localhost"
110
+ bearer_token = "token"
111
+ ssl = false
112
+
113
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
114
+
115
+ namespace = "default"
116
+ patch =
117
+ '[
118
+ { "op": "replace", "path": "/baz", "value": "boo" },
119
+ { "op": "add", "path": "/hello", "value": ["world"] },
120
+ { "op": "remove", "path": "/foo" }
121
+ ]'
122
+
123
+ puts client.patch_namespace(namespace, patch) # Returns JSON
124
+ ```
125
+
126
+ #### Delete Namespace
127
+ * Delete existing Namespace
128
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
129
+ ```ruby
130
+ require 'ruby-kubernetes-controller'
131
+
132
+ endpoint = "localhost"
133
+ bearer_token = "token"
134
+ ssl = false
135
+
136
+ # With JSON
137
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
138
+ namespace = "default"
139
+ json_options =
140
+ '{
141
+ "kind": "Namespace",
142
+ "apiVersion": "v1",
143
+ ...
144
+ }'
145
+
146
+ puts json_client.delete_namespace(namespace, json_options) # Returns JSON
147
+
148
+ # With YAML
149
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
150
+ namespace = "default"
151
+ yaml_file_path = 'path/to/file.yaml'
152
+
153
+ puts yaml_client.delete_namespace(namespace, yaml_file_path) # Returns JSON
154
+ ```
155
+
156
+ #### Create Ingress
157
+ * Create new Ingress
158
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_ingress
159
+ ```ruby
160
+ require 'ruby-kubernetes-controller'
161
+
162
+ endpoint = "localhost"
163
+ bearer_token = "token"
164
+ ssl = false
165
+
166
+ # With JSON
167
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
168
+ namespace = "default"
169
+ json_config =
170
+ '{
171
+ "kind": "Ingress",
172
+ "apiVersion": "extensions/v1beta1",
173
+ ...
174
+ }'
175
+
176
+ puts json_client.create_new_ingress(namespace, json_config) # Returns JSON
177
+
178
+ # With YAML
179
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
180
+ namespace = "default"
181
+ yaml_file_path = 'path/to/file.yaml'
182
+
183
+ puts yaml_client.create_new_ingress(namespace, yaml_file_path) # Returns JSON
184
+ ```
185
+
186
+ #### Get Ingresses
187
+ * List all Ingresses
188
+ ```ruby
189
+ require 'ruby-kubernetes-controller'
190
+
191
+ endpoint = "localhost"
192
+ bearer_token = "token"
193
+ ssl = false
194
+
195
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
196
+
197
+ puts client.get_all_ingresses # Returns JSON
198
+ ```
199
+
200
+ #### Get Namespaced Ingresses
201
+ * List all existing Ingresses in Namespace
202
+ ```ruby
203
+ require 'ruby-kubernetes-controller'
204
+
205
+ endpoint = "localhost"
206
+ bearer_token = "token"
207
+ ssl = false
208
+
209
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
210
+
211
+ namespace = "default"
212
+
213
+ puts client.get_all_namespaced_ingresses(namespace) # Returns JSON
214
+ ```
215
+
216
+ #### Get Single Namespaced Ingress
217
+ * Get details for single Ingress in Namespace
218
+ ```ruby
219
+ require 'ruby-kubernetes-controller'
220
+
221
+ endpoint = "localhost"
222
+ bearer_token = "token"
223
+ ssl = false
224
+
225
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
226
+
227
+ namespace = "default"
228
+ ingress_name = "ingress"
229
+
230
+ puts client.get_single_namespaced_ingress(namespace, ingress_name) # Returns JSON
231
+ ```
232
+
233
+ #### Update Ingress
234
+ * Update existing Ingress in Namespace
235
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_ingress
236
+ ```ruby
237
+ require 'ruby-kubernetes-controller'
238
+
239
+ endpoint = "localhost"
240
+ bearer_token = "token"
241
+ ssl = false
242
+
243
+ # With JSON
244
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
245
+ namespace = "default"
246
+ ingress_name = "ingress"
247
+ json_update =
248
+ '{
249
+ "kind": "Ingress",
250
+ "apiVersion": "extensions/v1beta1",
251
+ ...
252
+ }'
253
+
254
+ puts json_client.update_namespaced_ingress(namespace, ingress_name, json_update) # Returns JSON
255
+
256
+ # With YAML
257
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
258
+ namespace = "default"
259
+ ingress_name = "ingress"
260
+ yaml_file_path = 'path/to/file.yaml'
261
+
262
+ puts yaml_client.update_namespaced_ingress(namespace, ingress_name, yaml_file_path) # Returns JSON
263
+ ```
264
+
265
+ #### Patch Ingress
266
+ * Patch existing Ingress
267
+ * Patch Format documentation available at: http://jsonpatch.com/
268
+ ```ruby
269
+ require 'ruby-kubernetes-controller'
270
+
271
+ endpoint = "localhost"
272
+ bearer_token = "token"
273
+ ssl = false
274
+
275
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
276
+
277
+ namespace = "default"
278
+ ingress_name = "ingress"
279
+ patch =
280
+ '[
281
+ { "op": "replace", "path": "/baz", "value": "boo" },
282
+ { "op": "add", "path": "/hello", "value": ["world"] },
283
+ { "op": "remove", "path": "/foo" }
284
+ ]'
285
+
286
+ puts client.patch_ingress(namespace, ingress_name, patch) # Returns JSON
287
+ ```
288
+
289
+ #### Delete Ingress
290
+ * Delete existing Ingress
291
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
292
+ ```ruby
293
+ require 'ruby-kubernetes-controller'
294
+
295
+ endpoint = "localhost"
296
+ bearer_token = "token"
297
+ ssl = false
298
+
299
+ # With JSON
300
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
301
+ namespace = "default"
302
+ ingress_name = "ingress"
303
+ json_options =
304
+ '{
305
+ "kind": "Ingress",
306
+ "apiVersion": "extensions/v1beta1",
307
+ ...
308
+ }'
309
+
310
+ puts json_client.delete_ingress(namespace, ingress_name, json_options) # Returns JSON
311
+
312
+ # With YAML
313
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
314
+ namespace = "default"
315
+ ingress_name = "ingress"
316
+ yaml_file_path = 'path/to/file.yaml'
317
+
318
+ puts yaml_client.delete_ingress(namespace, ingress_name, yaml_file_path) # Returns JSON
319
+ ```
320
+
321
+ #### Create Endpoint
322
+ * Create new Endpoint
323
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
324
+ ```ruby
325
+ require 'ruby-kubernetes-controller'
326
+
327
+ endpoint = "localhost"
328
+ bearer_token = "token"
329
+ ssl = false
330
+
331
+ # With JSON
332
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
333
+ namespace = "default"
334
+ json_config =
335
+ '{
336
+ "kind": "Endpoints",
337
+ "apiVersion": "v1",
338
+ ...
339
+ }'
340
+
341
+ puts json_client.create_new_endpoint(namespace, json_config) # Returns JSON
342
+
343
+ # With YAML
344
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
345
+ namespace = "default"
346
+ yaml_file_path = 'path/to/file.yaml'
347
+
348
+ puts yaml_client.create_new_endpoint(namespace, yaml_file_path) # Returns JSON
349
+ ```
350
+
351
+ #### Get Endpoints
352
+ * List all Endpoints
353
+ ```ruby
354
+ require 'ruby-kubernetes-controller'
355
+
356
+ endpoint = "localhost"
357
+ bearer_token = "token"
358
+ ssl = false
359
+
360
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
361
+
362
+ puts client.get_all_endpoints # Returns JSON
363
+ ```
364
+
365
+ #### Get Namespaced Endpoints
366
+ * List all existing Endpoints in Namespace
367
+ ```ruby
368
+ require 'ruby-kubernetes-controller'
369
+
370
+ endpoint = "localhost"
371
+ bearer_token = "token"
372
+ ssl = false
373
+
374
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
375
+
376
+ namespace = "default"
377
+
378
+ puts client.get_all_namespaced_endpoints(namespace) # Returns JSON
379
+ ```
380
+
381
+ #### Get Single Namespaced Endpoint
382
+ * Get details for single Endpoint in Namespace
383
+ ```ruby
384
+ require 'ruby-kubernetes-controller'
385
+
386
+ endpoint = "localhost"
387
+ bearer_token = "token"
388
+ ssl = false
389
+
390
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
391
+
392
+ namespace = "default"
393
+ endpoint_name = "endpoint"
394
+
395
+ puts client.get_single_namespaced_endpoint(namespace, endpoint_name) # Returns JSON
396
+ ```
397
+
398
+ #### Update Endpoint
399
+ * Update existing Endpoint in Namespace
400
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
401
+ ```ruby
402
+ require 'ruby-kubernetes-controller'
403
+
404
+ endpoint = "localhost"
405
+ bearer_token = "token"
406
+ ssl = false
407
+
408
+ # With JSON
409
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
410
+ namespace = "default"
411
+ endpoint_name = "endpoint"
412
+ json_update =
413
+ '{
414
+ "kind": "Endpoints",
415
+ "apiVersion": "v1",
416
+ ...
417
+ }'
418
+
419
+ puts json_client.update_namespaced_endpoint(namespace, endpoint_name, json_update) # Returns JSON
420
+
421
+ # With YAML
422
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
423
+ namespace = "default"
424
+ endpoint_name = "endpoint"
425
+ yaml_file_path = 'path/to/file.yaml'
426
+
427
+ puts yaml_client.update_namespaced_endpoint(namespace, endpoint_name, yaml_file_path) # Returns JSON
428
+ ```
429
+
430
+ #### Patch Endpoint
431
+ * Patch existing Endpoint
432
+ * Patch Format documentation available at: http://jsonpatch.com/
433
+ ```ruby
434
+ require 'ruby-kubernetes-controller'
435
+
436
+ endpoint = "localhost"
437
+ bearer_token = "token"
438
+ ssl = false
439
+
440
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
441
+
442
+ namespace = "default"
443
+ endpoint_name = "endpoint"
444
+ patch =
445
+ '[
446
+ { "op": "replace", "path": "/baz", "value": "boo" },
447
+ { "op": "add", "path": "/hello", "value": ["world"] },
448
+ { "op": "remove", "path": "/foo" }
449
+ ]'
450
+
451
+ puts client.patch_endpoint(namespace, endpoint_name, patch) # Returns JSON
452
+ ```
453
+
454
+ #### Delete Endpoint
455
+ * Delete existing Endpoint
456
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
457
+ ```ruby
458
+ require 'ruby-kubernetes-controller'
459
+
460
+ endpoint = "localhost"
461
+ bearer_token = "token"
462
+ ssl = false
463
+
464
+ # With JSON
465
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
466
+ namespace = "default"
467
+ endpoint_name = "endpoint"
468
+ json_options =
469
+ '{
470
+ "kind": "Endpoints",
471
+ "apiVersion": "v1",
472
+ ...
473
+ }'
474
+
475
+ puts json_client.delete_endpoint(namespace, endpoint_name, json_options) # Returns JSON
476
+
477
+ # With YAML
478
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
479
+ namespace = "default"
480
+ endpoint_name = "endpoint"
481
+ yaml_file_path = 'path/to/file.yaml'
482
+
483
+ puts yaml_client.delete_endpoint(namespace, endpoint_name, yaml_file_path) # Returns JSON
484
+ ```
485
+
486
+ #### Create Pod
487
+ * Create new Pod
488
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
489
+ ```ruby
490
+ require 'ruby-kubernetes-controller'
491
+
492
+ pod = "localhost"
493
+ bearer_token = "token"
494
+ ssl = false
495
+
496
+ # With JSON
497
+ json_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = false)
498
+ namespace = "default"
499
+ json_config =
500
+ '{
501
+ "kind": "Pod",
502
+ "apiVersion": "v1",
503
+ ...
504
+ }'
505
+
506
+ puts json_client.create_new_pod(namespace, json_config) # Returns JSON
507
+
508
+ # With YAML
509
+ yaml_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = true)
510
+ namespace = "default"
511
+ yaml_file_path = 'path/to/file.yaml'
512
+
513
+ puts yaml_client.create_new_pod(namespace, yaml_file_path) # Returns JSON
514
+ ```
515
+
516
+ #### Get Pods
517
+ * List all Pods
518
+ ```ruby
519
+ require 'ruby-kubernetes-controller'
520
+
521
+ pod = "localhost"
522
+ bearer_token = "token"
523
+ ssl = false
524
+
525
+ client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl)
526
+
527
+ puts client.get_all_pods # Returns JSON
528
+ ```
529
+
530
+ #### Get Namespaced Pods
531
+ * List all existing Pods in Namespace
532
+ ```ruby
533
+ require 'ruby-kubernetes-controller'
534
+
535
+ pod = "localhost"
536
+ bearer_token = "token"
537
+ ssl = false
538
+
539
+ client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl)
540
+
541
+ namespace = "default"
542
+
543
+ puts client.get_all_namespaced_pods(namespace) # Returns JSON
544
+ ```
545
+
546
+ #### Get Single Namespaced Pod
547
+ * Get details for single Pod in Namespace
548
+ ```ruby
549
+ require 'ruby-kubernetes-controller'
550
+
551
+ pod = "localhost"
552
+ bearer_token = "token"
553
+ ssl = false
554
+
555
+ client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl)
556
+
557
+ namespace = "default"
558
+ pod_name = "pod"
559
+
560
+ puts client.get_single_namespaced_pod(namespace, pod_name) # Returns JSON
561
+ ```
562
+
563
+ #### Update Pod
564
+ * Update existing Pod in Namespace
565
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
566
+ ```ruby
567
+ require 'ruby-kubernetes-controller'
568
+
569
+ pod = "localhost"
570
+ bearer_token = "token"
571
+ ssl = false
572
+
573
+ # With JSON
574
+ json_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = false)
575
+ namespace = "default"
576
+ pod_name = "pod"
577
+ json_update =
578
+ '{
579
+ "kind": "Pod",
580
+ "apiVersion": "v1",
581
+ ...
582
+ }'
583
+
584
+ puts json_client.update_namespaced_pod(namespace, pod_name, json_update) # Returns JSON
585
+
586
+ # With YAML
587
+ yaml_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = true)
588
+ namespace = "default"
589
+ pod_name = "pod"
590
+ yaml_file_path = 'path/to/file.yaml'
591
+
592
+ puts yaml_client.update_namespaced_pod(namespace, pod_name, yaml_file_path) # Returns JSON
593
+ ```
594
+
595
+ #### Patch Pod
596
+ * Patch existing Pod
597
+ * Patch Format documentation available at: http://jsonpatch.com/
598
+ ```ruby
599
+ require 'ruby-kubernetes-controller'
600
+
601
+ pod = "localhost"
602
+ bearer_token = "token"
603
+ ssl = false
604
+
605
+ client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl)
606
+
607
+ namespace = "default"
608
+ pod_name = "pod"
609
+ patch =
610
+ '[
611
+ { "op": "replace", "path": "/baz", "value": "boo" },
612
+ { "op": "add", "path": "/hello", "value": ["world"] },
613
+ { "op": "remove", "path": "/foo" }
614
+ ]'
615
+
616
+ puts client.patch_pod(namespace, pod_name, patch) # Returns JSON
617
+ ```
618
+
619
+ #### Delete Pod
620
+ * Delete existing Pod
621
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
622
+ ```ruby
623
+ require 'ruby-kubernetes-controller'
624
+
625
+ pod = "localhost"
626
+ bearer_token = "token"
627
+ ssl = false
628
+
629
+ # With JSON
630
+ json_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = false)
631
+ namespace = "default"
632
+ pod_name = "pod"
633
+ json_options =
634
+ '{
635
+ "kind": "Pod",
636
+ "apiVersion": "v1",
637
+ ...
638
+ }'
639
+
640
+ puts json_client.delete_pod(namespace, pod_name, json_options) # Returns JSON
641
+
642
+ # With YAML
643
+ yaml_client = ::RubyKubernetesController::Client.new(pod, bearer_token, ssl, yaml = true)
644
+ namespace = "default"
645
+ pod_name = "pod"
646
+ yaml_file_path = 'path/to/file.yaml'
647
+
648
+ puts yaml_client.delete_pod(namespace, pod_name, yaml_file_path) # Returns JSON
649
+ ```
650
+
651
+ #### Create Service
652
+ * Create new Service
653
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
654
+ ```ruby
655
+ require 'ruby-kubernetes-controller'
656
+
657
+ service = "localhost"
658
+ bearer_token = "token"
659
+ ssl = false
660
+
661
+ # With JSON
662
+ json_client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl, yaml = false)
663
+ namespace = "default"
664
+ json_config =
665
+ '{
666
+ "kind": "Service",
667
+ "apiVersion": "v1",
668
+ ...
669
+ }'
670
+
671
+ puts json_client.create_new_service(namespace, json_config) # Returns JSON
672
+
673
+ # With YAML
674
+ yaml_client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl, yaml = true)
675
+ namespace = "default"
676
+ yaml_file_path = 'path/to/file.yaml'
677
+
678
+ puts yaml_client.create_new_service(namespace, yaml_file_path) # Returns JSON
679
+ ```
680
+
681
+ #### Get Services
682
+ * List all Services
683
+ ```ruby
684
+ require 'ruby-kubernetes-controller'
685
+
686
+ service = "localhost"
687
+ bearer_token = "token"
688
+ ssl = false
689
+
690
+ client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl)
691
+
692
+ puts client.get_all_services # Returns JSON
693
+ ```
694
+
695
+ #### Get Namespaced Services
696
+ * List all existing Services in Namespace
697
+ ```ruby
698
+ require 'ruby-kubernetes-controller'
699
+
700
+ service = "localhost"
701
+ bearer_token = "token"
702
+ ssl = false
703
+
704
+ client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl)
705
+
706
+ namespace = "default"
707
+
708
+ puts client.get_all_namespaced_services(namespace) # Returns JSON
709
+ ```
710
+
711
+ #### Get Single Namespaced Service
712
+ * Get details for single Service in Namespace
713
+ ```ruby
714
+ require 'ruby-kubernetes-controller'
715
+
716
+ service = "localhost"
717
+ bearer_token = "token"
718
+ ssl = false
719
+
720
+ client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl)
721
+
722
+ namespace = "default"
723
+ service_name = "service"
724
+
725
+ puts client.get_single_namespaced_service(namespace, service_name) # Returns JSON
726
+ ```
727
+
728
+ #### Update Service
729
+ * Update existing Service in Namespace
730
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_service
731
+ ```ruby
732
+ require 'ruby-kubernetes-controller'
733
+
734
+ service = "localhost"
735
+ bearer_token = "token"
736
+ ssl = false
737
+
738
+ # With JSON
739
+ json_client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl, yaml = false)
740
+ namespace = "default"
741
+ service_name = "service"
742
+ json_update =
743
+ '{
744
+ "kind": "Service",
745
+ "apiVersion": "v1",
746
+ ...
747
+ }'
748
+
749
+ puts json_client.update_namespaced_service(namespace, service_name, json_update) # Returns JSON
750
+
751
+ # With YAML
752
+ yaml_client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl, yaml = true)
753
+ namespace = "default"
754
+ service_name = "service"
755
+ yaml_file_path = 'path/to/file.yaml'
756
+
757
+ puts yaml_client.update_namespaced_service(namespace, service_name, yaml_file_path) # Returns JSON
758
+ ```
759
+
760
+ #### Patch Service
761
+ * Patch existing Service
762
+ * Patch Format documentation available at: http://jsonpatch.com/
763
+ ```ruby
764
+ require 'ruby-kubernetes-controller'
765
+
766
+ service = "localhost"
767
+ bearer_token = "token"
768
+ ssl = false
769
+
770
+ client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl)
771
+
772
+ namespace = "default"
773
+ service_name = "service"
774
+ patch =
775
+ '[
776
+ { "op": "replace", "path": "/baz", "value": "boo" },
777
+ { "op": "add", "path": "/hello", "value": ["world"] },
778
+ { "op": "remove", "path": "/foo" }
779
+ ]'
780
+
781
+ puts client.patch_service(namespace, service_name, patch) # Returns JSON
782
+ ```
783
+
784
+ #### Delete Service
785
+ * Delete existing Service
786
+ ```ruby
787
+ require 'ruby-kubernetes-controller'
788
+
789
+ service = "localhost"
790
+ bearer_token = "token"
791
+ ssl = false
792
+
793
+ client = ::RubyKubernetesController::Client.new(service, bearer_token, ssl)
794
+
795
+ namespace = "default"
796
+ service_name = "service"
797
+
798
+ puts client.delete_service(namespace, service_name) # Returns JSON
799
+ ```
800
+
801
+ #### Create Deployment
802
+ * Create new Deployment
803
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_deployment
804
+ ```ruby
805
+ require 'ruby-kubernetes-controller'
806
+
807
+ endpoint = "localhost"
808
+ bearer_token = "token"
809
+ ssl = false
810
+
811
+ # With JSON
812
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
813
+ namespace = "default"
814
+ json_config =
815
+ '{
816
+ "kind": "Deployment",
817
+ "apiVersion": "extensions/v1beta1",
818
+ ...
819
+ }'
820
+
821
+ puts json_client.create_new_deployment(namespace, json_config) # Returns JSON
822
+
823
+ # With YAML
824
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
825
+ namespace = "default"
826
+ yaml_file_path = 'path/to/file.yaml'
827
+
828
+ puts yaml_client.create_new_deployment(namespace, yaml_file_path) # Returns JSON
829
+ ```
830
+
831
+ #### Get Deploymentes
832
+ * List all Deploymentes
833
+ ```ruby
834
+ require 'ruby-kubernetes-controller'
835
+
836
+ endpoint = "localhost"
837
+ bearer_token = "token"
838
+ ssl = false
839
+
840
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
841
+
842
+ puts client.get_all_deploymentes # Returns JSON
843
+ ```
844
+
845
+ #### Get Namespaced Deploymentes
846
+ * List all existing Deploymentes in Namespace
847
+ ```ruby
848
+ require 'ruby-kubernetes-controller'
849
+
850
+ endpoint = "localhost"
851
+ bearer_token = "token"
852
+ ssl = false
853
+
854
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
855
+
856
+ namespace = "default"
857
+
858
+ puts client.get_all_namespaced_deploymentes(namespace) # Returns JSON
859
+ ```
860
+
861
+ #### Get Single Namespaced Deployment
862
+ * Get details for single Deployment in Namespace
863
+ ```ruby
864
+ require 'ruby-kubernetes-controller'
865
+
866
+ endpoint = "localhost"
867
+ bearer_token = "token"
868
+ ssl = false
869
+
870
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
871
+
872
+ namespace = "default"
873
+ deployment_name = "deployment"
874
+
875
+ puts client.get_single_namespaced_deployment(namespace, deployment_name) # Returns JSON
876
+ ```
877
+
878
+ #### Update Deployment
879
+ * Update existing Deployment in Namespace
880
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_deployment
881
+ ```ruby
882
+ require 'ruby-kubernetes-controller'
883
+
884
+ endpoint = "localhost"
885
+ bearer_token = "token"
886
+ ssl = false
887
+
888
+ # With JSON
889
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
890
+ namespace = "default"
891
+ deployment_name = "deployment"
892
+ json_update =
893
+ '{
894
+ "kind": "Deployment",
895
+ "apiVersion": "extensions/v1beta1",
896
+ ...
897
+ }'
898
+
899
+ puts json_client.update_namespaced_deployment(namespace, deployment_name, json_update) # Returns JSON
900
+
901
+ # With YAML
902
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
903
+ namespace = "default"
904
+ deployment_name = "deployment"
905
+ yaml_file_path = 'path/to/file.yaml'
906
+
907
+ puts yaml_client.update_namespaced_deployment(namespace, deployment_name, yaml_file_path) # Returns JSON
908
+ ```
909
+
910
+ #### Patch Deployment
911
+ * Patch existing Deployment
912
+ * Patch Format documentation available at: http://jsonpatch.com/
913
+ ```ruby
914
+ require 'ruby-kubernetes-controller'
915
+
916
+ endpoint = "localhost"
917
+ bearer_token = "token"
918
+ ssl = false
919
+
920
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
921
+
922
+ namespace = "default"
923
+ deployment_name = "deployment"
924
+ patch =
925
+ '[
926
+ { "op": "replace", "path": "/baz", "value": "boo" },
927
+ { "op": "add", "path": "/hello", "value": ["world"] },
928
+ { "op": "remove", "path": "/foo" }
929
+ ]'
930
+
931
+ puts client.patch_deployment(namespace, deployment_name, patch) # Returns JSON
932
+ ```
933
+
934
+ #### Delete Deployment
935
+ * Delete existing Deployment
936
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
937
+ ```ruby
938
+ require 'ruby-kubernetes-controller'
939
+
940
+ endpoint = "localhost"
941
+ bearer_token = "token"
942
+ ssl = false
943
+
944
+ # With JSON
945
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
946
+ namespace = "default"
947
+ deployment_name = "deployment"
948
+ json_options =
949
+ '{
950
+ "kind": "Deployment",
951
+ "apiVersion": "extensions/v1beta1",
952
+ ...
953
+ }'
954
+
955
+ puts json_client.delete_deployment(namespace, deployment_name, json_options) # Returns JSON
956
+
957
+ # With YAML
958
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
959
+ namespace = "default"
960
+ deployment_name = "deployment"
961
+ yaml_file_path = 'path/to/file.yaml'
962
+
963
+ puts yaml_client.delete_deployment(namespace, deployment_name, yaml_file_path) # Returns JSON
964
+ ```
965
+
966
+ #### Create Replicaset
967
+ * Create new Replicaset
968
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_replicaset
969
+ ```ruby
970
+ require 'ruby-kubernetes-controller'
971
+
972
+ endpoint = "localhost"
973
+ bearer_token = "token"
974
+ ssl = false
975
+
976
+ # With JSON
977
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
978
+ namespace = "default"
979
+ json_config =
980
+ '{
981
+ "kind": "Replicaset",
982
+ "apiVersion": "extensions/v1beta1",
983
+ ...
984
+ }'
985
+
986
+ puts json_client.create_new_replicaset(namespace, json_config) # Returns JSON
987
+
988
+ # With YAML
989
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
990
+ namespace = "default"
991
+ yaml_file_path = 'path/to/file.yaml'
992
+
993
+ puts yaml_client.create_new_replicaset(namespace, yaml_file_path) # Returns JSON
994
+ ```
995
+
996
+ #### Get Replicasets
997
+ * List all Replicasets
998
+ ```ruby
999
+ require 'ruby-kubernetes-controller'
1000
+
1001
+ endpoint = "localhost"
1002
+ bearer_token = "token"
1003
+ ssl = false
1004
+
1005
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
1006
+
1007
+ puts client.get_all_replicasets # Returns JSON
1008
+ ```
1009
+
1010
+ #### Get Namespaced Replicasets
1011
+ * List all existing Replicasets in Namespace
1012
+ ```ruby
1013
+ require 'ruby-kubernetes-controller'
1014
+
1015
+ endpoint = "localhost"
1016
+ bearer_token = "token"
1017
+ ssl = false
1018
+
1019
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
1020
+
1021
+ namespace = "default"
1022
+
1023
+ puts client.get_all_namespaced_replicasets(namespace) # Returns JSON
1024
+ ```
1025
+
1026
+ #### Get Single Namespaced Replicaset
1027
+ * Get details for single Replicaset in Namespace
1028
+ ```ruby
1029
+ require 'ruby-kubernetes-controller'
1030
+
1031
+ endpoint = "localhost"
1032
+ bearer_token = "token"
1033
+ ssl = false
1034
+
1035
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
1036
+
1037
+ namespace = "default"
1038
+ replicaset_name = "replicaset"
1039
+
1040
+ puts client.get_single_namespaced_replicaset(namespace, replicaset_name) # Returns JSON
1041
+ ```
1042
+
1043
+ #### Update Replicaset
1044
+ * Update existing Replicaset in Namespace
1045
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1beta1_replicaset
1046
+ ```ruby
1047
+ require 'ruby-kubernetes-controller'
1048
+
1049
+ endpoint = "localhost"
1050
+ bearer_token = "token"
1051
+ ssl = false
1052
+
1053
+ # With JSON
1054
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
1055
+ namespace = "default"
1056
+ replicaset_name = "replicaset"
1057
+ json_update =
1058
+ '{
1059
+ "kind": "Replicaset",
1060
+ "apiVersion": "extensions/v1beta1",
1061
+ ...
1062
+ }'
1063
+
1064
+ puts json_client.update_namespaced_replicaset(namespace, replicaset_name, json_update) # Returns JSON
1065
+
1066
+ # With YAML
1067
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
1068
+ namespace = "default"
1069
+ replicaset_name = "replicaset"
1070
+ yaml_file_path = 'path/to/file.yaml'
1071
+
1072
+ puts yaml_client.update_namespaced_replicaset(namespace, replicaset_name, yaml_file_path) # Returns JSON
1073
+ ```
1074
+
1075
+ #### Patch Replicaset
1076
+ * Patch existing Replicaset
1077
+ * Patch Format documentation available at: http://jsonpatch.com/
1078
+ ```ruby
1079
+ require 'ruby-kubernetes-controller'
1080
+
1081
+ endpoint = "localhost"
1082
+ bearer_token = "token"
1083
+ ssl = false
1084
+
1085
+ client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl)
1086
+
1087
+ namespace = "default"
1088
+ replicaset_name = "replicaset"
1089
+ patch =
1090
+ '[
1091
+ { "op": "replace", "path": "/baz", "value": "boo" },
1092
+ { "op": "add", "path": "/hello", "value": ["world"] },
1093
+ { "op": "remove", "path": "/foo" }
1094
+ ]'
1095
+
1096
+ puts client.patch_replicaset(namespace, replicaset_name, patch) # Returns JSON
1097
+ ```
1098
+
1099
+ #### Delete Replicaset
1100
+ * Delete existing Replicaset
1101
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
1102
+ ```ruby
1103
+ require 'ruby-kubernetes-controller'
1104
+
1105
+ endpoint = "localhost"
1106
+ bearer_token = "token"
1107
+ ssl = false
1108
+
1109
+ # With JSON
1110
+ json_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = false)
1111
+ namespace = "default"
1112
+ replicaset_name = "replicaset"
1113
+ json_options =
1114
+ '{
1115
+ "kind": "Replicaset",
1116
+ "apiVersion": "extensions/v1beta1",
1117
+ ...
1118
+ }'
1119
+
1120
+ puts json_client.delete_replicaset(namespace, replicaset_name, json_options) # Returns JSON
1121
+
1122
+ # With YAML
1123
+ yaml_client = ::RubyKubernetesController::Client.new(endpoint, bearer_token, ssl, yaml = true)
1124
+ namespace = "default"
1125
+ replicaset_name = "replicaset"
1126
+ yaml_file_path = 'path/to/file.yaml'
1127
+
1128
+ puts yaml_client.delete_replicaset(namespace, replicaset_name, yaml_file_path) # Returns JSON
1129
+ ```
1130
+
1131
+ #### Create Configmap
1132
+ * Create new Configmap
1133
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_configmap
1134
+ ```ruby
1135
+ require 'ruby-kubernetes-controller'
1136
+
1137
+ configmap = "localhost"
1138
+ bearer_token = "token"
1139
+ ssl = false
1140
+
1141
+ # With JSON
1142
+ json_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = false)
1143
+ namespace = "default"
1144
+ json_config =
1145
+ '{
1146
+ "kind": "ConfigMap",
1147
+ "apiVersion": "v1",
1148
+ ...
1149
+ }'
1150
+
1151
+ puts json_client.create_new_configmap(namespace, json_config) # Returns JSON
1152
+
1153
+ # With YAML
1154
+ yaml_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = true)
1155
+ namespace = "default"
1156
+ yaml_file_path = 'path/to/file.yaml'
1157
+
1158
+ puts yaml_client.create_new_configmap(namespace, yaml_file_path) # Returns JSON
1159
+ ```
1160
+
1161
+ #### Get Configmaps
1162
+ * List all Configmaps
1163
+ ```ruby
1164
+ require 'ruby-kubernetes-controller'
1165
+
1166
+ configmap = "localhost"
1167
+ bearer_token = "token"
1168
+ ssl = false
1169
+
1170
+ client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl)
1171
+
1172
+ puts client.get_all_configmaps # Returns JSON
1173
+ ```
1174
+
1175
+ #### Get Namespaced Configmaps
1176
+ * List all existing Configmaps in Namespace
1177
+ ```ruby
1178
+ require 'ruby-kubernetes-controller'
1179
+
1180
+ configmap = "localhost"
1181
+ bearer_token = "token"
1182
+ ssl = false
1183
+
1184
+ client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl)
1185
+
1186
+ namespace = "default"
1187
+
1188
+ puts client.get_all_namespaced_configmaps(namespace) # Returns JSON
1189
+ ```
1190
+
1191
+ #### Get Single Namespaced Configmap
1192
+ * Get details for single Configmap in Namespace
1193
+ ```ruby
1194
+ require 'ruby-kubernetes-controller'
1195
+
1196
+ configmap = "localhost"
1197
+ bearer_token = "token"
1198
+ ssl = false
1199
+
1200
+ client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl)
1201
+
1202
+ namespace = "default"
1203
+ configmap_name = "configmap"
1204
+
1205
+ puts client.get_single_namespaced_configmap(namespace, configmap_name) # Returns JSON
1206
+ ```
1207
+
1208
+ #### Update Configmap
1209
+ * Update existing Configmap in Namespace
1210
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_configmap
1211
+ ```ruby
1212
+ require 'ruby-kubernetes-controller'
1213
+
1214
+ configmap = "localhost"
1215
+ bearer_token = "token"
1216
+ ssl = false
1217
+
1218
+ # With JSON
1219
+ json_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = false)
1220
+ namespace = "default"
1221
+ configmap_name = "configmap"
1222
+ json_update =
1223
+ '{
1224
+ "kind": "ConfigMap",
1225
+ "apiVersion": "v1",
1226
+ ...
1227
+ }'
1228
+
1229
+ puts json_client.update_namespaced_configmap(namespace, configmap_name, json_update) # Returns JSON
1230
+
1231
+ # With YAML
1232
+ yaml_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = true)
1233
+ namespace = "default"
1234
+ configmap_name = "configmap"
1235
+ yaml_file_path = 'path/to/file.yaml'
1236
+
1237
+ puts yaml_client.update_namespaced_configmap(namespace, configmap_name, yaml_file_path) # Returns JSON
1238
+ ```
1239
+
1240
+ #### Patch Configmap
1241
+ * Patch existing Configmap
1242
+ * Patch Format documentation available at: http://jsonpatch.com/
1243
+ ```ruby
1244
+ require 'ruby-kubernetes-controller'
1245
+
1246
+ configmap = "localhost"
1247
+ bearer_token = "token"
1248
+ ssl = false
1249
+
1250
+ client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl)
1251
+
1252
+ namespace = "default"
1253
+ configmap_name = "configmap"
1254
+ patch =
1255
+ '[
1256
+ { "op": "replace", "path": "/baz", "value": "boo" },
1257
+ { "op": "add", "path": "/hello", "value": ["world"] },
1258
+ { "op": "remove", "path": "/foo" }
1259
+ ]'
1260
+
1261
+ puts client.patch_configmap(namespace, configmap_name, patch) # Returns JSON
1262
+ ```
1263
+
1264
+ #### Delete Configmap
1265
+ * Delete existing Configmap
1266
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
1267
+ ```ruby
1268
+ require 'ruby-kubernetes-controller'
1269
+
1270
+ configmap = "localhost"
1271
+ bearer_token = "token"
1272
+ ssl = false
1273
+
1274
+ # With JSON
1275
+ json_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = false)
1276
+ namespace = "default"
1277
+ configmap_name = "configmap"
1278
+ json_options =
1279
+ '{
1280
+ "kind": "ConfigMap",
1281
+ "apiVersion": "v1",
1282
+ ...
1283
+ }'
1284
+
1285
+ puts json_client.delete_configmap(namespace, configmap_name, json_options) # Returns JSON
1286
+
1287
+ # With YAML
1288
+ yaml_client = ::RubyKubernetesController::Client.new(configmap, bearer_token, ssl, yaml = true)
1289
+ namespace = "default"
1290
+ configmap_name = "configmap"
1291
+ yaml_file_path = 'path/to/file.yaml'
1292
+
1293
+ puts yaml_client.delete_configmap(namespace, configmap_name, yaml_file_path) # Returns JSON
1294
+ ```
1295
+
1296
+ #### Create PersistentVolume
1297
+ * Create new PersistentVolume
1298
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_persistentvolume
1299
+ ```ruby
1300
+ require 'ruby-kubernetes-controller'
1301
+
1302
+ persistentvolume = "localhost"
1303
+ bearer_token = "token"
1304
+ ssl = false
1305
+
1306
+ # With JSON
1307
+ json_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = false)
1308
+ namespace = "default"
1309
+ json_config =
1310
+ '{
1311
+ "kind": "persistentvolume",
1312
+ "apiVersion": "v1",
1313
+ ...
1314
+ }'
1315
+
1316
+ puts json_client.create_new_persistentvolume(json_config) # Returns JSON
1317
+
1318
+ # With YAML
1319
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = true)
1320
+ # yaml file could be a link to a file in Cloud object storage or a github raw
1321
+ yaml_file_path = 'path/to/file.yaml'
1322
+
1323
+ puts yaml_client.create_new_persistentvolume(yaml_file_path) # Returns JSON
1324
+ ```
1325
+
1326
+ #### Get PersistentVolumes
1327
+ * List all PersistentVolumes
1328
+ ```ruby
1329
+ require 'ruby-kubernetes-controller'
1330
+
1331
+ persistentvolume = "localhost"
1332
+ bearer_token = "token"
1333
+ ssl = false
1334
+
1335
+ client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl)
1336
+
1337
+ puts client.get_all_persistentvolumes # Returns JSON
1338
+ ```
1339
+
1340
+ #### Get Single PersistentVolumes
1341
+ * Get details for single PersistentVolumes
1342
+ ```ruby
1343
+ require 'ruby-kubernetes-controller'
1344
+
1345
+ persistentvolume = "localhost"
1346
+ bearer_token = "token"
1347
+ ssl = false
1348
+
1349
+ client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl)
1350
+
1351
+ persistentvolume_name = "persistentvolume"
1352
+
1353
+ puts client.get_single_persistentvolume(persistentvolume_name) # Returns JSON
1354
+ ```
1355
+
1356
+ #### Update PersistentVolumes
1357
+ * Update existing PersistentVolumes in Namespace
1358
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_persistentvolume
1359
+ ```ruby
1360
+ require 'ruby-kubernetes-controller'
1361
+
1362
+ persistentvolume = "localhost"
1363
+ bearer_token = "token"
1364
+ ssl = false
1365
+
1366
+ # With JSON
1367
+ json_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = false)
1368
+ persistentvolume_name = "persistentvolume"
1369
+ json_update =
1370
+ '{
1371
+ "kind": "persistentvolume",
1372
+ "apiVersion": "v1",
1373
+ ...
1374
+ }'
1375
+
1376
+ puts json_client.update_namespaced_persistentvolume(persistentvolume_name, json_update) # Returns JSON
1377
+
1378
+ # With YAML
1379
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = true)
1380
+ persistentvolume_name = "persistentvolume"
1381
+ # yaml file could be a link to a file in Cloud object storage or a github raw
1382
+ yaml_file_path = 'path/to/file.yaml'
1383
+
1384
+ puts yaml_client.update_namespaced_persistentvolume(persistentvolume_name, yaml_file_path) # Returns JSON
1385
+ ```
1386
+
1387
+ #### Patch PersistentVolumes
1388
+ * Patch existing PersistentVolumes
1389
+ * Patch Format documentation available at: http://jsonpatch.com/
1390
+ ```ruby
1391
+ require 'ruby-kubernetes-controller'
1392
+
1393
+ persistentvolume = "localhost"
1394
+ bearer_token = "token"
1395
+ ssl = false
1396
+
1397
+ client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl)
1398
+
1399
+ persistentvolume_name = "persistentvolume"
1400
+ patch =
1401
+ '[
1402
+ { "op": "replace", "path": "/baz", "value": "boo" },
1403
+ { "op": "add", "path": "/hello", "value": ["world"] },
1404
+ { "op": "remove", "path": "/foo" }
1405
+ ]'
1406
+
1407
+ puts client.patch_persistentvolume(persistentvolume_name, patch) # Returns JSON
1408
+ ```
1409
+
1410
+ #### Delete PersistentVolumes
1411
+ * Delete existing PersistentVolumes
1412
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
1413
+ ```ruby
1414
+ require 'ruby-kubernetes-controller'
1415
+
1416
+ persistentvolume = "localhost"
1417
+ bearer_token = "token"
1418
+ ssl = false
1419
+
1420
+ # With JSON
1421
+ json_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = false)
1422
+ persistentvolume_name = "persistentvolume"
1423
+ json_options =
1424
+ '{
1425
+ "kind": "persistentvolume",
1426
+ "apiVersion": "v1",
1427
+ ...
1428
+ }'
1429
+
1430
+ puts json_client.delete_persistentvolume(persistentvolume_name, json_options) # Returns JSON
1431
+
1432
+ # With YAML
1433
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolume, bearer_token, ssl, yaml = true)
1434
+ persistentvolume_name = "persistentvolume"
1435
+ # yaml file could be a link to a file in Cloud object storage or a github raw
1436
+ yaml_file_path = 'path/to/file.yaml'
1437
+
1438
+ puts yaml_client.delete_persistentvolume(persistentvolume_name, yaml_file_path) # Returns JSON
1439
+ ```
1440
+
1441
+ #### Create PersistentVolumeClaim
1442
+ * Create new PersistentVolumeClaim
1443
+ * Config options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_persistentvolumeclaim
1444
+ ```ruby
1445
+ require 'ruby-kubernetes-controller'
1446
+
1447
+ persistentvolumeclaim = "localhost"
1448
+ bearer_token = "token"
1449
+ ssl = false
1450
+
1451
+ # With JSON
1452
+ json_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = false)
1453
+ namespace = "default"
1454
+ json_config =
1455
+ '{
1456
+ "kind": "persistentvolumeclaim",
1457
+ "apiVersion": "v1",
1458
+ ...
1459
+ }'
1460
+
1461
+ puts json_client.create_new_persistentvolumeclaim(namespace, json_config) # Returns JSON
1462
+
1463
+ # With YAML
1464
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = true)
1465
+ namespace = "default"
1466
+ yaml_file_path = 'path/to/file.yaml'
1467
+
1468
+ puts yaml_client.create_new_persistentvolumeclaim(namespace, yaml_file_path) # Returns JSON
1469
+ ```
1470
+
1471
+ #### Get PersistentVolumeClaims
1472
+ * List all PersistentVolumeClaims
1473
+ ```ruby
1474
+ require 'ruby-kubernetes-controller'
1475
+
1476
+ persistentvolumeclaim = "localhost"
1477
+ bearer_token = "token"
1478
+ ssl = false
1479
+
1480
+ client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl)
1481
+
1482
+ puts client.get_all_persistentvolumeclaims # Returns JSON
1483
+ ```
1484
+
1485
+ #### Get Namespaced PersistentVolumeClaims
1486
+ * List all existing PersistentVolumeClaims in Namespace
1487
+ ```ruby
1488
+ require 'ruby-kubernetes-controller'
1489
+
1490
+ persistentvolumeclaim = "localhost"
1491
+ bearer_token = "token"
1492
+ ssl = false
1493
+
1494
+ client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl)
1495
+
1496
+ namespace = "default"
1497
+
1498
+ puts client.get_all_namespaced_persistentvolumeclaims(namespace) # Returns JSON
1499
+ ```
1500
+
1501
+ #### Get Single Namespaced PersistentVolumeClaims
1502
+ * Get details for single PersistentVolumeClaims in Namespace
1503
+ ```ruby
1504
+ require 'ruby-kubernetes-controller'
1505
+
1506
+ persistentvolumeclaim = "localhost"
1507
+ bearer_token = "token"
1508
+ ssl = false
1509
+
1510
+ client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl)
1511
+
1512
+ namespace = "default"
1513
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1514
+
1515
+ puts client.get_single_namespaced_persistentvolumeclaim(namespace, persistentvolumeclaim_name) # Returns JSON
1516
+ ```
1517
+
1518
+ #### Update PersistentVolumeClaims
1519
+ * Update existing PersistentVolumeClaims in Namespace
1520
+ * Update options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_persistentvolumeclaim
1521
+ ```ruby
1522
+ require 'ruby-kubernetes-controller'
1523
+
1524
+ persistentvolumeclaim = "localhost"
1525
+ bearer_token = "token"
1526
+ ssl = false
1527
+
1528
+ # With JSON
1529
+ json_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = false)
1530
+ namespace = "default"
1531
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1532
+ json_update =
1533
+ '{
1534
+ "kind": "persistentvolumeclaim",
1535
+ "apiVersion": "v1",
1536
+ ...
1537
+ }'
1538
+
1539
+ puts json_client.update_namespaced_persistentvolumeclaim(namespace, persistentvolumeclaim_name, json_update) # Returns JSON
1540
+
1541
+ # With YAML
1542
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = true)
1543
+ namespace = "default"
1544
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1545
+ yaml_file_path = 'path/to/file.yaml'
1546
+
1547
+ puts yaml_client.update_namespaced_persistentvolumeclaim(namespace, persistentvolumeclaim_name, yaml_file_path) # Returns JSON
1548
+ ```
1549
+
1550
+ #### Patch PersistentVolumeClaims
1551
+ * Patch existing PersistentVolumeClaims
1552
+ * Patch Format documentation available at: http://jsonpatch.com/
1553
+ ```ruby
1554
+ require 'ruby-kubernetes-controller'
1555
+
1556
+ persistentvolumeclaim = "localhost"
1557
+ bearer_token = "token"
1558
+ ssl = false
1559
+
1560
+ client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl)
1561
+
1562
+ namespace = "default"
1563
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1564
+ patch =
1565
+ '[
1566
+ { "op": "replace", "path": "/baz", "value": "boo" },
1567
+ { "op": "add", "path": "/hello", "value": ["world"] },
1568
+ { "op": "remove", "path": "/foo" }
1569
+ ]'
1570
+
1571
+ puts client.patch_persistentvolumeclaim(namespace, persistentvolumeclaim_name, patch) # Returns JSON
1572
+ ```
1573
+
1574
+ #### Delete PersistentVolumeClaims
1575
+ * Delete existing PersistentVolumeClaims
1576
+ * Delete options documentation available at: https://kubernetes.io/docs/reference/federation/v1/definitions/#_v1_deleteoptions
1577
+ ```ruby
1578
+ require 'ruby-kubernetes-controller'
1579
+
1580
+ persistentvolumeclaim = "localhost"
1581
+ bearer_token = "token"
1582
+ ssl = false
1583
+
1584
+ # With JSON
1585
+ json_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = false)
1586
+ namespace = "default"
1587
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1588
+ json_options =
1589
+ '{
1590
+ "kind": "persistentvolumeclaim",
1591
+ "apiVersion": "v1",
1592
+ ...
1593
+ }'
1594
+
1595
+ puts json_client.delete_persistentvolumeclaim(namespace, persistentvolumeclaim_name, json_options) # Returns JSON
1596
+
1597
+ # With YAML
1598
+ yaml_client = ::RubyKubernetesController::Client.new(persistentvolumeclaim, bearer_token, ssl, yaml = true)
1599
+ namespace = "default"
1600
+ persistentvolumeclaim_name = "persistentvolumeclaim"
1601
+ yaml_file_path = 'path/to/file.yaml'
1602
+
1603
+ puts yaml_client.delete_persistentvolumeclaim(namespace, persistentvolumeclaim_name, yaml_file_path) # Returns JSON
1604
+ ```
1605
+
1606
+ [SERVICEACCOUNT]: https://github.com/IBM/ruby-kubernetes-controller/blob/master/Documentation/serviceaccount.yaml