Commit Graph

331 Commits (0fc2c4844454be18961ad1b4446ef3c9540d20e6)

Author SHA1 Message Date
Kubernetes Submit Queue 76ffe9e832
Merge pull request #58787 from Lion-Wei/kubectl-3
Automatic merge from submit-queue (batch tested with PRs 60499, 61715, 61688, 61300, 58787). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix kubectl apply error message

**What this PR does / why we need it**:
Fix messy code in kubectl apply error message. 

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes/kubectl#197

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
/sig cli
2018-03-27 04:08:15 -07:00
Kubernetes Submit Queue 3e5596321e
Merge pull request #60919 from dixudx/file_visit_error_info
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

include file name in the error when visiting files

**What this PR does / why we need it**:
/kind bug
/sig cli

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #60916

**Special notes for your reviewer**:
/cc @kubernetes/sig-cli-api-reviews 
**Release note**:

```release-note
include file name in the error when visiting files
```
2018-03-20 19:34:23 -07:00
Lion-Wei e2dedc76a8 fix kubectl apply error message 2018-03-17 15:08:26 +08:00
juanvallejo 177dcb998f
match KindFor first 2018-03-09 15:43:10 -05:00
Di Xu a08cb5b531 include file name in the error when visiting files 2018-03-09 10:19:20 +08:00
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
juanvallejo 765f9ec68b
update -o name format to kind.group/name 2018-02-15 10:33:06 -05:00
Kubernetes Submit Queue c338209e4f
Merge pull request #57500 from niuzhenguo/unique-resource-mappings
Automatic merge from submit-queue (batch tested with PRs 57500, 58840, 58883). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make REST mappings for resources a unique list

This ensures the mappings list for resources(shortcuts, plural) unique,
instead of doing multiple requests to server for the same resource.



**What this PR does / why we need it**:
Treat resource shortcuts, plurals the same thing on kubectl side instead of doing multiple requests to servers, and outputs should not duplicate entires.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #57498 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-01-26 13:34:33 -08:00
Zhenguo Niu 6be1b975d2 Make REST mappings for resources a unique list
This ensures the mappings list for resources(shortcuts, plural) unique,
instead of doing multiple requests to server for the same resource.
2018-01-26 15:46:35 +08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
juanvallejo 80bc560489
check for empty label before assigning 2017-12-11 12:52:29 -05:00
Clayton Coleman 8f4b6c8771
All commands must declare Unstructured or Internal
Callers must take a dependency on one or the other set of conversions
and default client behavior. Future changes may add a Versioned() type,
but this is an accurate reflection of current code state.
2017-11-19 20:41:02 -05:00
Clayton Coleman 04ab96d2bd
Unify Object and UnstructuredObject
The unified RESTMapper and Typer follow the new rules, but on error will
fallback to the legacy path (while still supporting Unstructured
objects). This allows callers to handle the appropriate distinction
themselves if necessary.

Add a LocalParam() method to the resource.Builder that DRYs up a large
chunk of complicated code in set commands.
2017-11-19 19:16:50 -05:00
Clayton Coleman 64f56764d5
Builder should allow moving between unstructured / versioned easily
Demonstrate its use with get.go by removing the need to call decode with
a hardcoded scheme. Add tests to get_test.go to restore proving that
unstructured conversion is possible.
2017-11-19 19:16:49 -05:00
Clayton Coleman 0229fd4bd1
Unify unstructured and versioned object in resource.Builder
resource.Builder should be aware of both paths, and the caller is
responsible for determining the different path via use.
2017-11-19 19:02:25 -05:00
Clayton Coleman 98e0c69907 Revert "refactor builder in kubectl factory"
This reverts commit 06c5be9802.
2017-11-19 19:02:21 -05:00
Clayton Coleman a972c6bb00
Allow resource.Builder to modify requests per client
Gives the builder a hook point to add settings to each request. These
settings are applied before the request is created and so are unable to
view the request. Intended to set controls on a per request basis.
2017-11-18 14:34:26 -05:00
Clayton Coleman b366afa00a
Move category expander out of kubectl/resource 2017-11-14 17:38:16 -05:00
ymqytw 06c5be9802 refactor builder in kubectl factory 2017-11-07 20:16:27 -08:00
Di Xu fa143c6ddf add tests 2017-11-06 17:24:59 +08:00
Di Xu 4a3131ddaa add fieldSelector for kubectl get 2017-11-06 14:30:56 +08:00
Di Xu 057b7bf767 rename selector to labelSelector 2017-11-06 14:30:20 +08:00
ymqytw 2872e53c03 cleanup kubectl/resource tests dependency 2017-11-02 13:06:07 -07:00
Kubernetes Submit Queue 12e5db561e
Merge pull request #53768 from smarterclayton/chunking_cli
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Support api chunking in kubectl get

