Commit Graph

3445 Commits

Author SHA1 Message Date
Will Daly bfae4f6bfd kubectl: add unit tests for kubectl debug profiles
Unit test netadmin profile preserves existing capabilities.
Unit test debug profiles in TestGenerateNodeDebugPod
Unit test debug profiles in TestGeneratePodCopyWithDebugContainer
Organize Go imports in unit tests

Signed-off-by: Will Daly <widaly@microsoft.com>

Kubernetes-commit: 21e8d2958190e9813fe1122d1e7a91e8143a5193
2023-02-16 06:38:12 -08:00
Will Daly ffa6cc1628 kubectl: use pointer.Bool instead of deprecated pointer.BoolPtr
Signed-off-by: Will Daly <widaly@microsoft.com>

Kubernetes-commit: 4101b796063942fa2d7bb04e9252a4725a834c88
2023-02-16 06:35:23 -08:00
Kubernetes Publisher cd833457db Merge pull request #115712 from wedaly/kubectl-netadmin-debug-profile
kubectl debug: add netadmin profile

Kubernetes-commit: 6a5c88b9dd0a0e9ef0115d1bbcb196284777832b
2023-02-16 09:08:38 +00:00
Paco Xu c7d11433fb API docs: point to current docs instead of archived designs
Kubernetes-commit: 3d536bd14bba0586f20d1d96560073e5d9e82f97
2023-02-16 15:29:56 +08:00
Sean Sullivan add00720bf New openapi v3 testing file client
Kubernetes-commit: 195a55c84c1a0ba9dcc278cc1cccee320334d5e1
2023-02-15 11:37:08 -08:00
Kubernetes Publisher 20506dc2c7 Merge pull request #115786 from liggitt/net-0.7.0-master
Update golang.org/x/net to v0.7.0

Kubernetes-commit: b3d8ac8496a23d65a907f9333d906bcd5463764e
2023-02-15 15:20:04 +00:00
Kubernetes Publisher edf661f9c9 Merge pull request #115785 from liggitt/fix-kubectl-test
Revert "Refactor fake versions of openapi client into testing subdir"

Kubernetes-commit: 98406e2a3e88bd6a2affe5674b7a577aa0926d48
2023-02-15 07:27:13 +00:00
Jordan Liggitt 6453bd2a8f Update golang.org/x/net to v0.7.0
Kubernetes-commit: f8e00778ddca11c08117ccf1d1c410641c70c428
2023-02-14 23:14:30 -05:00
Jordan Liggitt a1aee20215 Revert "Refactor fake versions of openapi client into testing subdir"
This reverts commit 869da89eab37ce670759cea2c86325f36625e7fc.

Kubernetes-commit: f98944590058f936c7adb76ea2c974899a460fe2
2023-02-14 22:14:37 -05:00
Kubernetes Publisher 8bdb81f5e6 Merge pull request #115465 from seans3/openapi-client-testing
Refactor fake versions of openapi client into testing subdir

Kubernetes-commit: 08bbecb8e315fc976e35575e4e33c8a4a0e1cd28
2023-02-15 07:27:10 +00:00
Kubernetes Publisher 31af32762d Merge pull request #115722 from ardaguclu/restclientgetter-debug
kubectl debug: Use restClientGetter instead cmd.Factory

Kubernetes-commit: 281acc6a6bb22adae34fc49c906f4146d0870897
2023-02-13 23:20:06 +00:00
Arda Güçlü 6cb44356e3 kubectl debug: Use restClientGetter instead cmd.Factory
As the move towards using `restClientGetter` interface instead
gigantic `cmd.Factory`, this PR does that change.

Kubernetes-commit: f5b0d728c59fbcca571e4a21ca2f473149e72f03
2023-02-13 13:16:35 +03:00
Arda Güçlü c0da8f17bf kubectl debug: Initialize pod client and builder in complete
This PR initializes podclient and builder in complete function
instead run function.

Kubernetes-commit: d66b339868ea08ef4d3bda09fdf64abacaa3f41e
2023-02-13 13:03:50 +03:00
Arda Güçlü 2c98b95ac3 kubectl debug: Standartize add flag function
This PR standartize add flag function interface to align with
other kubectl commands.

