Commit Graph

343 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
Wang Xing 6cabb084c3 Remove redundant ToJSON 2016-07-22 11:28:21 +08:00
Davanum Srinivas 2b0ed014b7 Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-16 13:48:21 -04:00
k8s-merge-robot 721eabf492 Merge pull request #28626 from juanvallejo/update-resource-builder-format-error
Automatic merge from submit-queue

update resource builder error message to be more clear

release-note-none

The error message given by command line `kubectl get` is sometimes of no help / not clear on what must be corrected, e.g.:
`kubectl get pod pod/database-1-i10b9`
error: when passing arguments in resource/name form, all arguments must include the resource 

##### Steps to Reproduce:
1. Run command "$ kubectl get pod pod/database-1-i10b9"  

##### Actual Result:
Get unfriendly error message which is of no help:
"error: when passing arguments in resource/name form, all arguments must include the resource"

##### Expected Result:
Error message should recommend end user to run this cli in good grammar: "$ kubectl get pod database-1-i10b9" or "$ kubectl get pod/database-1-i10b9"

##### Before
"error: when passing arguments in resource/name form, all arguments must include the resource"

##### After
"error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. `kubectl get resource/<resource_name>` instead of `kubectl get resource resource/<resource_name>`"

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-13 14:42:02 -07:00
k8s-merge-robot cef6f776f1 Merge pull request #27243 from smarterclayton/dont_alter_error
Automatic merge from submit-queue

resource.Builder should not alter error type from server
2016-07-11 16:42:08 -07:00
Wojciech Tyczynski 7403564366 Remove Codec from ContentConfig. 2016-07-08 13:53:09 +02:00
juanvallejo 17a4df2c31 update resource builder error message to be more clear 2016-07-07 16:32:26 -04:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
k8s-merge-robot 42a5654383 Merge pull request #25612 from mbohlool/fix_error_msg
Automatic merge from submit-queue

Fixed misleading error message when a resource with no selector or na…

Commit:
- Fixed misleading error message when a resource with no selector or name is provided to kubectl delete or label command

This commit fixes #25541
2016-06-29 10:52:25 -07:00
Clayton Coleman b2f72e6b1b
resource.Builder should not alter error type from server
The current helpful message loses the error type, which means
resource.Builder consumers can't filter errors or have downstream logic.

If the error is a known type, only mutate the message, not the message
type.
2016-06-11 19:22:54 -04:00
k8s-merge-robot 2ef20b41f6 Merge pull request #26686 from metral/fix-get-output
Automatic merge from submit-queue

fix recursive & non-recursive kubectl get of generic output format

This PR fixes the issues with `kubectl get` in https://github.com/kubernetes/kubernetes/issues/26466

Changes made:
- fix printing when using the generic output format in both non-recursive & recurvise settings to ensure that errors are being shown
- add tests to check printing generic output in a **non-recursive** setting with non-existent pods
- clean up the **recursive** `kubectl get` tests

/cc @janetkuo
2016-06-11 14:26:31 -07:00
k8s-merge-robot f1ccc2f1be Merge pull request #26354 from csrwng/fix_visitor_error
Automatic merge from submit-queue

kubectl: fix URLVisitor error message

The status of a failed fetch will usually include the code, resulting in a duplicate code in the error message:
```
unable to read URL "http://git:8080/ruby-hello-world.git", server reported 401 401 Unauthorized
```

This change rearranges them so at least the message doesn't stutter (and includes the code in case it's not part of the status):
```
unable to read URL "http://git:8080/ruby-hello-world.git", server reported 401 Unauthorized, status code 401
```

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-09 02:43:27 -07:00
k8s-merge-robot 421c16addd Merge pull request #25894 from brendandburns/thirdparty-watch
Automatic merge from submit-queue

Fix third party

Fixes https://github.com/kubernetes/kubernetes/issues/25421
Fixes https://github.com/kubernetes/kubernetes/issues/25422

@AdoHe @sjenning @caesarxuchao @lavalamp 

@kubernetes/sig-api-machinery 

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-04 15:42:41 -07:00
Mike Metral 4409eed57f fix recursive & non-recursive kubectl get of generic output format 2016-06-02 21:46:15 -07:00
Brendan Burns 328a8392b1 Fix third party 2016-06-02 10:24:14 -07:00
Cesar Wong 0800ed834c Fix URLVisitor error message 2016-05-26 09:20:42 -04:00
Clayton Coleman c6961d6fd6
Remove runtime.Typer, reduce to ObjectKinds(1) (3)
Remove the unnecessary variants, which avoids allocations in several
core paths.
2016-05-21 23:55:42 -04:00
amehdy 0c5713084b Fixed misleading error message when a resource with no selector or name is provided to kubectl delete or label command 2016-05-14 02:04:35 -07:00
k8s-merge-robot 4486385bc6 Merge pull request #25267 from pwittrock/kubectl-retry-simple
Automatic merge from submit-queue

