Commit Graph

58 Commits

Author SHA1 Message Date
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
ramnar 75a9c11d24 implemented review comments
Kubernetes-commit: ffc5c5c054bb8138d8fe456f1d9b5a071cdbdbdc
2020-11-18 09:42:36 +05:30
ramnar 23b2c5aba6 remove generator dependency in create service account
Kubernetes-commit: 7000c28b74b6069fd3b5179d89178271b9fafe42
2020-11-12 07:21:46 +05:30
Sachin Kumar Singh 7259471acb Fix typos and add comments in functions for `kubectl create` subcommands
Certain missing comments and typos in comments are fixed in the files
that implement `kubectl create` subcommands.

Kubernetes-commit: 1c5c8601e479cc3b32809868c250aeb256796484
2020-12-02 03:35:34 +05:30
Martin Schimandl 66944ff3b5 remove generator from service in kubectl
Kubernetes-commit: 12a58f3f15a428111d8053a577ac3d21d229a81b
2020-10-02 18:16:28 +02:00
Aurélien Baumann 1511413ad8 Remove the dependency between create priorityclass command and generators
Kubernetes-commit: 9fff7f70e6d28fd621b2a3ee890b710f05301dad
2020-09-18 11:00:29 -04:00
Karl 'NaN' Wikström 38408eaa8c cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals

cleanup: sort imports

Add i18n dependency for wait.go

Remove translation on envResource

cleanup: translate string instead of variable

cleanup: sort imports

cleanup: translate string literal only

Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
2020-10-09 13:16:13 +02:00
Obeyda Djeffal 6ff4f17e24 Update staging/src/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go
Co-authored-by: Jian Zeng <anonymousknight96@gmail.com>

Kubernetes-commit: 20da5a9d8e7d5a1290c028b9489a7ab31a0c45bb
2020-11-04 11:50:03 +01:00
Obeyda Djeffal 4507bdb448 replace string casting with fmt.sprintf in test
in: staging/src/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go
test: TestCreateRoleBinding

On go version 1.15.3, casting int to string using `string(int)` causes
the test to fail with this error:

>> k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create
vendor/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go:75:9:
    conversion from int to string yields a string of one rune, not a
    string of digits (did you mean fmt.Sprint(x)?)
FAIL    k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create
    [build failed]
FAIL
make: *** [Makefile:185: test] Error 1

Kubernetes-commit: 1e0bbe61ae4d4e186bc8d0991210d1613dc71996
2020-11-04 09:51:01 +01:00
Anderson Duboc c5f4b7e0f0 remove debug print from create quota
Kubernetes-commit: d88da2855f2d078b2a48a7dd99e1236e041b9ea1
2020-10-15 11:07:19 -03:00
zhouya0 a60df0a351 Remove dependency between create rolebinding
Kubernetes-commit: 8ab7f6f5cced2cad56e8b71879379715e9bb5f76
2020-07-10 09:43:22 +08:00
Ricardo Pchevuzinske Katz ecb02de74e Fix catch all regex and missing DryRun Options
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

Kubernetes-commit: 45d6672a98516faecd94263b9d8e4e9d760c7c1e
2020-10-16 15:45:15 -03:00
Masashi Honma 309d0ee885 test: Fix deprecated --dry-run parameter
Some unit tests throw this warning.

W1013 09:06:21.581870  176998 helpers.go:567] --dry-run=true is deprecated (boolean value) and can be replaced with --dry-run=client.

This patch removes the warning by using --dry-run=client instead of --dry-run=true.

The unit tests that are affected are:

make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/apply GOFLAGS=-v
make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/create GOFLAGS=-v

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>

Kubernetes-commit: ad7cbac16354e19981e986bbc2b3fd9cfa930d45
2020-10-14 10:00:08 +09:00
lixiaobing1 d674eb771e fix func name NewCreateCreateDeploymentOptions
Kubernetes-commit: bd17ef4f767a21868edafa19d7596e8df914b2db
2020-06-09 14:35:15 +08:00
Ricardo Pchevuzinske Katz 4ba72b5c67 Add support for create ingress in kubectl
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

Kubernetes-commit: 73aa0a92f8c79d18a53dd39d3064ac3b0257f11b
2020-10-13 15:22:00 -03:00
Amir Mofasser 77e9a6f47f Add `create ingress` command to `cmd/kubectl`
Add `create ingress` unit tests

