@@ -92,6 +92,18 @@ tags, and then generate with `hack/update-toc.sh`.
92
92
- [ Open Questions] ( #open-questions )
93
93
- [ Risks and Mitigations] ( #risks-and-mitigations )
94
94
- [ Design Details] ( #design-details )
95
+ - [ Kubectl Kuberc Management Command (kubectl kuberc)] ( #kubectl-kuberc-management-command-kubectl-kuberc )
96
+ - [ kubectl kuberc view] ( #kubectl-kuberc-view )
97
+ - [ kubectl kuberc set --section defaults] ( #kubectl-kuberc-set---section-defaults )
98
+ - [ command] ( #command )
99
+ - [ option] ( #option )
100
+ - [ overwrite] ( #overwrite )
101
+ - [ kubectl kuberc set --section aliases] ( #kubectl-kuberc-set---section-aliases )
102
+ - [ name] ( #name )
103
+ - [ command] ( #command-1 )
104
+ - [ option] ( #option-1 )
105
+ - [ prependarg] ( #prependarg )
106
+ - [ appendarg] ( #appendarg )
95
107
- [ Test Plan] ( #test-plan )
96
108
- [ Prerequisite testing updates] ( #prerequisite-testing-updates )
97
109
- [ Unit tests] ( #unit-tests )
@@ -358,6 +370,83 @@ defaults:
358
370
359
371
```
360
372
373
+ ### Kubectl Kuberc Management Command (kubectl kuberc)
374
+
375
+ In alpha (and initially in beta), users are expected to generate their kuberc files manually. However, this operation is error-prone and cumbersome.
376
+ The lack of kubectl command which operates on kuberc file makes the adoption of this feature significantly difficult.
377
+ Therefore, this section proposes new kubectl command, namely ` kubectl kuberc ` .
378
+
379
+ ` kubectl kuberc ` is the main command serving as an entry point to the subcommands similar to how ` kubectl create ` is designed.
380
+ Invocation of ` kubectl kuberc ` prints the subcommands.
381
+ Currently, there are two subcommands (but this can be extended in the future, when more functionality is added to kuberc).
382
+ All the subcommands accept ` kuberc ` flag to explicitly specify the kuberc file to be updated. File priority order is the same with
383
+ kuberc execution:
384
+
385
+ * If ` --kuberc ` flag is specified, operate on this file
386
+ * If ` KUBERC ` environment variable is specified, operate on this file
387
+ * If none, operate on default kuberc (i.e. ` $HOME/.kube/kuberc ` ).
388
+
389
+ This command and subcommands are marked as alpha initially. They can be executed under ` kubectl alpha ` , until they are promoted to beta.
390
+
391
+ ### kubectl kuberc view
392
+
393
+ ` kubectl kuberc view ` subcommand prints the defined kuberc file content in the given format via ` --output ` flag (default is yaml).
394
+
395
+ ### kubectl kuberc set --section defaults
396
+
397
+ ` kubectl kuberc set --section defaults ` subcommand creates/updates the default values of commands. It has the following flags;
398
+
399
+ #### command
400
+
401
+ ` kubectl kuberc set --section defaults ` command validates the presence of the command given via flag ` --command ` .
402
+ This flag can contain subcommands as well. Examples might be ` --command=apply ` , ` --command="create role" ` .
403
+
404
+ #### option
405
+
406
+ ` --option ` flag accepts list of options. We may or may not validate the presence of the flag name in the given command.
407
+ But it is up to user to set the correct default value in correct type. Therefore, default field of the options is arbitrary.
408
+ Examples might be ` --option="server-side=true" ` , ` --option="namespace=test" ` .
409
+
410
+ Although kuberc supports short versions of flags (e.g. ` -n test ` ),
411
+ this flag forces users to enter options in standardized format ` --option=$flag_name=$flag_value ` .
412
+ This gives us the opportunity to standardize kuberc files.
413
+
414
+ #### overwrite
415
+
416
+ By default, this command errors out, if it finds a section of same command and same flag that is executed. ` --overwrite ` flag
417
+ is used to update this section.
418
+
419
+ ### kubectl kuberc set --section aliases
420
+
421
+ ` kubectl kuberc set --section aliases ` defines alias definitions of a command and a set of flag options. It has these flags;
422
+
423
+ #### name
424
+
425
+ This required field is to define the name of the alias. This is inherently arbitrary field based on the preferences of the user.
426
+
427
+ #### command
428
+
429
+ ` kubectl kuberc set --section aliases ` command validates the presence of the command given via flag ` --command ` .
430
+ This flag can contain subcommands as well. Examples might be ` --command=apply ` , ` --command="create role" ` .
431
+
432
+ #### option
433
+
434
+ ` --option ` flag accepts list of options. We may or may not validate the presence of the flag name in the given command.
435
+ But it is up to user setting the correct default value in correct type. Therefore, default field of the options is arbitrary.
436
+ Examples might be ` --option="server-side=true" ` , ` --option="namespace=test" ` .
437
+
438
+ Although kuberc supports short versions of flags (e.g. ` -n test ` ),
439
+ this flag forces users to enter options in opinionated format ` --option=$flag_name=$flag_value ` .
440
+ This gives us the opportunity to standardize kuberc files.
441
+
442
+ #### prependarg
443
+
444
+ ` --prependarg ` is an arbitrary list of strings that accepts anything in a string array format.
445
+
446
+ #### appendarg
447
+
448
+ ` --appendarg ` is an arbitrary list of strings that accepts anything in string array format.
449
+
361
450
### Test Plan
362
451
363
452
<!--
0 commit comments