Commit Graph

287 Commits

Author SHA1 Message Date
jlsong01
272e245f06 add a warning printer in cli-runtime to coordinate warning style
modified:   staging/src/k8s.io/kubectl/pkg/cmd/auth/auth.go
2022-05-23 19:10:15 +08:00
Davanum Srinivas
f7ad09c447
Switch to pause 3.7
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-03-29 15:36:38 -04:00
Kevin Delgado
b0f3b5a796 Adjust validation checks to pass for both client-side and server-side validation 2022-03-26 03:45:13 +00:00
Kevin Delgado
0bb1a32411 Expand newly created cmd-test
Modify newly created cmd-test to work for both
client-side and server-side validation
2022-03-26 03:45:13 +00:00
Kevin Delgado
fe3772890f add server-side validation support to kubectl 2022-03-26 03:45:13 +00:00
Kubernetes Prow Robot
d58f42961c
Merge pull request #99556 from nikhita/kubectl-subresources-01
kubectl: support --subresource flag
2022-03-24 23:43:50 -07:00
Katrina Verey
44e63e8ff8
kubectl version should include bundled kustomize version 2022-03-24 13:31:57 -04:00
Yuvaraj Kakaraparthi
a5aa858d44 kubectl: add --support to get, patch, edit and replace commands
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>
2022-03-24 09:49:12 +05:30
Kubernetes Prow Robot
19935de5a9
Merge pull request #107410 from margocrawf/master
Ensure static certs in kubeconfig override exec plugin
2022-03-08 11:34:21 -08:00
Margo Crawford
f015fd66ce Check whether static cert is already configured in UpdateTransportConfig
- Also update test-cmd.sh to pass a signing ca to the kube controller
  manager, so CSRs work properly in integration tests.

Signed-off-by: Margo Crawford <margaretc@vmware.com>
2022-03-07 13:54:32 -08:00
Eddie Zaneski
040d575e9f
Update sig-cli OWNERS
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
2022-02-14 10:55:35 -07:00
Kubernetes Prow Robot
39931456db
Merge pull request #107740 from brianpursley/legacy-script-fixes
legacy-script.sh fixes - junit output and add missing record_command
2022-02-03 17:34:00 -08:00
brianpursley
e120f11438 Change legacy-script.sh to produce junit output in location set by the
ARTIFACTS environment variables if KUBE_JUNIT_REPORT_DIR is not set.

Add missing record_command to a couple of tests in legacy-script.sh.

Fix some typos in /test/cmd/README.md
2022-02-02 21:51:15 -05:00
Arda Güçlü
43d8b3459b Add manually invalidate cache documentation into delete
When CRDs are deleted, discovery local cache is not invalidated.
This brings about `resource not found` error when new CRD with same name is created
with different fields(ie. changing scope from cluster-wide to namespaced).
Because this already deleted CRD still stays in serverresources.json and kubectl tries to use it.

This local cached files have 10 minutes TTL. After deletion, if user waits 10 minutes,
files will be expired and deleted and there will be no errors. However, 10 minutes is a long time
and cache needs to be invalidated after deletion occurs.

This PR adds a document into delete command by noting that there might be a need to invalidate discovery
cache when CRD is deleted. In addition to that this PR adds a test to catch this behavior.
2022-01-26 09:01:46 +03:00
Kubernetes Prow Robot
8f453c9d79
Merge pull request #107044 from pohly/cli-invalid-command
cli: avoid logging command line errors in more cases
2022-01-11 09:46:37 -08:00
Patrick Ohly
798bdab3d0 kubectl: add integration test for result reporting
This currently covers two cases:
- "kubectl list" (the regression from https://github.com/kubernetes/kubernetes/issues/107012)
- "kubectl get pods/no-such-pod" (no particular reason except that the output
should be deterministic)

In contrast to some other tests that check for strings inside the
output (run_deprecated_api_tests) or compare after
sorting (run_kubectl_version_tests), stdout, stderr and the return code must
match exactly.

This ensures that there is no extra, unexpected output and that the right
output stream is used.
2022-01-11 09:04:56 +01:00
Patrick Ohly
a5d2d6fec3 cli: let kubectl handle error printing
cli.Run was an attempt to elliminate error handling in Kubernetes
commands. However, it had to rely on heuristics that are not necessarily right
for all commands.

kubectl is one example which has its own error printing code that should be
used in all cases after a command failure. It now gets used also for
`--warnings-as-errors`. Previously, that caused the following message to be
logged at the end:

  E0110 16:56:01.987555  202060 run.go:120] "command failed" err="1 warning received"