Retry fetching http urls passed to '-f' in kubectl.

## Pull Request Guidelines

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
1. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
1. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.

```release-note
* kubectl now retries failed http gets for urls passed through the '-f' flag.
```


[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

Closes #24089.
2016-05-13 22:44:24 -07:00
Clayton Coleman 51b624103f
Change ConvertToVersion to use GroupVersion
Long delayed refactor, avoids a few more allocations.
2016-05-12 10:10:35 -04:00
Wojciech Tyczynski 5d046fed41 Fix tests for renegotiation 2016-05-12 08:21:11 +02:00
Phillip Wittrock b9f9d130d7 Address PR comments 2 2016-05-09 16:23:15 -07:00
Phillip Wittrock 3d08c73767 Address PR Comments 1 2016-05-09 16:21:30 -07:00
Phillip Wittrock 75417ba3e4 Retry fetching http urls passed to '-f' in kubectl.
Closes #24089.
2016-05-09 15:58:17 -07:00
Robert Bailey 385ae07bc6 Merge pull request #24919 from kargakis/avoid-panic-in-mapper
kubectl: avoid panic with nil gvk
2016-05-06 15:07:05 -07:00
Clayton Coleman e0ebcf4216
Split the storage and negotiation parts of Codecs
The codec factory should support two distinct interfaces - negotiating
for a serializer with a client, vs reading or writing data to a storage
form (etcd, disk, etc). Make the EncodeForVersion and DecodeToVersion
methods only take Encoder and Decoder, and slight refactoring elsewhere.

In the storage factory, use a content type to control what serializer to
pick, and use the universal deserializer. This ensures that storage can
read JSON (which might be from older objects) while only writing
protobuf. Add exceptions for those resources that may not be able to
write to protobuf (specifically third party resources, but potentially
others in the future).
2016-05-05 12:08:23 -04:00
Wojciech Tyczynski 3aadafd411 Use NegotiatedSerializer in client 2016-05-04 10:57:36 +02:00
Michail Kargakis 29ff69fd83 kubectl: avoid panic with nil gvk
The decoder will return a nil gvk in case it errors out and getting
the version out of that gvk naturally will panic. Bail out as soon
as we can check that the error is non-nil. kubectl edit was the primary
victim.
2016-04-28 11:14:15 +02:00
zhouhaibing089 bf1a3f99c0 Uncomment the code that cause by #19254 2016-04-25 23:21:31 +08:00
k8s-merge-robot 07929972a3 Merge pull request #18835 from brendandburns/3rdparty
Automatic merge from submit-queue

Add support for 3rd party objects to kubectl

@deads2k @jlowdermilk

Instructions for playing around with this:

Run an apiserver with third party resources turned on (`--runtime-config=extensions/v1beta1=true,extensions/v1beta1/thirdpartyresources=true`)

Then you should be able to:

```
kubectl create -f rsrc.json
```

```json
{
  "metadata": {
    "name": "foo.company.com"
  },
  "apiVersion": "extensions/v1beta1",
  "kind": "ThirdPartyResource",
  "versions": [
    {
      "apiGroup": "group",
      "name": "v1"
    },
    {
      "apiGroup": "group",
      "name": "v2"
    }
  ]
}
```

Once that is done, you should be able to:

```
curl http://<server>/apis/company.com/v1/foos
```

```
curl -X POST -d @${HOME}/foo.json http://localhost:8080/apis/company.com/v1/namespaces/default/foos
```

```json
{
  "kind": "Foo",
  "apiVersion": "company.com/v1",
  "metadata": {
    "name": "baz"
  },
  "someField": "hello world",
  "otherField": 1
}
```

After this PR, you can do:

```
kubectl create -f foo.json
```

```
kubectl get foos
```

etc.
2016-03-31 18:09:56 -07:00
Brendan Burns be6c5b332b Add third party support to kubectl 2016-03-31 10:53:32 -07:00
Janet Kuo c1596e6711 Update guestbook examples; replace RC concepts with Deployment 2016-03-30 14:16:52 -07:00
Mike Metral 7403878ac0 allow kubectl cmd to process dirs recursively
reqs:
    - the kubectl cmd must support the -f | --filename flag
    - the kubectl cmd must support visiting a dir one level deep,
    or using more than one resource
2016-03-28 12:44:21 -07:00
Wojciech Tyczynski 89585237cd Rename RawJSON to Raw in runtime.RawExtension and add ContentType & ContentEncoding. 2016-03-18 12:35:27 +01:00
Wojciech Tyczynski 218d3e5923 Rename RawJSON to Raw in runtime.Unknown and add ContentType & ContentEncoding. 2016-03-16 16:43:58 +01:00
deads2k 5bd161a9cc allow resource.version.group in kubectl 2016-03-11 10:21:50 -05:00
Jordan Liggitt 560b02b3ec Prefer fetched version when determining HPA group version kind 2016-03-11 00:03:38 -05:00
Avesh Agarwal ad6dfa0370 Fix kubectl create to create all resources in a url.
https://github.com/kubernetes/kubernetes/issues/18751 .
2016-03-02 18:08:24 -05:00
Kris e664ef922f Move restclient to its own package 2016-02-29 12:05:13 -08:00
deads2k 9c42d219bc allow disambiguation of resouces 2016-02-25 07:35:23 -05:00
Clayton Coleman d23c531869 Can't replace a generic resource that is cluster scoped
It should be allowed to invoke kubectl replace with a JSON file that has
no resource version set.  Namespaced resources were working correctly,
but cluster resources were silently failing to lookup the current state
of the object to get the resource version because we weren't using
NamespaceIfScoped(). Added a failing test.
2016-02-12 16:20:37 -05:00
Clayton Coleman 2fd38a7dc0 Break kubectl from assuming details of codecs
Most of the logic related to type and kind retrieval belongs in the
codec, not in the various classes. Make it explicit that the codec
should handle these details.

Factory now returns a universal Decoder and a JSONEncoder to assist code
in kubectl that needs to specifically deal with JSON serialization
(apply, merge, patch, edit, jsonpath). Add comments to indicate the
serialization is explicit in those places. These methods decode to
internal and encode to the preferred API version as previous, although
in the future they may be changed.

React to removing Codec from version interfaces and RESTMapping by
passing it in to all the places that it is needed.
2016-01-22 13:27:26 -05:00
nikhiljindal 2ad642d370 Merge registered and latest and move to apimachinery 2016-01-21 14:42:21 -08:00
David Oppenheimer 8ac484793d Comment out calls to httptest.Server.Close() to work around
https://github.com/golang/go/issues/12262 . See #19254 for
more details. This change should be reverted when we upgrade
to Go 1.6.
2016-01-11 23:02:11 -08:00
k8s-merge-robot 356487c951 Merge pull request #18101 from brendandburns/kubectl6
Auto commit by PR queue bot
2015-12-29 12:43:42 -08:00
k8s-merge-robot 500493a3ac Merge pull request #18925 from caesarxuchao/refactor-registration
Auto commit by PR queue bot
2015-12-24 15:19:36 -08:00
Chao Xu 2b5b708b70 Refactor the API registration and installation 2015-12-23 22:44:25 -08:00
Brendan Burns 4123a61df7 Add the client side bits of kubectl export 2015-12-22 10:41:59 -08:00
deads2k 20f9c2c545 find partial resource matches 2015-12-21 09:26:06 -05:00
k8s-merge-robot 649855128d Merge pull request #18627 from caesarxuchao/oneline-fix
Auto commit by PR queue bot
2015-12-19 00:50:31 -08:00
k8s-merge-robot 00c754108f Merge pull request #18165 from fabianofranz/fixes_get_show_all
Auto commit by PR queue bot
2015-12-18 20:01:20 -08:00
Abhishek Shah 6f63875165 Reverting 18442 2015-12-17 16:57:29 -08:00
Fabiano Franz 717896eae3 Fixes get --show-all 2015-12-17 18:35:54 -02:00
deads2k 41b78ad2b6 find partial resource matches 2015-12-16 10:19:31 -05:00
Chao Xu 5ba4f836f8 some small fix 2015-12-15 12:00:48 -08:00
deads2k d0aaf13920 use constants for group names 2015-12-14 10:04:10 -05:00
deads2k 519b4e80d1 update NewObject for groupversionkind 2015-12-09 08:13:15 -05:00
deads2k 2ee3dfe415 update testapi to eliminate redundant fields 2015-12-07 15:54:26 -05:00
deads2k f764e0099c Update ObjectTyper to GroupVersion 2015-12-07 08:35:05 -05:00
Chao Xu 6e192760e3 refactoring latest.go GroupVersion;
clean up latest.go GroupVersions;
remove latest.GroupMeta.Group;
remove latest.GroupMeta.Version.
2015-11-30 11:30:21 -08:00
deads2k 8679925847 update RESTMapping API to be properly typed 2015-11-25 14:02:37 -05:00
deads2k 5c4fb5bcbe make RESTMapper.KindFor 2015-11-25 14:02:37 -05:00
deads2k 5077e9b644 make register.GroupVersion use GroupVersion 2015-11-24 09:45:36 -05:00
feihujiang ad79fa6e84 Move list functions from runtime to meta package 2015-11-20 09:20:55 +08:00
deads2k 303bcad398 use groupversion in RESTMapping 2015-11-16 09:22:11 -05:00
Kris eacf65ddce Renaming HTTPClientFunc to CreateHTTPClient 2015-11-11 11:54:58 -08:00
Kris 4a4d195419 Exposing http.Client for configurable timeouts 2015-11-10 13:40:51 -08:00
k8s-merge-robot a9534bfd33 Merge pull request #16441 from liggitt/helper_codec
Auto commit by PR queue bot
2015-10-30 11:29:17 -07:00
Fabiano Franz d9161cb3b5 stdin is not a valid file extension for bash completions 2015-10-29 00:00:34 -02:00
Jordan Liggitt b58e62e7d4 Pass runtime.Object to Helper.Create/Replace 2015-10-28 12:43:21 -04:00
Clayton Coleman be868e934c Revert resource.Builder changes from 57388f9
57388f9f94
2015-10-21 16:23:33 -04:00
k8s-merge-robot 77207d75e1 Merge pull request #15667 from JanetKuo/kubectl-watch-list
Auto commit by PR queue bot
2015-10-19 06:28:35 -07:00
eulerzgy f8f9afb874 alias local packagename for pkg/util/errors 2015-10-18 09:37:46 +08:00
Janet Kuo 33b9235312 Better error handling for watching a list of resources specified in a file 2015-10-14 16:38:03 -07:00
Chao Xu fe7b85f6ea run goimports 2015-10-12 13:33:13 -07:00
Chao Xu 8654227c08 run grep-sed 2015-10-12 13:33:13 -07:00
Chao Xu 58ed8fd6fe run goimports 2015-10-12 13:33:13 -07:00
Chao Xu 654ceb6e5a run grep-sed 2015-10-12 13:33:13 -07:00
Chao Xu 50a2c4c643 grep-sed 2015-10-12 13:31:45 -07:00
hurf e1b88c6942 Integrate convertion tool to kubectl
Added 'convert' subcommand to kubectl to convert config files
between different API versions.
2015-10-09 10:15:30 +08:00
k8s-merge-robot b0d748efb0 Merge pull request #14461 from JanetKuo/kubectl-api-group-cmd
Auto commit by PR queue bot
2015-10-07 07:29:10 -07:00
Janet Kuo 57388f9f94 Support kubectl group/resource name 2015-10-06 13:12:32 -07:00
Paul Morie 227dd82119 Add PodSecurityContext and backward compatibility tests 2015-10-05 21:05:27 -04:00
Kris f4ad00d9ae Moving Status object to a common package 2015-09-17 14:09:53 -07:00
feihujiang ba38a8764b Remove useless codes about minion 2015-09-16 14:22:53 +08:00
Chao Xu ac5481d089 move client/unversioned/fake.go to its own package 2015-09-11 17:33:54 -07:00
Chao Xu 64bf839e9f refactor tests to use testapi rather than latest directly 2015-09-11 17:32:23 -07:00
Chao Xu dd6c121d7f massive changes 2015-09-11 17:31:47 -07:00
tummychow 78ce5da988 Move util.StringSet into its own package
A lot of packages use StringSet, but they don't use anything else from
the util package. Moving StringSet into another package will shrink
their dependency trees significantly.
2015-09-10 12:04:15 -07:00
Chao Xu 9fc79e9d99 refactor testapi and test scripts to prepare for multiple API groups. 2015-09-04 18:01:32 -07:00
Jeff Lowdermilk cb65cfa746 Print recognized file extensions in resource builder error 2015-09-03 11:01:13 -07:00
Yu-Ju Hong 5dfc904c18 Merge pull request #10979 from kargakis/resource-builder-name-method
Support default types in the resource builder
2015-08-25 10:08:00 -07:00
Janet Kuo 5823ef771b Make --validate default on and shows how to turn if off 2015-08-25 03:18:32 -07:00
kargakis f3c63ba16b Support default types in the resource builder
Right now there is no method in the resource builder for specifying just the name of a resource. NameParam is useful when a default type is already specified with ResourceTypes.

Signed-off-by: kargakis <mkargaki@redhat.com>
2015-08-25 10:36:37 +03:00
Nikhil Jindal 4c88aeeda2 Merge pull request #13093 from hurf/nit
Fix docstring for InfoForObejct func
2015-08-24 11:37:50 -07:00
Nikhil Jindal e690f3b3e8 Merge pull request #12900 from feihujiang/deleteMultipleResourcesWithTheSameName
Allow delete multiple resources with the same name
2015-08-24 10:40:41 -07:00
hurf 5bec41d0b6 Fix docstring for InfoForObejct func 2015-08-24 21:46:49 +08:00
feihujiang 943c57ff4e Allow delete multiple resources with the same name 2015-08-24 15:14:01 +08:00
Zach Loafman 5ca0ca3d3f Merge pull request #9787 from feihujiang/acceptErrorLikeGoPath
Make a change to visitor to allow it to accept an error, like Go's pa…
2015-08-21 15:17:58 -07:00
Clayton Coleman 02dbb95447 Add TerminationGracePeriodSeconds to API
Set defaulting for pod spec
2015-08-20 11:03:38 -04:00
feihujiang 29dc7f6ec2 Make a change to visitor to allow it to accept an error, like Go's path walker 2015-08-20 10:57:28 +08:00
Saad Ali 49a569a457 Merge pull request #12675 from pweil-/dont-swallow-errors
don't swallow bad request errors
2015-08-19 17:01:51 -07:00
Saad Ali d42864b0ad Merge pull request #12112 from JanetKuo/update-kubectl-get-pods-running
Hide terminated pods in 'kubectl' Printer by default
2015-08-19 12:51:18 -07:00
Robert Bailey 08e6a43c1d Revert "Merge pull request #9165 from smarterclayton/graceful"
This reverts commit 4f856b595d, reversing
changes made to d78525a83b.

Conflicts:
	pkg/kubelet/status_manager.go
2015-08-18 17:34:49 -07:00
Janet Kuo 44a7a52a94 Hide failed/succeeded pods in 'kubectl get pods' by default 2015-08-18 13:47:19 -07:00
Kris Rousey ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Clayton Coleman b842a7dd15 Revert "Revert "Gracefully delete pods from the Kubelet""
This reverts commit 98115facfd.
2015-08-18 08:57:02 -04:00
Paul Weil f1d0835235 don't swallow bad request errors 2015-08-13 14:31:56 -04:00
feihujiang 4b9afc516e Kubectl label command accepts a filename param 2015-08-13 10:21:38 +08:00
Mike Danese 8326697055 rewrite all links to prs to k8s links 2015-08-05 21:11:11 -07:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
feihujiang 4553e410d3 Remove the duplicate source (filename) in error message 2015-07-31 10:20:45 +08:00
Mike Danese 4c52257be3 Merge pull request #11571 from kargakis/handle-aliases-in-comma-sep-args
Handle aliases in comma-separated args
2015-07-24 13:08:28 -07:00
Mike Danese 52282b1a36 Merge pull request #11300 from mwielgus/kubectl_replace_tempfile
Dump stdin to a temporary file in kubectl replace --force
2015-07-24 11:23:25 -07:00
Marcin Wielgus 866bd7b4e5 Dump stdin to a temporary file in kubectl replace --force 2015-07-23 15:22:23 +02:00
kargakis 4fcb4b7f8d Handle aliases in comma-separated args 2015-07-23 09:32:33 +02:00
Jeff Lowdermilk 8d4167e7f6 kubectl resource builder: don't check extension for single files
`kubectl create -f filename` doesn't need to check the extension
of filename. This fixes that behavior.
2015-07-07 13:48:29 -07:00
Kris Rousey ffa764d60b Unify command line namespace resolution
This change allows the namespace in kubeconfig to be overridden by
specifying the namespace in the spec file. If namespace is explicitly
provided in the command line flags and the spec file has a different
namespace, this will cause an error.
2015-07-01 12:59:17 -07:00
Alex Robinson 764d34d363 Merge pull request #10468 from caesarxuchao/add-cmd-replace
Add command "kubectl replace"
2015-06-29 16:06:33 -07:00
Alex Robinson 68bbf6c129 Merge pull request #10447 from feihujiang/helpfulErrorForUnsupportedVersion
Provide more helpful error when using unsupported api version
2015-06-29 15:00:58 -07:00
Anastasis Andronidis 697e07f864 Correctly parse multiple resources from files
Refactored how files, directories and stdin are handled. Every file must pass
through the FileVisitor and then streamed through StreamVisitor. FileVisitor
takes care of opening/closing files and StreamVisitor is parsing multiple
resources.
2015-06-29 23:11:46 +02:00
Chao Xu 9b3d42c090 Add command "kubectl replace". "kubectl update" is still supported as an alias.
"kubectl replace --patch" is NOT supported. It's moved to "kubectl patch" as a separate command in another commit.
2015-06-29 12:14:24 -07:00
feihujiang 878a72228f Provide more helpful error when using unsupported api version 2015-06-29 15:32:54 +08:00
Mike Danese 0c8f71aa0b make rolling update check if the replication controller has been defaulted 2015-06-25 12:29:21 -07:00
Maxwell Forbes d90895adfd Merge pull request #10221 from feihujiang/addSourceForErrorFromServerMessage
Add source in “error from server” message when using kubectl
2015-06-25 10:56:46 -07:00
feihujiang b41b53122a Add source in “error from server” message when using kubectl 2015-06-25 14:20:09 +08:00
Chao Xu 59b654c996 fix tests for 22f1b07858 2015-06-22 17:10:09 -07:00
Satnam Singh a3ffb05004 Merge pull request #9972 from smarterclayton/split_versioned_object
Split AsVersionedObjects so it can be reused
2015-06-19 08:04:23 -07:00
Mike Danese 3de11e2fa8 reenable patch serverside using strategic-merge-patch 2015-06-18 12:06:46 -07:00
Clayton Coleman 1707c5d28c Split AsVersionedObjects so it can be reused 2015-06-17 16:33:53 -04:00
krousey 687e866d80 Merge pull request #9418 from mikedanese/kubectl-version-err
kubectl should error if versionless yaml is passed to resource builder
2015-06-09 11:55:48 -07:00
krousey ff474e5d7e Merge pull request #9376 from feihujiang/createValidateCrash
kubetcl create --validate crashes when no apiVersion or kind is provided
2015-06-09 09:59:42 -07:00
feihujiang 37abe11f8a kubetcl create --validate crashes when no apiVersion or kind is provided 2015-06-09 10:38:43 +08:00
Mike Danese 627b2f9a24 kubectl should use UnstructuredJSONScheme to decode version and kind, as it throws errors if either are missing] 2015-06-08 11:51:37 -07:00
Mike Danese 7b7d8ccb77 print various errors which is useful when ContinueOnError is set on the Resource struct 2015-06-06 15:47:01 -07:00
Filip Grzadkowski 98115facfd Revert "Gracefully delete pods from the Kubelet" 2015-06-02 23:40:05 +02:00
Clayton Coleman 72ee028cab Gracefully delete pods from the Kubelet
This commit wires together the graceful delete option for pods
on the Kubelet.  When a pod is deleted on the API server, a
grace period is calculated that is based on the
Pod.Spec.TerminationGracePeriodInSeconds, the user's provided grace
period, or a default.  The grace period can only shrink once set.
The value provided by the user (or the default) is set onto metadata
as DeletionGracePeriod.

