Commit Graph

2456 Commits

Author SHA1 Message Date
Kubernetes Publisher e81d7c5df4 Merge pull request #106172 from pohly/log-kubectl-options-deprecation
kubectl: add deprecation notice to flag usage help

Kubernetes-commit: 2ee2b8cab0772e1d1ff0075a95609aa4a41a9d4c
2021-11-16 20:04:44 +00:00
Kubernetes Publisher 3bbec9b31e Merge pull request #106268 from philipatl/edit-json-merge-patch-fix
fix edit of non-registered custom API types

Kubernetes-commit: a4d5be8c220a50afa62203f04130f056fa2826cd
2021-11-16 16:02:19 +00:00
Kubernetes Publisher dd304ca4d8 Merge pull request #105776 from lauchokyip/addWaitJson
Add wait json

Kubernetes-commit: 6be67e860c39c65ee43c5a67ad9562d49a509ba8
2021-11-16 12:00:48 +00:00
Jiahui (Jared) Feng 76848c0ad5 generated: ./hack/update-vendor.sh
Kubernetes-commit: 73ffb492032896c1c87edfa1d85de5fc74bb526c
2021-11-15 15:54:59 -08:00
Kubernetes Publisher c85b44a120 Merge pull request #106389 from natasha41575/updateKust441
upgrade kustomize-in-kubectl to v4.4.1

Kubernetes-commit: 79fed540aa6b9579bc23f5f92707f9f61a8b1759
2021-11-13 00:41:43 +00:00
natasha41575 ebb96a5cfc upgrade kustomize-in-kubectl to v4.4.1
Kubernetes-commit: 5991d3ded009b3f71522394b4c729a5faf187efd
2021-11-12 10:57:32 -08:00
Kubernetes Publisher 8833384768 Merge pull request #106159 from soltysh/config_wrapper
Switch from arguments to an input structure for kubectl command

Kubernetes-commit: 763916aa2d7cca2f334037785e4d84136fdf6d11
2021-11-12 21:05:36 +00:00
Kubernetes Publisher aa3beb4b1c Merge pull request #104792 from matthyx/60140
make kubectl cp resume on transfer error

Kubernetes-commit: 82379431df22809dc9454d3b03c957a65e9ca3ff
2021-11-11 09:21:09 +00:00
Kubernetes Publisher 3c74027b5d Merge pull request #106317 from lauchokyip/fixOutput
Fixed nil pointer dereference

Kubernetes-commit: ad99a592f7399ba8b5a1676e11cbed4598806716
2021-11-11 09:21:07 +00:00
Kubernetes Publisher 4283db730d Merge pull request #106234 from jpbetz/cel-libs
Add wired off code for Validation rules for Custom Resource Definitions using the CEL expression language

Kubernetes-commit: 6b41d75794381487ef7204b016faa75e350a32b7
2021-11-11 09:21:05 +00:00
Chok Yip Lau aed179d9d5 Fixed nil pointer dereference
Kubernetes-commit: c337857673e60a44bbdbef9afcbce5b0245b81ec
2021-11-10 12:41:39 -05:00
Philip Hamer 7da3d10e34 fix edit of non-registered custom API types
Kubernetes-commit: e07a6c9e523c11509f3264ad1ef2ea381709a29c
2021-11-09 10:06:03 -05:00
Arda Güçlü ab3928acd9 Refactor diff/prune
This PR does some refactors for diff/prune;

- GetRESTMappings takes value array instead reference
- Move getObjectName into diff instead prune
- License, etc. changes

Kubernetes-commit: 6c449dd272c95f2aeb3bb77e67d312d8df21bd62
2021-11-08 11:22:10 +03:00
Daniel Lipovetsky 8e82388f5f Include Conditions in `kubectl describe namespace`
If a namespace deletion is blocked, finding the reason why can require
reading the Conditions on the namespace.

Currently, `kubectl describe namespace` does not include Conditions.
This change adds Conditions to the output. Example output:

```
Name:         example
Labels:       <none>
Annotations:  <none>
Status:	      Terminating
Conditions:
  Type                             Status  LastTransitionTime               Reason          Message
  ----                             ------  ------------------               ------          -------
  NamespaceDeletionContentFailure  True    Wed, 15 Jan 2014 00:00:00 +0000  example reason  example message

No resource quota.

No LimitRange resource.
```

Kubernetes-commit: eb6e8ce00a39c1c98146f3341f4336b90757ab13
2021-11-07 21:39:56 -08:00
Patrick Ohly dc8558e8e5 kubectl: add deprecation notice to flag usage help
Several klog flags were deprecated in Kubernetes 1.23, but that was not visible
in "kubectl options" because it does its own formatting without considering a
flag's deprecation string.

Now the output looks like this:

$ go run ./cmd/kubectl options
The following options can be passed to any command:

      --add-dir-header=false: If true, adds the file directory to the header of the log messages (DEPRECATED: will be
removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --alsologtostderr=false: log to standard error as well as files (DEPRECATED: will be removed in a future release,
see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --as='': Username to impersonate for the operation. User could be a regular user or a service account in a
namespace.
      --as-group=[]: Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir='/home/pohly/.kube/cache': Default cache directory
      --certificate-authority='': Path to a cert file for the certificate authority
      --client-certificate='': Path to a client certificate file for TLS
      --client-key='': Path to a client key file for TLS
      --cluster='': The name of the kubeconfig cluster to use
      --context='': The name of the kubeconfig context to use
      --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will
make your HTTPS connections insecure
      --kubeconfig='': Path to the kubeconfig file to use for CLI requests.
      --log-backtrace-at=:0: when logging hits line file:N, emit a stack trace (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-dir='': If non-empty, write log files in this directory (DEPRECATED: will be removed in a future release,
see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file='': If non-empty, use this log file (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file-max-size=1800: Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0,
the maximum file size is unlimited. (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-flush-frequency=5s: Maximum number of seconds between log flushes
      --logtostderr=true: log to standard error instead of files (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --match-server-version=false: Require server version to match client version
  -n, --namespace='': If present, the namespace scope for this CLI request
      --one-output=false: If true, only write logs to their native severity level (vs also writing to each lower
severity level) (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --password='': Password for basic authentication to the API server
      --profile='none': Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
      --profile-output='profile.pprof': Name of the file to write the profile to
      --request-timeout='0': The length of time to wait before giving up on a single server request. Non-zero values
should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
  -s, --server='': The address and port of the Kubernetes API server
      --skip-headers=false: If true, avoid header prefixes in the log messages (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --skip-log-headers=false: If true, avoid headers when opening log files (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --stderrthreshold=2: logs at or above this threshold go to stderr (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --tls-server-name='': Server name to use for server certificate validation. If it is not provided, the hostname
used to contact the server is used
      --token='': Bearer token for authentication to the API server
      --user='': The name of the kubeconfig user to use
      --username='': Username for basic authentication to the API server
  -v, --v=0: number for the log level verbosity
      --vmodule=: comma-separated list of pattern=N settings for file-filtered logging
      --warnings-as-errors=false: Treat warnings received from the server as errors and exit with a non-zero exit code

For comparison, pflag itself prints:

$ go run ./cmd/kubelet --help 2>&1 | grep -e --log-file
      --log-file string                                          If non-empty, use this log file (DEPRECATED: will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file-max-size uint                                   Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800) (DEPRECATED: will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)

Kubernetes-commit: 21bd4ae18b5a146c8ef6dff373732abdecf60d66
2021-11-05 09:34:25 +01:00
Maciej Szulik 19d74f894c Switch from arguments to an input structure for kubectl command
Kubernetes-commit: baab99d04cd4c4314525e19c14ec85a072161cb1
2021-11-04 16:29:08 +01:00
Maciej Szulik d89f23e807 Allow providing wrapper for client config
Kubernetes-commit: c5aea015c30735b0e64f8bbd41acd811782c1fe5
2021-11-04 16:14:27 +01:00
Tobias Klauser 7b07391a3a kubectl: remove unnecessary fmt.Sprintf
Directly use the %#v verb in fmt.Fprintf instead.

Kubernetes-commit: 169f1845fc29a9002645e0a4df9489fee1ae7128
2021-11-04 13:45:47 +01:00
Joe Betz 5b4ed8f104 Pin new dependency: github.com/google/cel-go v0.9.0
Kubernetes-commit: d73403dc12ad1d9576d65b5c65e30a87d17ad314
2021-11-01 14:08:09 -04:00
Kubernetes Publisher a450ebd59c Merge pull request #106181 from ulucinar/aru/consume-kube-openapi
Bump k8s.io/kube-openapi to commit ee342a809c29

Kubernetes-commit: f59b0a56c6ebc1a1891435ba5b094b9afe8c1c3c
2021-11-10 12:22:59 +00:00
Kubernetes Publisher dcaed3efc2 Merge pull request #105817 from yylt/edit
Fix edit command

Kubernetes-commit: bafa87c553b1ad2700eaa0b3808aa7c6b6ce1a90
2021-11-08 21:36:23 +00:00
Sai Harsha Kottapalli 8165f83007 Refactor Apply cmd to split flags from options (#102240)
* Refactor Apply cmd to split flags from options

* refactor code

* fix subcommands

Kubernetes-commit: 17919b184153b2d123a7c75f5b0dc7e486a724db
2021-11-08 17:17:08 +00:00
Kubernetes Publisher 3ab8b66bdf Merge pull request #102917 from bysnupy/patch-1
Use "Capacity" instead of "Allocatable" for an accurate node memory total size

Kubernetes-commit: cee4aa09b09298c5d2ecf4ccaed9927f3c176fdf
2021-11-05 21:08:55 +00:00
Kubernetes Publisher f48256c8ee Merge pull request #105140 from brianpursley/kubectl-1101
Add --override-type flag to kubectl run and kubectl expose

Kubernetes-commit: 47041cd2a2ff325d70bf23f361c7f59e5ba4c9a1
2021-11-05 14:12:33 +00:00
brianpursley 07f77100fc Add --override-type flag to kubectl run and kubectl expose to allow the choice of using a JSON Patch or Strategic Merge Patch to apply the override to the generated output.
Kubernetes-commit: 0e697e19ac9f73e2efa0e60157730ba8731e3847
2021-11-05 07:10:47 -04:00
Alper Rifat Ulucinar 8cb506ed99 Bump k8s.io/kube-openapi to commit ee342a809c29
Updates to consume the aggregated OpenAPI spec lazy-marshaling behaviour
introduced with: https://github.com/kubernetes/kube-openapi/pull/251

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

Kubernetes-commit: 38f888bdd14b8eddb86ec8ca8461267fe7f8ded1
2021-11-05 14:10:09 +03:00
Kubernetes Publisher a69ce940b6 Merge pull request #105960 from ueokande/max-unavailable-pdb-tests
test: Assert max unavailable for PDB test cases

Kubernetes-commit: 451e1addd8b09a746ad12b73807966a823737774
2021-11-05 01:35:06 +00:00
Kubernetes Publisher 43ed92b473 Merge pull request #105983 from jiahuif-forks/dep/bump-smd
Upgrade sigs.k8s.io/structured-merge-diff/v4 to v4.2.0

Kubernetes-commit: 8e2d7a3d64976eb23e1a4fdc8c068f5210014da6
2021-11-04 01:18:37 +00:00
Kubernetes Publisher 12d3e10550 Merge pull request #104372 from astraw99/fix_label_msg
Fix `kubectl unlabel` response msg

Kubernetes-commit: a65bb64c094b03c5e58a7bacc2029a66b7cd8153
2021-11-04 01:18:35 +00:00
Kubernetes Publisher debce2e8f0 Merge pull request #101004 from lojies/cleanupforkubectl
code cleanup for kubectl

Kubernetes-commit: c2c0f913856e92d529ad436c3a93a6300439d8f2
2021-11-03 05:10:40 +00:00
Kubernetes Publisher a1514b65fc Merge pull request #104909 from pacoxu/kubectl-qos
kubectl: include init containers when determining pod QoS

Kubernetes-commit: 6ebd6f38b9804aa9eb58c5f742a56fa1f9e6ab85
2021-11-02 05:12:00 +00:00
Jiahui Feng c628b8bcb0 generated: ./hack/update-vendor.sh
Kubernetes-commit: a4f6152743af5201fdbb48bda6730797d3c8f572
2021-11-01 10:00:00 -07:00
Bryan Boreham 0a152f103a 'kubectl events' command (#99557)
* Basic scaffolding for kubectl events command

* Simple implementation of 'kubectl events'

* Print event fields

Borrowing code from 'kubectl describe'

* Sort events before printing

* Make output more like 'kubectl get events'

Print namespace if fetching from all

* Refactor: extract print functions

To make it easier to add watch function next.

* Implement watch for new events

Run the list function same as before, so those events come out in order,
then watch from the ResourceVersion after the last event.

* Clear up some lint warnings

* Update description and example text

* refactor: introduce a listOptions variable

* Implement --for option

splitResourceTypeName() function borrowed from cli-runtime because we
need similar behaviour to Builder.ResourceNames(), but applying to
Event.InvolvedObject.

* Add kubectl/pkg/cmd/events to vendor/modules.txt

* Add back cmdutil.Factory

Needed in NewCmdAlpha to construct the 'events' command

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix lint

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Make package alias go-cromulent

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use genericclioptions.RESTClientGetter instead of cmdutil.Factory

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Decode object parameter to GroupVersionKind and name

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Merge two files into one

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Include example for --for option

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix inconsistent option name in error message

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Remove unnecessary Validate call

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use fields from event series

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Support chunking of list of events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use watchtools utility to receive watch events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Split struct into flags and options

Flags represents the inputs from the CLI; options are what the running
command needs. This structure parallels the 'wait' command, and should
be easier to write tests for.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Add some parameters to usage string

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Do only one of list or watch

We tried to print the list first then start a watch after the last
event, but sometimes the server will return "watch is too old" on that
ResourceVersion.
Instead, if we need to watch just start it from the beginning.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Print message if no events found

Also, if watching, don't print the headings until the first event
arrives.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Kubernetes-commit: a988182f595af64bc007ba9162509e089c36fd89
2021-10-29 17:13:38 +00:00
Kubernetes Publisher 46fac21dcb Merge pull request #104915 from alculquicondor/job-ready
Track ready pods in Job status

Kubernetes-commit: 6edcb60d9f854903d341dc5155a78ff8221ad64e
2021-10-28 17:15:17 +00:00
Shin'ya UEOKA 791e7f9d0b test: Assert max unavailable for PDB test cases
Kubernetes-commit: 5c76507c3f9dd84dd3a56b39a45f99da1735bfed
2021-10-28 05:20:03 +00:00
Kubernetes Publisher 46e1b66a47 Merge pull request #105736 from deejross/drain-output-ffix
kubectl drain node output should say node was drained not evicted

Kubernetes-commit: 3fb98823c4f4e406d8c7572cc8de93a31dbaf537
2021-10-28 01:10:01 +00:00
Kubernetes Publisher 89d0053274 Merge pull request #105711 from VilledeMontreal/feat/multiComp
Shell completion of multiple resource names

Kubernetes-commit: aa7c6338c6767a86a76abae819670145033497f6
2021-10-27 21:08:50 +00:00
Kubernetes Publisher 7bae6d690a Merge pull request #105851 from VilledeMontreal/feature/compOutputFlag
Add completion to the --output/-o flag

Kubernetes-commit: 011aef1222bb5459401a400231cd8ad309486510
2021-10-27 05:11:42 +00:00
Kubernetes Publisher 0b81755902 Merge pull request #105896 from zqzten/upgrade-json-patch
upgrade json-patch to v4.12.0

Kubernetes-commit: 18cb34ebb2b64a7607057c7dea80427e2af387f3
2021-10-27 01:16:40 +00:00
Kubernetes Publisher e14545a096 Merge pull request #104832 from zc2638/fix/kubectl-env-update
add unit tests for `updateEnv`

Kubernetes-commit: 99ad41412754c6036460d3d9295db4e0e72eb688
2021-10-26 21:09:14 +00:00
Zach Zhu 7e120aedbd upgrade github.com/evanphx/json-patch to v4.12.0
Fix partial negative indice support in json patch

Kubernetes-commit: 20cc72344e653ab90c1a851816bb206b715fd231
2021-10-26 11:20:45 +08:00
Kubernetes Publisher fbd2bcf85b Merge pull request #104877 from pohly/json-kobj
component-base: test and fix JSON output for KObj

Kubernetes-commit: a5cd438b9fbf49e013453f4d6c9b2e935a78071c
2021-10-22 21:17:42 +00:00
Marc Khouzam b9e380aef5 Add completion to the --output/-o flag
For example:
$ kubectl get -o json<TAB>
json   jsonpath   jsonpath-as-json  jsonpath-file

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 5f22baeaf1f662d0fe90ea41e453883cb726323c
2021-10-22 15:15:23 -04:00
Patrick Ohly fe834d1621 klog 2.30.0, logr 1.2.0, zapr 1.2.0
The new releases fix logging of KObj in JSON output: klog implements the new
logr.Marshaler interface and zapr uses it instead of Stringer when logging the
ObjectRef created by KObj.

Kubernetes-commit: 169e8b65a00b45ef8bbc7a14cd985df1c835953b
2021-10-22 15:13:47 +02:00
Kubernetes Publisher bfcc74e277 Merge pull request #105030 from liggitt/json-stdlib
switch from json-iterator to forked stdlib json decoder

Kubernetes-commit: cc25656b00baa33168b7a9bc574101a06788efea
2021-10-22 05:11:51 +00:00
Kubernetes Publisher 6d98fd9964 Merge pull request #105514 from jpetazzo/tweak-kubectl-run-help
Minor improvements in 'kubectl run' flag help

Kubernetes-commit: 4cfd2820badf7e90b70ef19762b9e80af3f7bc71
2021-10-21 17:04:28 +00:00
yylt 0198d9185e Fix edit command
Kubernetes-commit: 2ae37c8046128e0191ec96c8b31361ae894f2330
2021-10-21 20:07:38 +08:00
Kubernetes Publisher f5043d986f Merge pull request #94165 from soltysh/fix_cp
Use separate pathSpec for local and remote to properly handle cleaning paths

Kubernetes-commit: 6cbe18544d90c29d6b3e460dffa6d795a88257ae
2021-10-20 01:04:17 +00:00
Ross Peoples dc5f5d4011 drain node output should say drained not evicted
Kubernetes-commit: 0cf3dba1f1df9555a46f2a086e48dcfe3c9ad6b2
2021-10-18 11:05:28 -05:00
Marc Khouzam b111bee570 Complete multiple resource names
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.

For example, the get command can receive multiple pods names, therefore
with this commit we have:
  kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.

The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint

Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
2021-10-15 15:36:09 -04:00