Now it ends with:

 error: 1 warning received
2022-01-10 17:09:30 +01:00
Kubernetes Prow Robot
c83a94da72
Merge pull request #107003 from julianvmodesto/dry-run-values
Re-introduce removed kubectl --dry-run values.
2021-12-14 03:15:46 -08:00
Julian V. Modesto
cc4998b2b1 Re-introduce removed kubectl --dry-run values.
For 1.23, we removed the kubectl `--dry-run` empty default value (`--dry-run`)
and boolean values (`--dry-run=true` and `--dry-run=false`). This change
required requiring users to specify `--dry-run=client` or `--dry-run=server`
due to a deprecation. This change was made in #105327.

After reconsideration, this change is not worth the churn for users.
It's likely that many users rely on these values for automated and manual use
cases.

This change reverts #105327 and re-introduces the values `--dry-run`,
`--dry-run=true`, and `--dry-run=false`.
2021-12-13 15:04:49 -05:00
Kubernetes Prow Robot
e53f93c7bb
Merge pull request #105164 from ardaguclu/kubectl-diff-prune
Introduce new prune parameter into diff command
2021-12-13 11:31:58 -08:00
Davanum Srinivas
9405e9b55e
Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-09 21:31:26 -05:00
wangyysde
d2abddd909 rename v2beta2 to v2
Signed-off-by: wangyysde <net_use@bzhy.com>

Generation swagger.json.

Use v2 path for hpa_cpu_field.

run update-codegen.sh

Signed-off-by: wangyysde <net_use@bzhy.com>
2021-11-09 10:34:54 +08:00
Arda Güçlü
34f0148414 Add prune test into test/cmd/diff.sh 2021-11-08 19:53:47 +03:00
Kubernetes Prow Robot
c9baa14d70
Merge pull request #105794 from margocrawf/master
--as-uid flag in kubectl and kubeconfigs.
2021-11-08 07:03:13 -08:00
Margo Crawford
7e079f5144 --as-uid flag in kubectl and kubeconfigs.
This corresponds to previous work to allow impersonating UIDs:
* Introduce Impersonate-UID header: #99961
* Add UID to client-go impersonation config #104483

Signed-off-by: Margo Crawford <margaretc@vmware.com>
2021-11-05 13:23:49 -07:00
Kubernetes Prow Robot
82da9bdaab
Merge pull request #105076 from pohly/log-flush-frequency-bug
initialize logging after flag parsing + refactor commands
2021-10-01 14:30:18 -07:00
Patrick Ohly
1957fb6508 command lines: harmonize command line parse error handling
The recommendation from #sig-cli was to print usage, then the error. Extra care
is taken to only print the usage instruction when the error really was about
flag parsing.

Taking kube-scheduler as example:

  $ _output/bin/kube-scheduler
  I0929 09:42:42.289039  149029 serving.go:348] Generated self-signed cert in-memory
  ...
  W0929 09:42:42.489255  149029 client_config.go:620] error creating inClusterConfig, falling back to default config: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
  E0929 09:42:42.489366  149029 run.go:98] "command failed" err="invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"

  $ _output/bin/kube-scheduler --xxx
  Usage:
    kube-scheduler [flags]

  ...
       --vmodule moduleSpec
                  comma-separated list of pattern=N settings for file-filtered logging

  Error: unknown flag: --xxx

The kubectl behavior doesn't change:

  $ _output/bin/kubectl get nodes
  Unable to connect to the server: dial tcp: lookup xxxx: No address associated with hostname

  $ _output/bin/kubectl --xxx
  Error: unknown flag: --xxx
  See 'kubectl --help' for usage.
2021-09-30 13:46:49 +02:00
Kubernetes Prow Robot
bac45abf77
Merge pull request #105327 from julianvmodesto/kubectl-dry-run-flag-removals
Remove deprecated kubectl --dry-run values.
2021-09-29 13:31:21 -07:00
Julian V. Modesto
e0b7a85ee5 Remove deprecated kubectl --dry-run values.
The boolean values for --dry-run have been deprecated for removal since
1.18, more than 2 releases.

