Commit Graph

103 Commits

Author SHA1 Message Date
Chris Bandy facdb16b53 Replace os.Setenv with testing.T.Setenv in tests
T.Setenv ensures that the environment is returned to its prior state
when the test ends. It also panics when called from a parallel test to
prevent racy test interdependencies.

Kubernetes-commit: 2181eea48435310d1b6e366ea8db2968c4941b93
2023-04-15 10:09:47 -05:00
charles-chenzz 0d2299217d reduce util pkg for testing in tempdir.
Kubernetes-commit: aaa30439bdda1589eacc7be8547c297a73e346b9
2023-04-18 11:18:10 +08:00
Tim Hockin c131fb884e Replace uses of ObjectReflectDiff with cmp.Diff
ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: bc302fa4144d21a338683cd83701661f97be4aba
2023-03-23 11:34:03 -07:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Brian Pursley a2ae001d8e cmd/get: Remove cmd argument from Run()
Removes the need to pass cmd as an argument to Run(). This change required reading the --sort-by flag in Complete() in a way similar to other flags.

This change allows the cobra.Command not to need to be passed throughout the completion code, which I updated as part of this commit.

It also is a step in the direction of the TODO comment requesting the removal of arguments passed to Run() and watch().

Kubernetes-commit: aa7a828f20b479a8a943d897224e8e76c3bb6cff
2022-12-23 14:56:59 -05:00
Shuang Wang 58a69e79d3 rolebinding often used for serviceaccount (#107124)
* rolebinding offen used for serviceaccount

* fix syntax error

* fix syntax error

Kubernetes-commit: 8c97443b7b5269e3e96ce31e82e0744219917252
2023-03-07 16:59:35 +00:00
Sean Sullivan e5c05deb7b Refactor to simplify factory Validator
Kubernetes-commit: 5e8648b9f1cdbcbb10f22fd46b6ac40dbc471de2
2022-12-11 18:20:28 -08:00
Sean Sullivan 6dde41fea6 Removes unnecessary dry run verifier
Kubernetes-commit: 530f65d6fd5af81c0691143fbf2c00d440476bb9
2022-12-05 16:25:12 -08:00
inosato 8272d71ba6 Remove ioutil from kubectl
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 774ab1349bfd553c97a99b992e9f38659f541c84
2022-07-30 22:31:16 +09:00
cndoit18 c688132ac9 style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>

Kubernetes-commit: ec43037d0f57fdfc2fdc4960fdb8a7e31ac79fae
2022-07-29 18:25:05 +08:00
Abirdcfly 3614667477 cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 00b9ead02c37921011ebe5293558cea5277cd295
2022-04-24 20:58:04 +08:00
Arda Güçlü 81a25f37b5 Set validate functions requiring no parameters for all commands
Validate function is used to validate command options and should not get
any additional parameter. To preserve compatibility across all
kubectl commands, this PR removes all parameters in validate functions.

Kubernetes-commit: 8fb423bfabe0d53934cc94c154c7da2dc3ce1332
2022-05-17 11:38:20 +03:00
Shubham Kuchhal e767a9773e Update rs.extensions to rs.apps
Kubernetes-commit: ce17a027477efd933775e320b1ce6c3876c136c3
2022-03-29 16:40:28 +05:30
Shubham Kuchhal bb7ded5a2e typo fix.
Kubernetes-commit: d350eb75d62bc51290826b94aa1d89bb6137595b
2022-03-30 18:57:43 +05:30
Shubham Kuchhal 32aa8d698a Updated the user and group flag.
Kubernetes-commit: bf77c2c3e7cdd67079742996cf47bac1003ffc26
2022-03-30 13:03:05 +05:30
Shubham Kuchhal 357211463f Improvement: Updated the serviceaccount flag for multiple subjects.
Kubernetes-commit: 3aa53c99a99f4dfe7d2e0faf2bf51e8252359e8d
2022-03-11 11:40:30 +05:30
Maciej Szulik 9ca2ff9172 Allow adding new verbs in AddSpecialVerb
Kubernetes-commit: 790396caba63f18ac529cf381b405390b62ad3e7
2022-03-28 12:49:02 +02:00
Rey Lejano b062628db1 updates for kubectl generated ref docs
Kubernetes-commit: 37a86e3e33349baa8fdfd25506dddb6009973337
2022-03-25 12:31:12 -07:00
Kevin Delgado 61f42e595f add server-side validation support to kubectl
Kubernetes-commit: fe3772890f650f9bcf020b43dc5a51fab0fa17f4
2022-03-09 14:52:32 +00:00
Marc Khouzam cd5b039b42 Refactor completion code into its own package
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c4f8c57b43843abd13bae677b73c622e1c30b46f
2022-03-24 09:06:05 -04:00
Monis Khan f315a5dd88 kubectl create token: use duration instead of expiration seconds
Expiration seconds is great for an unambiguous REST API.  It it not
a great input for a command line meant to be used by humans.

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 6b9d556c9dc1fca37349833d38f8921f436e1874
2022-03-18 16:11:13 -04:00
Kevin Delgado 7e681490ec Generalize dry run verify to arbitrary query param
Kubernetes-commit: d6c83281bc696474a76365a879f2255b8b568786
2022-03-09 14:51:50 +00:00
Jordan Liggitt 344e97b543 Add command to request a bound service account token
Kubernetes-commit: fca9b1d9fcc7288ecb93c969ff9907a5def2dc9e
2022-01-31 11:46:50 -05:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
Ricardo Katz 36401bb108 fix nil pointer in create secret commands
Kubernetes-commit: 50015c2da621ecaee581f64f737aa2e527905f14
2021-12-25 21:24:21 -03:00
Ross Peoples 88ea823a7a Allow create.specialVerbs to be customized
Kubernetes-commit: 9b2f24aee0668ef54e7f51acc79e51b93f1aedb3
2021-12-16 13:08:28 -06:00
Chok Yip Lau aed179d9d5 Fixed nil pointer dereference
Kubernetes-commit: c337857673e60a44bbdbef9afcbce5b0245b81ec
2021-11-10 12:41:39 -05:00
Shin'ya UEOKA 791e7f9d0b test: Assert max unavailable for PDB test cases
Kubernetes-commit: 5c76507c3f9dd84dd3a56b39a45f99da1735bfed
2021-10-28 05:20:03 +00:00
卢振兴10069964 165827de9c code cleanup for kubectl
Kubernetes-commit: 17993020cdca7eea2fb96a993e048d2d0624fa40
2021-04-12 10:45:08 +08:00
Chok Yip Lau fad6761bba Improve configmap test
Kubernetes-commit: fa7ad6e4657769f767e3a34407cb6ad327d5259c
2021-09-03 15:54:11 -04:00
Chok Yip Lau 5d2f1d8a56 Added support for multiple --from-env flags
Kubernetes-commit: 9a13bae5108beb113dd0ca5605f4adeeac127915
2021-08-09 00:05:43 -04:00
Chok Yip Lau 95dc04b3b3 Added support for multiple --from-env flags
Kubernetes-commit: 99bc2b077fd208885e76281ab8865f1e85f0abb8
2021-04-29 19:16:59 -04:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Marc Khouzam 1946af5761 Move all completion bash code to Go code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 879cdc5fa9e518ce76b9e1dc7e795132457966f3
2021-03-05 15:43:31 -05:00
Maciej Szulik e78cfb08d1 Drop PDB's beta from create command
Kubernetes-commit: 628321130b2b754621eabdd0ec32aa7ef34814fe
2021-04-29 15:07:07 +02:00
Maciej Szulik 156befb4d8 Drop cronjob beta API from create command
Kubernetes-commit: 8b90dbdd4410e94fb5e45cf28a84c8e9527429b6
2021-04-29 15:06:41 +02:00
Kenjiro Nakayama cd8eea6e31 Fix error handling for kubectl create configmap
This patch changes to return when `createConfigMap()` returns error.

Kubernetes-commit: 6caf4d66bda3b9e4efaa45f3479c11ed70ae0100
2021-05-07 18:03:03 +09:00
Zzde 161f78e312 Add test create service with ns
Kubernetes-commit: 84b9159a2e7e20b143d5756bf7f9ccb36d58926a
2021-04-22 17:39:23 +08:00
Zzde dd3b5db48b Set namespace when using kubectl create service
Kubernetes-commit: d1e95a07b24e03ffdf2c5957c4de3f501e9c0a84
2021-04-12 01:20:36 +08:00
Ricardo Katz bb18a0e1b2 Fix validation in kubectl create ingress (#101377)
* Fix validation in kubectl create ingress

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Fix validation in kubectl create ingress

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

Kubernetes-commit: 3dfbcbc878a72a9544af6841315e7dceef9e99fc
2021-04-22 21:44:23 -03:00
BLasan 9072d8b375 Remove AddGeneratorFlag function
Kubernetes-commit: 9c8335b65a4527ea3a07687e4a7a8ba5ebd72041
2021-04-13 23:58:24 +05:30
Maciej Szulik 69bc307556 Fix batch/v1 CronJob support in create, describe and polymorphichelpers
Kubernetes-commit: a68582d6086ffc8608779b0459de8d387042eed1
2021-03-09 09:44:02 +01:00
Maciej Szulik 341b878121 kubectl create job support both v1beta1 and v1 cronjob
Kubernetes-commit: 470e23e770223fb9ddb147b3d431c7727f342255
2021-02-12 17:04:50 +01:00
Julian V. Modesto 04f62ffb0b Cache the OpenAPI schema for server-side dry-run.
Currently, server-side dry-run fetches the OpenAPI schema for every
single object.

This change fetches the OpenAPI schema only once.

Kubernetes-commit: caa158610dfb53de3582ed6df0eb37359206fc66
2021-01-19 16:36:14 -05:00
Chok Yip Lau 0b4fea3c25 Remove dependency of generators from create secret
Kubernetes-commit: 5d3c4eaf562dcdcdc783dee8861e1a2be031ee69
2021-01-13 18:59:18 -05:00
CaiyuhangC 1fa4fffb96 Remove the dependency between create namespace command and generators (#96556)
* Remove the dependency between create namespace command and generators

* Update create_namespace.go

format the file

rename "kruntime" package to "runtime"

remove the reliance of generators

replace dynamic client with typed client

rename "options" to "o" in "NewNamespaceOptions" fun for better reading and comparison with other create cmd

remove Namespace and EnforceNamespace from NamespaceOptions

remove Mapper from NamespaceOptions

refactory the "Run" fun

refactory the "Run" fun

Update create_namespace.go and create_namespace_test.go

* Update create_namespace.go and create_namespace_test.go

* fix createNamespace function

* fix createNamespace function

* fix createNamespace function

* remove the wrong comment in NamespaceOptions

* add validate operation for cobra.Command

* add some unit tests

* add some unit tests

* remove the call of Validate() from createNamespace() and update return type of createNamespace()

* update test suite for the new createNamespace()

Kubernetes-commit: 6990d75625b6aaa32c1aa5a99a174775868263bc
2021-02-05 17:33:15 +00:00
Chok Yip Lau 45c537a0ee Fixed typo in create_priorityclass
Kubernetes-commit: 2edbea60a58c0ec3b5951722a3c90c1752561b50
2021-02-03 21:46:10 -05:00
Chok Yip Lau 31e15a5c73 Remove dependency of generators from create configmap
Kubernetes-commit: 838b189130e1a7f19b11a0764f15df1c8de32769
2021-01-10 18:47:32 -05:00
Sachin Kumar Singh 8e81e1d9ff Remove the dependency between create poddisruptionbudget and generators
Kubernetes-commit: 1e4cba79ef8972248ac360b4ac5b21b085f6a8dc
2020-12-22 01:50:52 +05:30
Henrique Fernandes 5d79d7168d Remove debug print
Kubernetes-commit: 32b8d5ae20105c88fd33c1a34f245639c4a0f6f7
2021-01-19 17:21:50 -03:00