Commit Graph

1052 Commits

Author SHA1 Message Date
xiaopeng bc02b7b600 add setErr
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>

Kubernetes-commit: 8839609868d4b2b5887eefdbb216c1ed5b848edc
2022-06-21 17:57:48 +08:00
xiaopeng a833054047 replace deprecated setoutput
Kubernetes-commit: 48629bcc0588773bc837d1cc69cab8b21a2057e0
2022-04-05 14:04:22 +08:00
Arda Güçlü cd97087d9c Add unit tests for explain command
Kubernetes-commit: 8eb50efefc8aea38fc63b79994561667c86c520c
2022-06-30 12:48:32 +03:00
Lee Verberne f713c9d779 Fix error message in attach_test.go
Co-authored-by: Akanksha kumari <akankshakumari393@gmail.com>

Kubernetes-commit: 1dd3879da03b6a8cdef423c9fef096d1a4814448
2022-07-17 12:38:26 +02:00
Lee Verberne 3e07021378 Fix incorrect message when attaching to ephemeral containers
Kubernetes-commit: 8d4ec9ac9dcf45b66111075a1b67043c2885b263
2022-07-15 19:23:24 +02:00
R0CKSTAR 7557a35bb2 Resolve review comments
Signed-off-by: R0CKSTAR <yeahdongcn@gmail.com>

Kubernetes-commit: d9294dfff752636febcd9401696845c01a80c5f0
2022-07-13 08:44:07 +08:00
R0CKSTAR 443618def5 Add unit test - TestDescribePodRuntimeClass
Signed-off-by: R0CKSTAR <yeahdongcn@gmail.com>

Kubernetes-commit: b8ecf6fbfeab3f59f5bf3942f713c699501e8b60
2022-07-12 09:34:04 +08:00
R0CKSTAR d256c1b5ec Resolve review comments
Signed-off-by: R0CKSTAR <yeahdongcn@gmail.com>

Kubernetes-commit: fa9f2c409a7bea802048ea06e2266f13ff218e1d
2022-07-06 11:11:53 +08:00
R0CKSTAR 56244ad029 Print pod.Spec.RuntimeClassName in kubectl describe
Signed-off-by: R0CKSTAR <yeahdongcn@gmail.com>

Kubernetes-commit: ae31c0423f08e514a6bccca19d88afbff07f8d65
2022-07-01 16:24:37 +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
Marcus Puckett d9fb1ec8c6 Revert "Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster"
Kubernetes-commit: 5badb731a895dfa0a188a3f4aec2d3edfe709b12
2022-07-18 08:48:29 -07:00
hwdef 9a8c8e13e6 Update the Chinese translation of kubectl
Kubernetes-commit: 1c4387c78f0d48398efb0dcc3268fa156cdd8ffd
2022-06-13 19:08:27 +08:00
Dave Chen 1405be3f62 update ginkgo from v1 to v2 and gomega to 1.19.0
- update all the import statements
- run hack/pin-dependency.sh to change pinned dependency versions
- run hack/update-vendor.sh to update go.mod files and the vendor directory
- update the method signatures for custom reporters

Signed-off-by: Dave Chen <dave.chen@arm.com>

Kubernetes-commit: 857458cfa5b0083bc55736aaccbcf1dc796ba320
2022-03-29 14:12:12 +08:00
Arda Güçlü 9a8dad8efc Change error messages
Kubernetes-commit: e41f2a1d7c06a1fd49bc5055fba7e0437ecaec0e
2022-07-07 15:05:17 +03:00
Arda Güçlü bdaa26ce9e Validate dry-run and force flags can not be used same time in replace
This PR adds validation to check that `dry-run` and `force` flags
are not used at the same time. Because when `force` flag is set,
`dry-run` is discarded and objects are replaced already.

Kubernetes-commit: e389b2723e6af29a9f70509fe8ff6e5121c30681
2022-06-01 14:01:40 +03:00
Marcus Puckett 3c41b7369c Add cases for when --timeout=0 and tests
Kubernetes-commit: 61ebfdb2018b0dae4e364d0170610ccdec18b2c1
2022-07-01 16:49:31 -07:00
Marcus Puckett 533f9479cc Revert "Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster (#108086)"
This reverts commit 171431ca2c009c0a576fa288b7df892b59299389.