Kubernetes-commit: 3ffdee7d2b2afb48d67828ac136f05ba9c6d8619
2023-02-13 12:36:18 +03:00
Kubernetes Publisher 7b99655ff3 Merge pull request #115594 from wking/included-failed-to-evict-pod-namespace
kubectl/pkg/drain: Include namespace in evictPods return error

Kubernetes-commit: cfa295f5691c6c406da667b6f9883dae714b1798
2023-02-13 07:12:56 +00:00
Kubernetes Publisher a08b3656df Merge pull request #111453 from ardaguclu/debug-support-files
(kubectl debug): Support debugging via files

Kubernetes-commit: 70dde8d746a07392d945dde32dd7e3b12ca9a043
2023-02-10 03:43:30 -08:00
Arda Güçlü 6bb46c3def Add explicitNamespace into ignore list in debug unit tests
Since, `explicitNamespace` is set by kubeconfig automatically, we can
safely add this field into ignore list.

Kubernetes-commit: c40f9f8bbb34d9bc58dbf8e6c7f664aacb0c5b91
2023-02-10 11:31:19 +03:00
Arda Güçlü 2d1cd8a4fc (kubectl debug): Support debugging via files
Currently `kubectl debug` only supports passing names in command line.
However, users might want to pass resources in files by passing `-f` flag like
in all other kubectl commands.

This PR adds this ability.

Kubernetes-commit: e0fedec69d494cf02ac99a83733d7d92f6cc0c51
2023-02-10 10:21:15 +03:00
Kubernetes Publisher c230e1b221 Merge pull request #115665 from aramase/aramase/f/update_vendor_k8s_utils
Update k8s.io/utils to `a36077c30491`