The default value for --dry-run with the flag set and unspecified has
been deprecated for removal since 1.18, more than 2 releases.

Both values are now removed in this change. Any kubectl --dry-run
usage no longer accepts --dry-run=(true|false) boolean values and usage
now requires that a value of (client|server|none) is specified.
2021-09-28 10:21:04 -04:00
Claudiu Belu
18936d4785 updates pause image references
The pause:3.6 image has been published.

Also updates older / incorrect references.
2021-08-29 21:50:05 -07:00
Andrew Keesler
20e1c4d754
exec credential provider: update tests+metadata for v1
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-07-06 09:48:35 -04:00
Kubernetes Prow Robot
37da905c0c
Merge pull request #99310 from ankeesler/exec-plugin-interactive
exec credential provider: InteractiveMode support
2021-06-15 09:46:01 -07:00
Andrew Keesler
e427d2f22a
test/cmd: kubectl and exec plugins don't fight for stdin
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-06-15 09:01:18 -04:00
Kubernetes Prow Robot
36a19df91b
Merge pull request #102143 from wangyysde/promote-cronjob-integration
Promote cronjob integration test to batch/v1
2021-06-15 03:56:01 -07:00
wangyysde
558bdd18aa Update cronjob integration test to batch/v1
Signed-off-by: wangyysde <net_use@bzhy.com>
2021-06-04 21:04:21 +08:00
maruiyan
02bade4644 Fix a grammar error in doc 2021-05-28 11:48:29 +08:00
Chok Yip Lau
e43e9696cc Fixed sort-by not sorting Resources as expected 2021-05-25 21:37:52 -04:00
Sascha Grunert
b167fc24d7
Update pause image to v3.5
Update dependencies and the test images to use pause 3.5. We also
provide a changelog entry for the new container image version.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-05-25 09:04:46 +02:00
Andrew Keesler
9dee2b95c2
exec credential provider: don't run exec plugin with basic auth
If a user specifies basic auth, then apply the same short circuit logic
that we do for bearer tokens (see comment).

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-05-21 13:51:03 -04:00
David Eads
ad0cff7b61 add --all-namespaces to kubectl annotate,label 2021-04-26 13:04:19 -04:00
Kubernetes Prow Robot
3061f6149f
Merge pull request #101171 from KnVerey/kubectl-describe-chunk-size
Add `--chunk size` flag to `kubectl describe`
2021-04-22 13:19:23 -07:00
Katrina Verey
8ad6fd6ddb Add --chunk-size support to kubectl describe 2021-04-21 11:44:15 -07:00
David Eads
2fb8420756 update test-cmd to avoid removed beta APIs 2021-04-19 10:06:37 -04:00
Katrina Verey
5200ff86d0 Add --chunk-size flag to kubectl drain 2021-04-12 08:10:52 -07:00
Kubernetes Prow Robot
f56a2c4118
Merge pull request #100562 from deads2k/beta-proxy-removal
use a non-deprecated API to check kube-proxy
2021-04-09 05:18:59 -07:00
David Eads
cbd762814f use a non-deprecated API to check kube-proxy 2021-03-25 12:41:50 -04:00
Katrina Verey
8bae3b449a Fix kubectl drain integration tests
These tests were not performing evictions because:
- Test pods were not on the test node (fixed with spec.nodeName)
- The test pods are unmanaged and require the --force flag to be evicted
  (added the flag)
- The test node does not run pods, which prevents pod deletion from
  finalizing (worked around with --skip-wait-for-delete-timeout)
2021-03-16 15:52:00 -07:00
Kubernetes Prow Robot
90851a0fb5
Merge pull request #99905 from BenTheElder/shellchecked
update verify-shellcheck to v0.7.1, fix nits, multi-arch digest pinning, fix new lint errors
2021-03-06 22:17:53 -08:00
Kubernetes Prow Robot
f8151b121f
Merge pull request #99732 from soltysh/clean_run_flags
Drop deprecated run flags and deprecate unused ones
2021-03-06 15:24:01 -08:00
Benjamin Elder
a0cd54a7f1 fix trivial shell quoting issues surfaced by shellcheck v0.7.1 2021-03-06 13:19:17 -08:00