Kubernetes-commit: a6bd1e6ac90f3ccbbe527e44e3217a8420636c41
2022-07-01 13:45:18 -07:00
Marcus Puckett 2e38f74bcc Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster (#108086)
* move to using informers for getObjAndCheckCondition

* move to using informers for IsDeleted

* update tests to handle new informer methodology

* set minimum timeout to 1s because informer can't handle less for caching reasons

* fix null return for deletes issue

Kubernetes-commit: 171431ca2c009c0a576fa288b7df892b59299389
2022-06-30 20:54:29 +00:00
Arda Güçlü 477b1e041a Add license header into rollout status test file
Kubernetes-commit: ab15419356a47112492b04ad6434bec30c827a11
2022-06-13 16:03:37 +03:00
Arda Güçlü 195784dabe Add unit tests for rollout status command
This commit makes adjustments in rollout status command to make it
unit testable. In addition to that, unit tests for rollout status
command is added.

Kubernetes-commit: f21e5983a95ab4e72aa0ddd9ae465a613490b422
2022-06-13 15:10:26 +03:00
Arda Güçlü bdb13380d9 Enable resource builder flattening in rollout status
Kubernetes-commit: 26002596b2f078ad9c151ba477b1cfa61f883df3
2022-06-06 10:29:13 +03:00
Arda Güçlü f95d534f9d Move resource lookup into its own function
Kubernetes-commit: 66c2f6069ebbfa41d0bef0f3959abda59b8483f1
2022-06-28 09:30:06 +03:00
Arda Güçlü df792c788b Use error wrapping in patchSimple
Kubernetes-commit: 22b43d4edbee4f89984d1b905adb1f905f3ab90b
2022-06-22 10:22:27 +03:00
Arda Güçlü b19c7e78f3 Move getPatchType logic back to main function
Kubernetes-commit: 4ed5653a0bc8ca53ca6a917e634457bd7a2d8dae
2022-06-22 09:35:49 +03:00
Arda Güçlü 351ebce2c4 Stop passing source as parameter
This commit removes passing source field as parameter. Instead,
this commit returns error verb and error functions to caller function.
Caller function can add source field by generating correct message.

Kubernetes-commit: d336f7df874dc978ebd97971e1fc93d891c21e7d
2022-06-20 10:04:18 +03:00
Arda Güçlü 2ca41173d3 (kubectl apply): Split patching types into functions and refactorings
Patch type determination is done by checking existence
of resource in schema and if it exists, it uses strategic merge patch.
Otherwise, like for CRDs, it uses merge patch type.

Currently, this code portion is not easily extensible and this PR
splits required checks into their own function to increase extensibility.

Kubernetes-commit: 15512210e3e14b0c827d13334394d658dc7ddc88
2022-06-16 11:12:17 +03:00
21kyu 0bf778323e Change reflect.Ptr to reflect.Pointer
Kubernetes-commit: df168d5b5c2dab7414fc00ead1a51257ec326a98
2022-06-26 01:23:43 +09:00
Brian Pursley 7a7b2a177c Remove unused flags from kubectl run
The following flags, which do not apply to kubectl run,
have been removed:
--cascade
--filename
--force
--grace-period
--kustomize
--recursive
--timeout
--wait

These flags were being added to the run command to support
pod deletion after attach, but they are not used if set, so
they effectively do nothing.

This PR also displays an error message if the pod fails to be
deleted (when the --rm flag is used).  Previously any error
during deletion would be suppressed and the pod would remain.

This PR also adds some unit tests for run and attach with and
without the --rm flag.  As such, some minor refactoring of the
run command has been done to support mocking dependencies.

Kubernetes-commit: 25e713ba777ec1158fad749e9467601526ba096a
2022-06-21 10:51:30 -04:00
Maciej Szulik 6707e9d96c Improve run and debug attach message upon failure
Kubernetes-commit: 43c2ae479f056f9e420062e11f3251b7095c3108
2022-06-24 09:07:44 +02:00
Arda Güçlü ec010ddaa3 Remove redundant validateFlag checks
Kubernetes-commit: 5b274249400157028f1d9107b6bbd0686be2c076
2022-06-13 10:06:51 +03:00
Arda Güçlü aa46caeecd Define NoOptDefVal for validate flag
validate flag does not have default value defined when there is no
parameter passed, therefore it tries to use next irrelevant flag.

This PR defines NoOptDefVal for validate flag which is set "strict".

Kubernetes-commit: 0245e74590a658ea911f1e5cacd270960883af2d
2022-05-06 10:25:40 +03:00
Davanum Srinivas 29180f31b7 Adapt to newer APIs
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: feca7983b77be3d7d578f3d5b64cbb1be6f327af
2022-06-10 17:23:47 -04:00
Davanum Srinivas 4bf64b9877 Switch to v1.0.2 of github.com/chai2010/gettext-go
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1ff96ede747639dbb1c7778befc79c48410e470c
2022-06-10 16:07:52 -04:00
Abirdcfly 3215e635ee update kubectl api-resources help info
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 58043b936aa9332deeecd57a7f48177bd05bd755
2022-06-06 10:21:17 +08:00
Daniel Helfand 76bcd89a57 include powershell in short description for kubectl completion
Kubernetes-commit: 67e692d521a5904aaaea446fd1642d2696cab61f
2022-05-03 20:56:41 -05:00
Dave Chen e0318c203f Remove `newlineReporter` custom report
The `newlineReporter` intends to print a new line after the test to
prevent the something print to the stdout and mess up the test result
while cause the tool like `go-junit-report` fail to parse the result.

But this is no longer needed based on following evidence.

- The issue that was first introduced in `go-junit-report` has already fixed in the version
referenced in `go.mod`.
- The `newlineReporter` report doesn't fix anything for `Ginkgo` v1 or V2 or `go test`, it just prints a
new line before the test summarization.

Signed-off-by: Dave Chen <dave.chen@arm.com>

Kubernetes-commit: 9953dde65dfaede9f1d481296053adc301ad9773
2022-06-01 13:09:47 +08:00
Dave Chen bdd48ac8f1 Fix the naming of the test suites
Signed-off-by: Dave Chen <dave.chen@arm.com>

Kubernetes-commit: 3c594d61567fc3cd5ef196a1419be957cdfaa5e1
2022-06-01 13:03:59 +08:00
Jian Zeng f125772691 feat(kubectl): add debug profile applier
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>

Kubernetes-commit: fd0c15cce3d66bc2b32fc6943688425ec269d97d
2021-11-12 00:57:02 +08:00
jlsong01 ec9d0484e5 add a warning printer in cli-runtime to coordinate warning style
modified:   staging/src/k8s.io/kubectl/pkg/cmd/auth/auth.go

Kubernetes-commit: 272e245f06e425fc912b1e477e8b6763850b161e
2022-02-18 20:33:38 +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
Brian Pursley 0c3ff4c860 Add unit tests for completion command
Kubernetes-commit: a8ec462e6fdbceb0a0e96446511b8b7e5e4b7781
2022-05-14 11:12:00 -04:00
Brian Pursley 96f0c72304 Add unit tests for api-resources and api-versions commands
Kubernetes-commit: 13e0120bf0662c4530df2badf1f8f73426cf9e51
2022-05-14 11:06:49 -04:00
xin.li 8207383170 update kubectl doc url
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: e89a87f708a03c5a8331639739982d426077ad3a
2022-05-05 21:27:52 +08:00
Philip Ottesen 13c8d95987 kubectl rollout: support recursive flag for rollout status
Kubernetes-commit: 9d8286c82ca3c79d68d36c58e69d91cbb7032b2c
2022-03-17 15:41:10 -04:00
Kazuki Suda 08a1f36bc3 Fix discovery cache TTL to 6 hours
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>

Kubernetes-commit: d2b4c017c8c4103199a4f85ba63fd3ab659f5f42
2022-05-09 12:22:43 +09:00
Maciej Szulik aa2aec18b6 Export function returning kustomize version
Kubernetes-commit: 8074ef58677ed41468fe82ee89f020c481c6c33b
2022-04-12 11:01:08 +02:00
Arda Güçlü 02b163261f Show topologySpreadConstraints in Describe command
Currently describe command does not show `topologySpreadConstraints`
field. This PR adds support for showing topologySpreadConstraints in
describe command.For simplicity, if this field is not set, it will not show
(unlike to other core fields whose are shown as `<none>` even if they are null).

Kubernetes-commit: 64ce73f5fe2f095ba751d78aa03cf48bca42c055
2022-04-20 15:37:02 +03:00
Paco Xu 266e17f8a6 remove deprecated kubectl.kubernetes.io/default-logs-container support
Kubernetes-commit: 3a9c6f2a2f59cb05fc505f66afe2bd923a0d9f58
2022-04-02 16:40:34 +08:00
Mayank Kumar 884f866fd0 add maxunavailable to kubectl describe
Kubernetes-commit: c352fa514655bd154e69734e365477e753fa3409
2022-04-01 20:25:36 -07:00
Shubham Kuchhal e767a9773e Update rs.extensions to rs.apps
Kubernetes-commit: ce17a027477efd933775e320b1ce6c3876c136c3
2022-03-29 16:40:28 +05:30