Kubernetes-commit: 9a51625ebebcc8345c851afc2b5cc98eb19ac193
2023-02-10 01:55:09 +00:00
Anish Ramasekar 0abb668640 Update k8s.io/utils to `a36077c30491`
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 09e02052fdf3d248368b3d05d5c922d616528c4c
2023-02-09 20:09:41 +00:00
Shang Jian Ding 04703e5d61 Implement kubectl debug profiles: general, baseline, and restricted (#114280)
* feat(debug): add more profiles

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>

* feat(debug): implment serveral debugging profiles

Including `general`, `baseline` and `restricted`.

I plan to add more profiles afterwards, but I'd like to get early
reviews.

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>

* test: add some basic tests

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>

* chore: add some helper functions

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>

* ensure pod copies always get their probes cleared

not wanting probes to be present is something we want
for all the debug profiles; so an easy place to implement
this is at the time of pod copy generation.

* ensure debug container in pod copy is added before the profile application

The way that the container list modification was defered causes the
debug container to be added after the profile applier runs. We now
make sure to have the container list modification happen before
the profile applier runs.

* make switch over pod copy, ephemeral, or node more clear

* use helper functions

added a helper function to modify a container out of a list that
matches the provided container name.

also added a helper function that adds capabilities to container
security.

* add tests for the debug profiles

* document new debugging profiles in command line help text

* add file header to profiles_test.go

* remove URL to KEP from help text

* move probe removal to the profiles

* remove mustNewProfileApplier in tests

* remove extra whiteline from import block

* remove isPodCopy helper func

* switch baselineProfile to using the modifyEphemeralContainer helper

* rename addCap to addCapability, and don't do deep copy

* fix godoc on modifyEphemeralContainer

* export DebugOptions.Applier for extensibility

* fix unit test

* fix spelling on overriden

* remove debugStyle facilities

* inline setHostNamespace helper func

* remove modifyContainer, modifyEphemeralContainer, and remove probes

their logic have been in-lined at call sites

* remove DebugApplierFunc convenience facility

* fix baseline profile implementation

it shouldn't have SYS_PTRACE base on
https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/1441-kubectl-debug#profile-baseline

* remove addCapability helper, in-lining at call sites

* address Arda's code review comments

1 use Bool instead of BoolPtr (now deprecated)
2 tweak for loop to continue when container name is not what we expect
3 use our knowledge on how the debug container is generated to simplify
  our modification to the security context
4 use our knowledge on how the pod for node debugging is generated to no
  longer explicit set pod's HostNework, HostPID and HostIPC fields to
  false

* remove tricky defer in generatePodCopyWithDebugContainer

* provide helper functions to make debug profiles more readable

* add note to remind people about updating --profile's help text when adding new profiles

* Implement helper functions with names that improve readability

* add styleUnsupported to replace debugStyle(-1)

* fix godoc on modifyContainer

* drop style prefix from debugStyle values

* put VisitContainers in podutils & use that from debug

* cite source for ContainerType and VisitContainers

* pull in AllContainers ContainerType value

* have VisitContainer take pod spec rather than pod

* in-line modifyContainer

* unexport helper funcs

* put debugStyle at top of file

* merge profile_applier.go into profile.go

* tweak dropCapabilities

* fix allowProcessTracing & add a test for it

* drop mask param from help funcs, since we can already unambiguous identify the container by name

* fix grammar in code comment

---------

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
Co-authored-by: Jian Zeng <anonymousknight96@gmail.com>

Kubernetes-commit: d35da348c60a3c7505419741f2546ff8b0e38454
2023-02-09 11:18:22 -06:00
Kubernetes Publisher ddf00a2aef Merge pull request #110953 from Abirdcfly/220705
cleanup kubectl describe cronjob v1beta1 in 1.26

Kubernetes-commit: 19eddfc5675c3a9206e33333719bcf719bb99928
2023-02-09 14:57:08 +00:00
Paco Xu 0760d00522 archived design proposals are now moved to Design Proposals Archive Repo.
Kubernetes-commit: 019d2615af3f7fd0ed0d593ef9df348f6d85b204
2023-02-08 11:12:22 +08:00
W. Trevor King 7ad33aa9fe kubectl/pkg/drain: Include namespace in evictPods return error
And also in the terminating-namespace log output.  This makes it
easier to track down drain-blocking pods, without having to hunt
around in earlier logs for 'evicting pod ...' messages.  Before this
change, caller logs might look like:

  evicting pod {namespace}/{name}
  ...
  error when waiting for pod "{name}" terminating: global timeout reached: 20s

With this change, they will look like:

  evicting pod {namespace}/{name}
  ...
  error when waiting for pod "{name}" in namespace "{namespace}" to terminate: global timeout reached: 20s

Kubernetes-commit: b6318d4e5b9b8eb0d2e2d5a8568df14817733f26
2023-02-07 13:10:30 -08:00
Arda Güçlü df850bc339 Re-enable label selector
Kubernetes-commit: 6c346e6cc9fba23475f9b3600857ededdddc7429
2023-02-07 11:11:05 +03:00
Arda Güçlü 0ce25bf6ed Add integration test for diff --prune --selector
This PR adds new integration tests for `kubectl diff --prune -l` to
catch possible regressions in the future.

Kubernetes-commit: 6e8a1beda7eb036c2494840e7c82a49cbff1d827
2023-02-07 11:04:05 +03:00
Kubernetes Publisher e67364c45a Merge pull request #115379 from artemvmin/serial-mkfs
Add an option to limit the number of concurrent mkfs calls

Kubernetes-commit: 6eb008620cd0ee3501326ee003d47fbaf1fa5b52
2023-02-07 05:54:29 +00:00
Artem Minyaylov 74a067ea6e Update k8s.io/utils to latest version
Update all usages of FakeExec to pointer to avoid copying the mutex

Kubernetes-commit: f573e149423dc578284789fdff8eeb3c195b5ccf
2023-02-03 14:51:25 -08:00
Kubernetes Publisher 4a582d37a9 Merge pull request #115485 from SergeyKanzhelev/epmeneralContainersQoS
small comment the ephemeral containers are not accounted for the QoS …

Kubernetes-commit: c34ddb5054e50a39e75cfc2eb7c5ca4a2145f6e6
2023-02-03 17:42:27 +00:00
Sergey Kanzhelev 8890f6a4d9 small comment the ephemeral containers are not accounted for the QoS calculation
Kubernetes-commit: b517d640a418f30dbc3c5bd5eb4fe5e8e26ab231
2023-02-02 18:21:39 +00:00
Sean Sullivan e1a547bdf0 Refactor fake versions of openapi client into testing subdir
Kubernetes-commit: 869da89eab37ce670759cea2c86325f36625e7fc
2023-02-01 18:39:18 -08:00
Kubernetes Publisher 1126105b03 Merge pull request #115266 from pohly/gomega-update
dependencies: update gomega to v1.26.0

Kubernetes-commit: 6d17cb2051b3a9958ed3353df242312d85e75d43
2023-01-30 21:50:16 +00:00
Kubernetes Publisher 1683b2d704 Merge pull request #108835 from guettli/patch-2
Extend example to contain --as=...

Kubernetes-commit: 4198d66457d5147ff717bf4beae52c0ec8a5f7cf
2023-01-30 17:47:54 +00:00
Thomas Guettler b7f6852b36 Extend example to contain --as==...
Kubernetes-commit: 2b980b8c01dfa17c08a4357b185b684bf69aa86f
2023-01-29 19:39:58 +01:00
Kubernetes Publisher 3ec401449e Merge pull request #114550 from alexzielenski/apiserver/smd/update-kube-openapi
update kube-openapi dependency

Kubernetes-commit: df03edaf755f71a61f4f817ca374ebe3b6416270
2023-01-25 05:50:40 +00:00
Alexander Zielenski 3c71e2f30f update kube-openapi
Kubernetes-commit: 7641ff75412c1d8b547c4fa388d3901aeeda6948
2023-01-23 15:32:33 -08:00
Patrick Ohly 116ace9325 dependencies: update gomega to v1.26.0
If gomega.Eventually/Consistently run into a situation where it observes some
state of e.g. a pod which does not satisfy the condition and then further
polling fails with API server errors, gomega will report both the most recent
pod state and API error instead of just the API error.

Kubernetes-commit: aa1279b5eb79177f5351368d8d9159982b1bfb5e
2023-01-23 15:19:38 +01:00
Alexander Zielenski dd44b643a3 kubectl: alias plaintext-openapiv2 to old explain
Kubernetes-commit: 8249a827bda6c7921ea7efa3a15b11ab6807fec0
2023-01-19 14:43:31 -08:00
Alexander Zielenski a56d6d4a49 refactor factory to support fake openapiv3
Kubernetes-commit: 81dd9e3d2565f827dae34d6aac24cca690d840d1
2023-01-23 19:09:43 -08:00
Kubernetes Publisher e5d82f5403 Merge pull request #114976 from kidddddddddddddddddddddd/python3
use python3 in hack

Kubernetes-commit: 6b55f097bb2140381a58312aeede37fc76a0762e
2023-01-19 17:38:45 +00:00
Kubernetes Publisher c960e25eb9 Merge pull request #114936 from seans3/openapi-validation-refactor
Refactor validation files into pkg/validation

Kubernetes-commit: c02b7e7a819b76f1f509856b4094d2dbc25ce56c
2023-01-19 17:38:44 +00:00
Kubernetes Publisher 248be67094 Merge pull request #113637 from mikedanese/http-proxy
switch spdy round trip tests to simple http proxy

Kubernetes-commit: 0acf6dbf7c094b71291b9fd7f78d5385565aa97c
2023-01-19 02:56:04 +00:00
kidddddddddddddddddddddd 8052841e39 use python3 in hack
Kubernetes-commit: cb6a1886c0b662978a5830d9eea56efb75eaa37b
2023-01-11 11:45:42 +08:00
Sean Sullivan fca10494ce Refactor validation files into openapi/validation
Kubernetes-commit: 84b226409aa656fbacdcd633807dd0b04d1fb34e
2023-01-09 15:59:41 -08:00
Antonio Ojea 9be7ad1c53 kubectl describe IPAddress
Change-Id: I201c2980830058c92b66e2386bfe8bedd8f0dcd4

Kubernetes-commit: 53dbf1752b070dcfe11399b3dd874fa8616851b3
2023-01-02 15:27:05 +00: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
Will Daly 14a012bb21 kubectl debug: add netadmin profile
Add the netadmin profile from KEP 1441
https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/1441-kubectl-debug#debugging-profiles

Signed-off-by: Will Daly <widaly@microsoft.com>

Kubernetes-commit: f5095bf34dba15c702b4618bcd24aae6fc2f47b2
2022-12-15 09:22:52 -08: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
Mike Danese 18431dbb90 vendor: removed unused dep github.com/elazarl/goproxy
Kubernetes-commit: f61c4245c18724dcac88f0ad9f347e82bbb57cd7
2022-11-04 22:14:46 +00:00
Kubernetes Publisher 11b7602e84 Merge pull request #115129 from liggitt/gotools-1.20
bump honnef.co/go/tools to support go1.20

Kubernetes-commit: 106332252bdfa3a4e4ce7e01a3f389a0bb99d06a
2023-01-18 09:08:42 +00:00