When the Kubelet sees a pod with DeletionTimestamp set, it uses the
value of ObjectMeta.GracePeriodSeconds as the grace period
sent to Docker.  When updating status, if the pod has DeletionTimestamp
set and all containers are terminated, the Kubelet will update the
status one last time and then invoke Delete(pod, grace: 0) to
clean up the pod immediately.
2015-06-01 19:23:59 -04:00
Masahiro Sano 8ce64ec69e add --all-namespaces flag to request across all namespaces 2015-05-22 23:25:12 +09:00
Clayton Coleman 0a28e50511 Revert "Revert "Enhance error message from kubectl when 'kind' is empty"" 2015-05-20 17:32:23 -04:00
Clayton Coleman 633c56f8c0 Revert "Enhance error message from kubectl when 'kind' is empty" 2015-05-20 10:32:56 -04:00
feihujiang 6c8a1cdb17 Enhance error message from kubectl when 'kind' is empty
Enhance error message from kubectl when 'kind' is empty

Enhance error message
2015-05-20 15:23:47 +08:00
Jeff Lowdermilk 46bd6f298a Merge pull request #8237 from smarterclayton/continue_on_error
Make ContinueOnError actually work
2015-05-15 12:57:29 -07:00
Clayton Coleman a47716e66d Make ContinueOnError actually work
In resource.Builder ContinueOnError() should actually do so.

