Commit Graph

1259 Commits

Author SHA1 Message Date
Brian Pursley 70109f0921 Prefer pods without a deletion timestamp over pods with a deletion timestamp when getting an ordered list of active pods.
This allows commands like kubectl port-forward, when used with deployments, to avoid selecting a pod that is terminating (due to a rollout, for example).

Kubernetes-commit: d281daee335dc3b2aa67fb3128f00d7d2f5f7d91
2023-07-18 08:31:37 -04:00
Arda Güçlü 042ec77890 Remove KUBECTL_EXPLAIN_OPENAPIV3 environment variable
Since explain openapiv3 has been moved to beta already, there is no
point to having this environment variable.

This PR removes it.

Kubernetes-commit: 4d8f569b037d2979c1d9c5825e5227aadfc8077f
2023-07-13 13:37:03 +03:00
Arda Güçlü 7e050c1e1d kubectl delete: Introduce new interactive flag for interactive deletion (#114530)
Kubernetes-commit: 3267dd9d5294893580538e98c1e410f64583c0cd
2023-07-11 16:05:11 +03:00
Maciej Szulik e0816cbaa1 Remove long/golang version information making short the default
Kubernetes-commit: 3f07fc3acc9014f33fb9bbde12937b35e3f48c75
2023-03-17 15:20:56 +01:00
aimuz 2ec2847518 fix: kubectl expose fails for apps with same-port, different-protocol
Fixed: https://github.com/kubernetes/kubernetes/issues/114402
Signed-off-by: aimuz <mr.imuz@gmail.com>

Kubernetes-commit: e5116a39c96a78511fc8c0da4730d3262b2c121c
2023-06-19 09:58:54 +08:00
minherz bd48fd4c16 chore: address review feedback
add integration test to wait for json without value
refactor JSON condition value parsing and validating
adjusting test to reflect the error message refactoring

Kubernetes-commit: dbdd861ea366af50fb74983426587dad7222cb89
2023-06-29 00:36:07 -07:00
minherz baf5b1c999 chore(fix): test jsonpath condition parsing errors
Test parsing logic for invalid JSONPath condition formats,
excluding JSON path expression parsing.
Fix error in parsing logic

Kubernetes-commit: a5c4fbe979188335f4f414a1aef303f1c0f353f6
2023-06-03 21:40:16 -07:00
minherz 0c921b2f35 Support JSONPath condition without value
Extend current JSONPath condition logic to return from wait on "any" value.
Change parsing JSONPath input to support the syntax without value.
Match any simple or complex (object or array) values.

Kubernetes-commit: 9d3e55ec431f3f595a7739fcc592602f7cc1d69b
2023-05-21 19:03:24 -07:00
Mauren Berti 03a51b01e7 Update the template.pot file with latest message IDs.
Update the template.pot file with the current state of the messages in kubectl. That allows localized messages to be updated accordingly and picked up correctly.

Kubernetes-commit: dfce076c6cf0ad8f7a896a87c07143c63e2d67bd
2023-06-27 12:10:46 -04:00
Frederic Branczyk eca0d6a8b1 kubectl: Allow parallelizing diffing
Kubernetes-commit: 1cfb932111e53e296a3b0f001b6f5d03f212f32f
2023-06-05 13:18:49 +02:00
Varsha Prasad Narsing a49f0e6d53 [refactor] refactoring flags and options in Expose cmd
This PR decouples the command options from the input flags.
The input flags from the command are then translated to
options which are further used while running the command.

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>

Kubernetes-commit: 8f229057484453bd1b820d00c940efbbc56addc5
2023-05-05 11:31:03 -04:00
Filip Křepinský 138a1cc87a kubectl explain should work for both cluster and namespace resources and without a GET method
Kubernetes-commit: 7f4c187ab26fc8b96a091068ee9c84fa447b9291
2023-06-26 18:39:28 +02:00
Ritikaa96 d5606514d9 Adding review changs to update
Kubernetes-commit: fff5b35023b2b9cd9ec681e188c077225d1293a3
2023-06-16 16:33:07 +05:30
Ritikaa96 13f1a1e448 Updated kubectl explain help output
Kubernetes-commit: e213448db12abb91450028c89a9e8330d693a110
2023-06-14 12:33:18 +05:30
Ritikaa96 26d4d62bb1 Details added in kubectl explain help
Kubernetes-commit: 8c06ca68d7d3a286425ab89bcafb109e83199a94
2023-06-13 17:01:46 +05:30
Vihang Mehta 64086544bc [bug] Update DefaultObjectDescriber to handle interface params (#118190)
* Update DefaultObjectDescriber to handle interface params

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

* Minor test cleanup for more descriptive errors

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

---------

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Kubernetes-commit: 56cb4c93918efdc6e05f1c8f011166734fbe8a2f
2023-06-21 21:46:02 +00:00
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
carlory f4c3a1c36a fix Cronjob status.lastSuccessfulTime not populated by a manually triggered job
Kubernetes-commit: f2a64cb91d7cf7216db60c2e1c8b1e530c85f94f
2023-06-07 19:01:51 +08:00
Devesh Goyal 03e1b53324 Update k8s.po
Fixed typo mistake

Kubernetes-commit: 0789bbe9f7acdaf0f2c203aef1da292358842f09
2023-05-21 19:33:33 +05:30
Mihai Costea 900a7ab781 Remove StartupProbe on debug with pod copy
Kubernetes-commit: ea6495e8284b7eccd292c67e21a32081c4a29967
2023-06-07 15:40:10 +03:00
TommyStarK e88f1b3589 kubectl: use bytes.Buffer.String
Signed-off-by: TommyStarK <thomasmilox@gmail.com>

Kubernetes-commit: da4a8d831b933475cfdb20cb7e6d0ed027d516eb
2023-06-04 15:45:24 +02:00
Jefftree 6d49571c40 Update gnostic references
Kubernetes-commit: 2111e79f56acdfa6a8dab56780c52e3abc608758
2023-06-01 18:25:39 +00:00
LronDC 22b4cf895f Optimize usage message of commands which have subcommands.
Signed-off-by: LronDC <lun.su@daocloud.io>

Kubernetes-commit: 15678e4a67e1b725368ca1bd3a97b670c5d97776
2023-05-10 18:10:28 +08:00
Marly Puckett 7d67323db1 Add more tests that should exist but don't for some reason
Kubernetes-commit: b7cdbca2374610f2122c6a8efde2806030da8338
2023-02-13 10:30:41 -08:00
Marly Puckett 9ae9023ede Add tests
Kubernetes-commit: 5dca1be0160f5b5cb3c85b2ab44d569290eaa1f4
2023-02-11 15:10:56 -08:00
Marly Puckett 2d86c3a191 Add jsonpath support for explain
Kubernetes-commit: bab2c18c2463f51d593b0878d57d42a2844748e5
2023-02-11 15:10:40 -08:00
HirazawaUi 08300912da fix fd leaks and failed file removing for pkg kubectl and pod-security-admission
Kubernetes-commit: b94c6daa0b7602e2d30e35cf2b94f9d1e8fde56e
2023-05-03 01:36:46 +08:00
Stephen Kitt cfd2169f88 cli: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 45836971f27ca70cd7742e8ee66e99e3c648cf9f
2023-03-14 16:17:48 +01:00
Keita Mochizuki f118a887e5 Fix: Restricted profile comply with PSS (#117543)
* restricted profile comply with PSA v1.27

* add test case

* Reflect review comments

* Reflect review comments 2

* Reflect review comments 3

Kubernetes-commit: 0813904404034fd760d8e7e1e3ca5444610a7fa8
2023-05-24 20:16:49 +09:00
Arda Güçlü a9dd2e4bec Preserve code blocks in templates.Normalizer (#118029)
* Preserve code blocks in templates.Normalizer

Currently, if templates.LongDesc function is invoked multiple times
for a string including a code block, this code block is converted to
invalid code block.

The reason of this issue is that blackfriday package, which templates package uses, relies on
4 * indentation to detect code blocks. This PR always preserves
4 * indentation in code blocks to always detect it code blocks in also
post invocations.

* Add indentations to test for code blocks

* Use strings.repeat for repetition

Kubernetes-commit: 0bff705acd8982e34b937116eb2016c9d6e4c4a6
2023-05-24 09:20:49 +03:00
Brian Pursley 3418528213 i18n: Fix bug where package-level variables are not translated.
The call to `i18n.LoadTranslations` needs to occur on init so
that package-level variables that call `i18n.T()` to initialize
their values will be able to receive the translated string.

Added new integration tests to test help output translation.

Kubernetes-commit: 34d980e77090d065199e9e808f8aebf6ba2db72c
2022-11-21 22:48:42 -05:00
Filip Křepinský a71362e506 rename err to lookupErr
Kubernetes-commit: bafae5c0764a222e336de1d7ce2645186bb455dd
2023-05-15 16:41:54 +02:00
Filip Křepinský 3ebdc043ce fix false positive kubectl plugin unit tests
- test.args should be passed instead of the os.Args of the test framework
  to prevent simple invocation of kubectl without args that could
  manifest in false positive test runs
- plugin execution should have a different test path
- tests should invoke functioning kubectl commands instead of the mock
  ones to ensure the correct subcommand is executed without a failure

Kubernetes-commit: 8b9cbe62025da49a31518870f2aea0ce9797d3ce
2023-05-11 20:12:38 +02:00
Vihang Mehta d3fd4ea37b Sort and limit to the describers the return (string, error)
Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Kubernetes-commit: 885f3d7a7dfe4eb09bef86bbeb49499ec3ff2bae
2023-05-17 16:36:46 +00:00
Vihang Mehta 6f146fb23f Add all describers to the exported DefaultObjectDescriber
Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Kubernetes-commit: 2cb215e1091fb50a152afca3a8b2166d47f996ee
2023-05-05 18:30:54 +00:00
adil ghaffar 76565cfba8 Changing annotate PrintFlags from annotate to annotated
Kubernetes-commit: d6e488b998effbda9675d4dc3d297a142a4079f7
2023-05-16 14:39:15 +03:00
Arda Güçlü 1fecf3ab58 Simplify plugin resolution check function
Kubernetes-commit: daebf1c735df845f5e8429381593a4de1762361e
2023-05-15 08:51:46 +03:00
Arda Güçlü f53c5f479c Use getter function for plugin subcommand resolution
Plugin subcommand resolution is relatively less used than the
builtin subcommands. That's why, instead always initializing a
hash map on memory, it would be better to use a getter function only
serves as needed.

In addition to that this function will be exported that external
libraries can use it.

Kubernetes-commit: 4634073d0b979d2827106a0a1010456ac420baa8
2023-05-10 10:41:43 +03:00
guiyong.ou daae148e73 fix:translations zh_CN LC_MESSAGES k8s.po error
Signed-off-by: guiyong.ou <guiyong.ou@daocloud.io>

Kubernetes-commit: 3a394bbeadac06224f534a99041929e3f9a0e07c
2023-05-10 18:13:28 +08:00
gxwilkerson33 1b129f017b add no resources found message to rollout-status command (#117884)
* add no resources found message to rollout-status command

* return err if not nil before no resource message

Kubernetes-commit: a5575425b039bf7c15dfaa9a7acf257fdc4fde3f
2023-05-11 23:28:58 +00:00
Chris Bandy 1815b0e2ef Cleanup environment in tests that call os.Unsetenv
testing.T.Cleanup ensures the environment is restored after a test and
any of its parallel sub-tests. It's possible that some of these can be
simplified further to T.Setenv(key, ""), but I did not investigate.

Kubernetes-commit: e8d3a4a105cc8ea6e795e24d5dbf0c61ed78cacd
2023-04-15 11:19:24 -05:00
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
m.nabokikh deeeaea2a7 KEP-3325: Promote SelfSubjectReview to GA
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: 40de26dcff80f29380a4ba90a93ce3ece7482b78
2023-05-02 01:26:20 +02:00
charles-chenzz 0d2299217d reduce util pkg for testing in tempdir.
Kubernetes-commit: aaa30439bdda1589eacc7be8547c297a73e346b9
2023-04-18 11:18:10 +08:00
Brian Pursley 198d4bdc32 Fix typo in kubectl api-resources help text for --categories flag
Kubernetes-commit: 6d8a0100f70f2df61340bd52385841c5df7bda58
2023-04-25 20:26:10 -04:00
aditya-K2 9ce8f5e1fc Remove repeated info
Kubernetes-commit: 28ac914bc54a946188b98254dfe85a0d721e22f5
2023-04-24 10:22:08 +05:30
aditya-K2 c60b12df3a Move info where its most relevant
Kubernetes-commit: e0d5c4aa93e6279979a60db5c8357799c2d54a8f
2023-04-08 00:27:13 +05:30
aditya-K2 06bf9e7cc8 Update `kubectl edit` documentation
kubectl defaults to /bin/bash if the SHELL environment variable isn't
set. Updating the docs to mention that you can override the shell
location by setting the SHELL environment variable.

Kubernetes-commit: 0a508ad8067dcc8d48420daca536fca09df5846b
2023-03-13 00:01:39 +05:30
Antoine Pelisse 2c4bec21e5 openapi: Make file client more easy to re-use
A few notes about the change:
1. I need to initialize the fileclient once, in an init function, so I
don't have access to `testing.T` yet.
2. I want to be able to configure the openapi files that I use
3. We already have a "cache" client that wraps another client, we don't
need to re-implement caching here, one can just do:
`cache.NewClient(openapitest.NewFileClient("some/path"))` to do a cached
client. Or initialize it in an init/global var.

Since there is still some value to use the embedded file, make an
alternative constructor while using fs.FS interface to be able to
manipulate both virtual and disk-based filesystems.

Kubernetes-commit: 29503fd8d45bc2c9438e92936bf4111162529b40
2023-03-28 13:40:28 -07: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