This enables chunking in the resource builder to make it easy to
retrieve resources in pages and visit partial result sets. This adds
`--chunk-size` to `kubectl get` only so that users can get comfortable
with the use of chunking in beta. Future changes will enable chunking
for all CLI commands so that bulk actions can be performed more
efficiently.

```
$ kubectl get pods --all-namespaces
... print batch of 500 pods ...
... print second batch of 500 pods ...
...
```

@kubernetes/sig-cli-pr-reviews @kubernetes/sig-api-machinery-pr-reviews

```release-note
`kubectl get` will by default fetch large lists of resources in chunks of up to 500 items rather than requesting all resources up front from the server. This reduces the perceived latency of managing large clusters since the server returns the first set of results to the client much more quickly.  A new flag `--chunk-size=SIZE` may be used to alter the number of items or disable this feature when `0` is passed.  This is a beta feature.
```
2017-10-29 15:59:54 -07:00
Clayton Coleman 4780ad0297
Support api chunking in kubectl get
This enables chunking in the resource builder to make it easy to
retrieve resources in pages and visit partial result sets. This adds
`--chunk-size` to `kubectl get` only so that users can get comfortable
with the use of chunking in beta. Future changes will enable chunking
for all CLI commands so that bulk actions can be performed more
efficiently.
2017-10-27 17:23:36 -04:00
Maru Newby adc338d330 Remove all traces of federation 2017-10-26 13:37:37 -07:00
Kubernetes Submit Queue 671efe1255 Merge pull request #54506 from juanvallejo/jvallejo/remove-check-resource-builder
Automatic merge from submit-queue (batch tested with PRs 54399, 54557, 54506). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove mutual exclusivity check - local, unstructured builder attrs

**Release note**:
```release-note
NONE
```
Remove incorrect mutual exclusivity check between the resource builder `Local` and `Unstructured` attributes.

Related comment: https://github.com/kubernetes/kubernetes/pull/48763#discussion_r146437490
Followup to https://github.com/kubernetes/kubernetes/pull/48763

cc @smarterclayton
2017-10-25 09:50:09 -07:00
juanvallejo 6144799f75
remove mutual exclusivity check - local, unstructured builder attrs 2017-10-24 14:16:47 -04:00
Kubernetes Submit Queue ca8d97d673 Merge pull request #53743 from DirectXMan12/feature/polymorphic-scale-client
Automatic merge from submit-queue (batch tested with PRs 53743, 53564). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Polymorphic Scale Client

This PR introduces a polymorphic scale client based on discovery information that's able to scale scalable resources in arbitrary group-versions, as long as they present the scale subresource in their discovery information.

Currently, it supports `extensions/v1beta1.Scale` and `autoscaling/v1.Scale`, but supporting other versions of scale if/when we produce them should be fairly trivial.

It also updates the HPA to use this client, meaning the HPA will now work on any scalable resource, not just things in the `extensions/v1beta1` API group.

**Release note**:
```release-note
Introduces a polymorphic scale client, allowing HorizontalPodAutoscalers to properly function on scalable resources in any API group.
```

Unblocks #29698
Unblocks #38756
Unblocks #49504 
Fixes #38810
2017-10-23 13:39:07 -07:00
Kubernetes Submit Queue 9403fcc9c7 Merge pull request #54024 from pwittrock/resource-validation-deps
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubectl resource builder to use versioned list

Switch to using a versioned listed when return an object from the resource builder.

This is necessary to allow cli's built outside the kubernetes/kubernetes repo to vendor the resource builder logic without vendoring all of Kubernetes.

The following commands call the modified function.  (identified by changing the function name and recompiling)

- [x] `attach`
  - pkg/kubectl/cmd/attach.go:155: builder.Do().Object
  - passes to `AttachablePodForObject` which does not support Lists of any kind