Move src code to staging dir

Update create command to reflect new API

Replaced deprecated `extensions` api with `networking`

Fix `missing strict dependencies`

Update BUILD

Update BUILD

Fix commit conflict with upstream

Update after review

* Removed obsolete files
* Moved v1beta to v1 api

Fixed gofmt

Fixed deps imports

Merge with PR #94327

Revert changes

Revert go.mod

Revert BUILD

No need to update generated BUILD

Add required deps to BUILD

Update BUILD

Kubernetes-commit: be45584a03aa9f3a3fd73e3d9cc69545da92616e
2020-10-13 16:54:17 +02:00
Sai Harsha Kottapalli 58a00a6dde Remove the dependency between create quota command and generators
Kubernetes-commit: 0222f2d033e8bef5e9b0657cf50e1bcd39b43a57
2020-10-03 03:04:09 +05:30
Eddie Zaneski 1ac77cf17d Warn when creating roles with custom verbs kubectl
Remove errors when using custom verbs

Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: c9420cd703b9431528e91a78428bb982d3b20b67
2020-06-24 16:20:13 -06:00
Jordan Liggitt 197605389f Fix int->string casts
Kubernetes-commit: 124a5ddf725c4862520d8619017cac9db7a03522
2020-07-24 11:13:07 -04:00
Aurélien Baumann bef6c5ee32 Remove the dependency between create clusterrolebinding command and generators
Kubernetes-commit: 484361a1d1eb1e7d37569d0bbe7f3a6ca0de986b
2020-05-15 00:07:01 +02:00
Alex Wang f00cf71393 Promote NonPreempt feature gate to beta (#91899)
* update nonpreempt featuregate to beta

* update

Kubernetes-commit: 209117413f32ec64e800dc32f69055ef2af75d54
2020-06-30 09:39:05 +00:00
Maciej Szulik f5762887af Fix --save-config for kubectl create commands, where it was missing
Kubernetes-commit: 42ee2068384dd47d684121db8f92e593af1f50fc
2020-06-08 14:02:33 +02:00
zhouya0 c825cb5a2f Support kubectl create deployment with replicas
Kubernetes-commit: b6213ed931930eba27b4a53db54b4b4d224a1c59
2020-05-29 14:52:07 +08:00
zhouya0 635dca932f Fix create deployment port not working
Kubernetes-commit: 24766024c17e6090b694b0f57d0b051884a2dac1
2020-05-27 15:56:35 +08:00
Maciej Szulik 0fc32c9e63 Refactor create deployment and add --port flag
Kubernetes-commit: ed1a0e945649095618bd3484c82b58046bcbd60c
2020-05-14 18:34:40 +02:00
Maciej Szulik 731925c63c Set schedule and image flags required for create cronjob
Kubernetes-commit: 9e7ca872b4e2c9c95f7e7c224bc79c1b698789b9
2020-05-14 18:34:27 +02:00
zhouya0 c027f981b2 Fix kubectl create secret docker-registry
Kubernetes-commit: bbf41448f6c5494d5adabc4954d7230522b28d2e
2020-05-11 11:05:37 +08:00
Aurélien Baumann 3c8dea227e Refactor kubectl create deploy: isolate obj construction logic
Kubernetes-commit: c43f62c10b55a8722f1cd5c0547307da388d6b23
2020-05-18 11:32:23 +02:00
zhouya0 2ece9ead67 Fix dry run client ignore namespace
Kubernetes-commit: 2f117260fb50926cf0967dfa2817728eb75e1e90
2020-04-26 15:13:20 +08:00
Aurélien Baumann d55dfd5661 Remove the dependency between create deploy command and generators
Kubernetes-commit: 0cbb2087dab0791956ac9233d9554399fd472bb5
2020-05-01 18:04:37 +02:00
Davanum Srinivas 445ad1366b switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Julian V. Modesto 415a73888a Set kubectl field manager names
Kubernetes-commit: 360c348d0eb5be8c7c9720d5bfda16dbe04e8d15
2020-03-04 22:04:01 -05:00
Maciej Szulik 9f4fb540db Set appropriate owner references when creating a job from cronjob
Kubernetes-commit: b1a068b0fcfeac586df28a8b3d65db33dc3e1aa5
2020-05-13 12:59:49 +02:00
Maciej Szulik b0e673d0df Fix create cronjob help message
Kubernetes-commit: b2b59527964a3629f5d50e4b724aa027b4c36cc5
2020-05-12 10:35:50 +02:00
zhouya0 425b3d2e14 Remove *cobra.command from options
Kubernetes-commit: 1ef5732c436463f405b8224c6885a50716bfc39b
2020-04-09 12:15:43 +08:00
d-kuro 3cbb4ef3ee Fix ownerReferences.apiVersion for kubectl create job --from=cronjob
Kubernetes-commit: b78ab3515e85bb391e6cadc3374da7ac1992db1f
2020-02-28 14:28:27 +09:00
Jordan Liggitt 0c62c9a83a client-go dynamic client: add context to callers
Kubernetes-commit: b7c2faf26c2a25427794478c6265e6d55e8acb5a
2020-03-06 10:17:41 -05:00
Julian V. Modesto b6cbb3bd6c Clean up --dry-run values.
- Clean up --dry-run values in tests, docs, and scripts
- Fix --dry-run for auth reconcile and add a test

Kubernetes-commit: d97169f59ad11f2d2ffd8ef14446bbec5ffc881b
2020-02-13 16:28:22 -05:00
Julian V. Modesto f9460c5333 Use --dry-run=client,server in kubectl.
- Support --dry-run=server for subcommands apply, run, create, annotate,
expose, patch, label, autoscale, apply set-last-applied, drain, rollout undo
- Support --dry-run=server for set subcommands
  - image
  - resources
  - serviceaccount
  - selector
  - env
  - subject
- Support --dry-run=server for create subcommands.
  - clusterrole
  - clusterrolebinding
  - configmap
  - cronjob
  - job
  - deployment
  - namespace
  - poddisruptionbudget
  - priorityclass
  - quota
  - role
  - rolebinding
  - service
  - secret
  - serviceaccount
- Remove GetClientSideDryRun

Kubernetes-commit: 13b80b48cd02b8263d910f2423a1f5b92cdf7644
2020-01-30 20:23:33 -05:00
Mike Danese 29cd24b6cc generated: run refactor
Kubernetes-commit: 25651408aeadf38c3df7ea8c760e7519fd37d625
2020-02-08 12:30:21 -05:00
Mike Danese 71d8052cb0 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Julian V. Modesto c0b11fa131 Extend --dry-run to support string values.
* Extend --dry-run to support string values for dry run strategies
  'client', 'server', and 'none'
* Ensure --dry-run is set and accessed via cmdutil
* Deprecate --dry-run (unset), --dry-run=true, and --dry-run=false

Kubernetes-commit: af52beda260257e81cc9e19e9e5108b682ee93d6
2019-12-15 18:29:27 -05:00
Julian V. Modesto a3f7877cd1 Support DryRun in cli-runtime REST Helper.
- Move TestSupportsDryRun to cli-runtime
- Move TestDryRunVerifier to cli-runtime
- Add OpenAPI schema for testdata to cli-runtime
- Use Helper.DryRun and DryRunVerifier for Apply
- Add WithOptions methods to Helper

Kubernetes-commit: 6bea0e469bcfe4967cbf2656a998d60e0b684747
2019-12-18 22:00:34 -05:00
zhouya0 0833d7cba2 kubectl change podSecurityPolicy group
Kubernetes-commit: 7947b6ce6d8a498000d81b68fa674f88b1d7680a
2019-11-18 15:00:33 +08:00
Clayton Coleman 4ca8f5ecfe test: kubectl unit tests should be using codecs without conversion
Tests are also refactored to use the simpler RESTClient code path.

Kubernetes-commit: 8a9b8c87c40ee65751828d9dd02f4f642588f0ce
2019-11-03 15:20:10 -05:00
ritho b0cd1c2290 Do some Kubectl optimizations suggested by the golangci linter
The tool golangci-lint gives a bunch of warnings. This PR solves the easier/less controversial ones, so the code is simpler and a little bit more optimal, since it removes some if conditions.

Kubernetes-commit: cd2adbe760641f844d84d411f9adcf17fb6982ff
2019-06-04 01:25:43 -05:00