Reorganized util.CheckErr() to make it display bulk errors more
effectively and be more reusable. Clarified that CheckErr is not
specific to kubectl in Godoc. Changed the "Error: " prefix to
"error: " to more closely match Unix conventions.
2015-05-15 14:26:14 -04:00
Brendan Burns ea3852ec69 Fix a bug where IgnoreErrors was inverted.
Also make an error message a little more verbose.
2015-05-13 16:26:01 +01:00
Clayton Coleman 964bc8afda Verify namespace is not set on root objects 2015-05-11 15:51:04 -04:00
Brendan Burns 7f11585972 Fix validation by moving it into the resource builder.
Also always print an error for unknown field.
2015-05-08 14:00:33 -07:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Clayton Coleman 12ba4e2452 Do not automatically decode runtime.RawExtension
Make clients opt in to decoding objects that are stored
in the generic api.List object by invoking runtime.DecodeList()
with a set of schemes. Makes it easier to handle unknown
schema objects because decoding is in the control of the code.

Add runtime.Unstructured, which is a simple in memory
representation of an external object.
2015-04-29 12:53:07 -04:00
Brian Grant 38ea531487 Merge pull request #7194 from nikhiljindal/example
Updating the guestbook example to v1beta3
2015-04-23 15:26:47 -07:00
nikhiljindal 1e323d77bc Updating the guestbook example to v1beta3 2015-04-23 14:34:36 -07:00
Mark Maglana 4927d70dd0 Add .yml to the list of recognized file extensions 2015-04-23 08:57:45 -07:00
Clayton Coleman 1bc4912f51 Merge pull request #7030 from liggitt/skip_fetch_delete
Skip fetching from server when deleting a named resource
2015-04-20 19:38:10 -04:00
Jordan Liggitt feb8ba9c4e Allow resource builder to avoid fetching objects 2015-04-20 15:00:52 -04:00
Clayton Coleman 545a5a865f List output with differing types should be more resilient
kubectl get can output a series of objects as a List in versioned
form, but not all API objects are available in the same schema.
Make the act of converting a []runtime.Object to api.List more
robust and add a test to verify its behavior in Get.