- [x] `get`
  - pkg/kubectl/cmd/get.go:251: r.Object
  - [x] check if isList with `IsListType` -> `GetItemsPtr` -> check for presence of `Items` field
  - [x] pass to `ResourceVersion` -> `CommonAccessor` -> checks for `metav1.ListInterface` (which this PR introduces a compile time check to ensure v1.List implements this)
  - [x] pass to `ExtractList` -> checks if items implement `runtime.RawExtension`
- [x] `rolling_update`
  - pkg/kubectl/cmd/rollingupdate.go:207: request.Object
  - only accepts lists of length 1.  updated in PR to support both api.List and v1.List
- [x] `rollout_status`
  - pkg/kubectl/cmd/rollout/rollout_status.go:107: r.Object
  - passes to `ResourceVersion` -> `CommonAccessor` -> checks for `metav1.ListInterface`

```release-note
NONE
```

Closes kubernetes/kubectl#81
2017-10-20 21:31:10 -07:00
Solly Ross eac2049fc9 [client-go] avoid Registry in fake REST client
Previously, the fake RESTClient in client-go required a Registry.  It
used the Registry to fetch the GroupVersion for the fake client.
However, the way it did so was dubious in some cases (it hard-coded the
default API group in places), and not strictly necssary.

This updates the fake client to just recieve the GroupVersion and
internal group name directly, instead of requiring a Registry, so that
it can be consumed in unit tests where a Registry isn't necessarily
readily available (e.g. elsewhere in client-go).
2017-10-19 11:01:44 -04:00
Phillip Wittrock fd169a6218 Switch to v1.List instead of allowing the conversion fn to be provided. 2017-10-18 09:30:46 -07:00
Dr. Stefan Schimanski cad0364e73 Update bazel 2017-10-18 17:24:04 +02:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Phillip Wittrock 72d672c3d5 Remove dependency on internal types from pkg/kubectl/resource.
Updates the Result.Object function to take an argument.
2017-10-17 18:58:16 -07:00
Kubernetes Submit Queue 74cd0f0766 Merge pull request #53861 from pwittrock/resource-validation-deps
Automatic merge from submit-queue (batch tested with PRs 53106, 52193, 51250, 52449, 53861). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move version-conversion code out of shared kubectl resource package

```release-note
NONE
```
2017-10-16 14:47:28 -07:00
Phillip Wittrock 7ab3f96100 Move kubectl type conversion libs out of the resource & util package and into the conversion command.
Kubectl shouldn't have code that does type conversion.  This should be in the server.
2017-10-16 11:54:31 -07:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Antoine Pelisse d1ce36371e kubectl: Remove swagger 1.2 entirely. 2017-10-10 14:50:56 -07:00
Di Xu 279065aa6c pass labelSelector to server side opaquely 2017-09-30 14:54:27 +08:00
Kubernetes Submit Queue 52cb89751f Merge pull request #48763 from juanvallejo/jvallejo/update-set-image-local-error-message
Automatic merge from submit-queue (batch tested with PRs 47806, 49539, 48763, 47049, 50600). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>..

Add Local and Unstructured resource builder attributes and handle <rsrsc> / <name> pairs when --local is set

**Release note**:
```release-note
NONE
```

Related downstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1390139

Adds an error message if a non-filename (or stdin) resource is specified with the `--local` flag in any of the `kube set ...` sub-commands.

cc @fabianofranz @kubernetes/sig-cli-misc
2017-09-22 21:20:54 -07:00
Fabiano Franz 81407cef49 Category expansion fully based on discovery 2017-09-05 17:34:42 -03:00
juanvallejo 04d319dc2a
update bazel 2017-09-05 11:57:01 -04:00
juanvallejo 90d76adb4b
add Local and Unstructured builder attributes
Moves DisabledClientMapperForMapping wrapper to new Local attribute.
Removes Factory#NewUnstructuredBuilder in favor of new Unstructured
builder attribute.
2017-09-05 11:57:00 -04:00
juanvallejo c10f4f78bc
add err message if <rsrc>/<name> pairs specified under --local 2017-09-05 11:04:39 -04:00
Di Xu 6b24fe2215 kubectl get show uninitialized resources 2017-08-26 13:52:36 +08:00
Jeffrey Regan dbc22ad6fd Remove kubectl's dependence on schema file in pkg/api/validation.
**What this PR does / why we need it**:

Makes functions in validation/schema.go private to kubectl,
further isolating kubectl.

**Which issue this PR fixes**

Part of a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-08-16 16:38:28 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
guangxuli 7db36811be add daemonset to all categories 2017-07-26 15:41:47 +08:00