Makes it easier for client code to output unified objects.
2015-04-20 14:44:16 -04:00
Clayton Coleman 4b85c0866a Don't insert duplicate arguments in SplitResourceArgs 2015-04-17 11:36:25 -04:00
Clayton Coleman 4833578a57 Merge pull request #6958 from smarterclayton/args_remain_in_order
`kubectl get rc,pods` should invoke in that order
2015-04-17 11:30:09 -04:00
kargakis 9d056c6bd8 Support setting up aliases for groups of resources
Closes #5278
2015-04-17 16:31:59 +02:00
Clayton Coleman 2c11835612 `kubectl get rc,pods` should invoke in that order
SplitResourceArguments should not use a golang map
2015-04-17 00:57:02 -04:00
Daniel Smith 44bc29631e compute query parameter names in the client. 2015-04-06 16:54:26 -07:00
Kris Rousey 6904c4d585 Fixing a lot of string formatting issues with regards to:
* Improper format specifier (e.g. %s for bools or %s for ints)
  * More or less parameters than format specifiers
  * Not calling a formatting function when it should have (e.g. Error() instead of Errorf())
2015-03-31 16:47:10 -07:00
feihujiang 6b79dcaa4d add source filename in error message 2015-03-27 09:28:48 +08:00
Clayton Coleman 1e496696ca Merge pull request #5903 from smarterclayton/support_resources_by_type_and_name
Allow resource.Builder commands to take arguments by type/name
2015-03-26 14:23:03 -04:00
gmarek 5a11748018 Move Capacity from NodeSpec to NodeStatus 2015-03-26 15:28:48 +01:00
Clayton Coleman 581d7cd789 Allow resource.Builder commands to take arguments by type/name
Will allow xarg behavior to fetch resources across multiple types.
Changes 'create', 'get', 'update', 'stop', and 'delete' to output
<resourceType>/<name>.
2015-03-25 20:39:22 -04:00
nikhiljindal 7e3b7f9673 Updating unit tests so that they pass with v1beta3 api 2015-03-24 12:13:53 -07:00
Clayton Coleman 6918a4d32e Replace automatic YAML decoding with opt-in YAML decoding
Base codecs no longer automically handle YAML.  Instead, clients
must convert to JSON first via yaml.ToJSON and runtime.YAMLDecoder.
2015-03-20 00:03:56 -04:00
Salvatore Dario Minonne 31ddefc347 Finalize fields.Selector 2015-03-17 22:55:43 +01:00
Brian Grant 2f9a41b898 Merge pull request #5233 from brendandburns/labels
Make label and field selector query strings versionable.
2015-03-16 16:01:37 -07:00
Dawn Chen 34e9c82c70 Convert RestartPolicy to string for v1beta3.
Fixed #3607 and spiritually support #5475
2015-03-13 18:38:07 -07:00
Brendan Burns 266234f3b9 Make label and field selector query strings versionable. 2015-03-12 12:24:07 -07:00
Brendan Burns 2700871b04 Merge pull request #5013 from smarterclayton/misc_fixup
Small cleanups to a number of client behaviors
2015-03-06 15:41:34 +01:00
Salvatore Dario Minonne 75f2efb500 moving ParseSelector to Parse for labels only. 2015-03-05 22:39:36 +01:00
Clayton Coleman a97635e643 Use IsListType instead of checking ItemPtr in resourcebuilder 2015-03-04 10:48:05 -05:00
rsokolowski 635281ebe3 Update guestbook example to use replication controller. 2015-02-24 20:21:13 +01:00
Karl Beecher ecbb91cc08 Adds support for multiple resources to kubectl
You can specify multiple resources by name when using the delete, get
and stop commands.
2015-02-20 16:18:57 +01:00
Brian Grant 876d651737 Merge pull request #4395 from smarterclayton/split_naming
Fix cross-namespace LIST and WATCH
2015-02-17 09:40:09 -08:00
Clayton Coleman 3e2e4714a2 Always set ?namespace in query if specified
Revise our code to only call Request.Namespace() if a namespace
*should* be present.  For root scoped resources, namespace should
be ignored.  For namespaced resources, it is an error to have
Namespace=="".
2015-02-16 00:23:38 -05:00
Salvatore Dario Minonne fda17c1b7a kubectl delete resource : remove all resources 2015-02-13 18:25:41 +01:00
derekwaynecarr 0bd0e12bbc Add support for Namespace as Kind
Add example for using namespaces
2015-02-10 09:50:50 -05:00
Clayton Coleman 52c6c60b15 Use name from server when displaying create/update
Allows generated names from files to be displayed so users can
interact with them.
2015-02-08 21:40:47 -05:00
Yu-Ju Hong 4a72addaeb Factor out API defaulting from validation logic
Currently, the validation logic validates fields in an object and supply default
values wherever applies. This change factors out defaulting to a set of
defaulting callback functions for decoding (see #1502 for more discussion).

 * This change is based on pull request 2587.

 * Most defaulting has been migrated to defaults.go where the defaulting
   functions are added.

 * validation_test.go and converter_test.go have been adapted to not testing the
   default values.

 * Fixed all tests with that create invalid objects with the absence of
   defaulting logic.
2015-02-03 00:55:42 -08:00
derekwaynecarr 0851ca9522 Do not provide a namespace on request url if resource does not require it 2015-02-02 10:26:19 -05:00
derekwaynecarr a8449732e0 Make the FilterNamespace function the last visitor 2015-02-02 10:26:19 -05:00
derekwaynecarr 4c33e36a88 Plumb restmapper properly through apiserver and tests 2015-02-02 10:26:19 -05:00
derekwaynecarr f911784c98 Cherry pick test from #3901 2015-02-02 10:26:19 -05:00
derekwaynecarr 71ec444d63 Make a RESTMapper scope aware 2015-02-02 10:26:19 -05:00
Clayton Coleman 6894d4feed Merge pull request #3460 from mnagy/handle-selector-error
Fix panic if selector uses malformed syntax
2015-01-14 13:49:22 -05:00
Clayton Coleman ccdc20d90c Ignore empty objects from streams and error when nothing passed to create
Passing zero objects to create should be an error
2015-01-14 13:12:33 -05:00
Clayton Coleman 31413c8727 Add more tests around JSON/YAML decoding from the CLI
Switch the ignore stream errors behavior to print a Warningf on
failure to parse, not v(2)
2015-01-14 12:38:36 -05:00
Martin Nagy 9340781d21 Fix panic if selector uses malformed syntax 2015-01-14 17:13:58 +01:00
Clayton Coleman ec803cb809 Allow resource.Builder to stream YAML from the CLI
Add both JSON and YAML STDIN tests in test-cmd
2015-01-14 00:50:13 -05:00
Clayton Coleman d24c5b145e Allow errors to be ignored by the builder 2015-01-09 13:31:24 -05:00
Clayton Coleman d1ab27762b Create should be able to accept multiple resources 2015-01-09 13:30:31 -05:00
Clayton Coleman d75a3d5021 Move Resource functionality to its own package
Create a unified Builder object for working with files, selectors,
types, and items that makes it easier to get multi-object functionality.

Supports all of the behaviors previously in resource.go, but with
additional flexibility to allow multi-type retrieval and access, directories,
URLs, nested objects, and lists.
2015-01-09 11:59:06 -05:00