Commit Graph

41 Commits (92cb90fc5d118ed5c892f425ed1ded5290894db5)

Author SHA1 Message Date
AdoHe b2280a646a update various commands to adapt the new Factory interface 2016-10-13 21:01:14 +08:00
ymqytw 2af1c03b2a refactor edit cmd 2016-10-06 16:29:09 -07:00
Kubernetes Submit Queue ea688f5e44 Merge pull request #31276 from juanvallejo/jvallejo_update-dry-run-create
Automatic merge from submit-queue

Update kubectl create message when using --dry-run

`kubectl create <resource> <name> --dry-run` provides a misleading success
message.

When commands such as `kubectl new-app node` are run with a
`--dry-run` flag, they make this clear by appending a "(DRY RUN)"
string to the final output. `kubectl create <resource>  <name> --dry-run`
does not do this, providing a potentially misleading output.

This patch appends a "(DRY RUN)" string to the end of a successful
message of `kubectl create` subcommands that support the `--dry-run` flag.

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created
```

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created (DRY RUN)
```

**Release note**:
```release-note
release-note-none
```
2016-09-26 16:01:17 -07:00
Kubernetes Submit Queue 2941069307 Merge pull request #32894 from deads2k/cli-01-remove-arg
Automatic merge from submit-queue

make --include-extended-apis deprecated and remove plumbing

Marks a dead CLI parameter as deprecated and removes the plumbing for it.
2016-09-19 21:11:04 -07:00
Kubernetes Submit Queue 051ee17094 Merge pull request #30815 from ymqytw/refactoring
Automatic merge from submit-queue

Fixes #30562: Refactor kubectl command options to use common struct for common file params

Fixes #30562 : Refactor common go struct options in pkg/kubectl/cmd/*.go.
@pwittrock
2016-09-16 19:48:22 -07:00
deads2k 862415aaa2 make --include-extended-apis deprecated and remove plumbing 2016-09-16 16:05:52 -04:00
juanvallejo 52fc8efa55 update PrintSuccess message when using --dry-run 2016-09-15 10:11:21 -04:00
ymqytw c67a62da49 Fixes #30562: Refactor kubectl command options to use common struct for common file params 2016-09-12 11:01:37 -07:00
PingWang 121f6fb289 change all jsonmerge to strategicpatch
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update preconditions define

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-09-09 08:28:10 +08:00
Piotr Skamruk d0e59e0c22 kubectl: Do not add warning header if ftype is json. 2016-08-30 10:15:45 +02:00
Szymon Pyżalski b87ee3dff7 Validation logic applied to edited file
The file that is submitted via edit is now subject to validation
logic as any other file. The validation flags were added to the edit
command.

Fixes: #17542
2016-07-15 13:02:19 +02:00
Ivan Shvedunov 5ed881c6c4 Refactor Printer arguments
Fixes #21260
2016-07-14 16:23:02 +03:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Michael Rubin 760b04e294 Use dedent for the kubectl commands
The one side effect is that for the "kubectl help" commands a newline
is prepended to output, which will alter the yaml output.

Here we use dedent to format the code to match the output.

hack/update-generated-docs.sh has been run and the affected files have
been added.

Note: for describe.go we added a period to the end of an output message.
2016-06-26 22:51:14 -07:00
Mike Metral 4913481b05 enable recursive processing in kubectl edit 2016-05-22 09:49:11 -07:00
deads2k 0adc0ab5b2 make kubectl edit handle lists again 2016-05-16 11:02:10 -04: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
Michail Kargakis cf7671d2c4 kubectl: use platform-agnostic helper in edit
https://github.com/kubernetes/kubernetes/issues/22371 still stands for
Windows clients since path.Base is not platform-agnostic[1].

Use filepath.Base instead[2].

[1] https://golang.org/src/path/path.go?s=4482:4511#L166
[2] https://golang.org/src/path/filepath/path.go?s=12257:12286#L409
2016-04-18 11:51:05 +02:00
k8s-merge-robot ed87db5040 Merge pull request #23437 from DirectXMan12/bug/cannot-edit-across-gv
Automatic merge from submit-queue

Make kubectl edit not convert GV on edits

Previously, kubectl edit was using a decoder to load in edits that
converted to the internal version.  It would then re-encode this
decoded value to produce a patch.  However, if you were editing
in the object in a GroupVersion that was not the internal version,
this would cause the kubectl edit command to attempt to produce
a patch which changed the GroupVersion, which would fail.

Now, we use a plain deserializer instead, so no conversion or
defaulting occurs when loading in the edited file.

Ref #23378
2016-04-15 16:32:17 -07:00
Kenjiro Nakayama 5cc540fec1 Update bashcompletion codes for kubectl edit 2016-04-14 23:34:58 +09:00
Brendan Burns be6c5b332b Add third party support to kubectl 2016-03-31 10:53:32 -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
Solly Ross bc4143092c Make kubectl edit not convert GV on edits
Previously, kubectl edit was using a decoder to load in edits that
converted to the internal version.  It would then re-encode this
decoded value to produce a patch.  However, if you were editing
in the object in a GroupVersion that was not the internal version,
this would cause the kubectl edit command to attempt to produce
a patch which changed the GroupVersion, which would fail.

Now, we use a plain deserializer instead, so no conversion or
defaulting occurs when loading in the edited file.

Fixes #23378
2016-03-24 15:15:19 -04:00
k8s-merge-robot 9dfbcae449 Merge pull request #22634 from kargakis/kubectl-edit-error-log-fix
Auto commit by PR queue bot
2016-03-22 14:37:55 -07:00
Harry Zhang 7178fba251 Move crlf.go to sub pkg 2016-03-21 20:20:05 +08:00
Michail Kargakis 23343425b8 kubectl: print errors that wont be reloaded in the editor 2016-03-15 15:01:28 +01:00
nikhiljindal 593b78f925 Deprecating --api-version flag 2016-03-11 10:12:44 -08:00
Janet Kuo d5953991d9 Fix kubectl edit: no such file 2016-03-02 16:05:08 -08:00
AdoHe 9cc668f7c6 update commented examples just remove $ 2016-02-29 09:41:09 -05:00
Michail Kargakis f4658396eb kubectl: a couple of edit fixes
Fix some edit bugs:
* Reload the file in case of syntax errors
* Fix error format for validation errors
* Avoid hotlooping in case of no changes or empty saves
2016-02-18 11:43:07 +01:00
Janet Kuo 5088d0e147 Record kubectl commands 2016-02-03 10:19:05 -08: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
Kris ca7c765f0a Remove APIStatus from the client
Everything that used it also depended on pkg/api/errors. It was a
needless abstraction since it was always an *errors.StatusError.
2015-12-10 13:12:21 -08:00
deads2k 66eecb963a update more kubectl bits for groupversion 2015-12-07 09:01:44 -05:00
kargakis 523b6ec7e3 edit: Make environment variables composable
It also adds support for KUBE_EDITOR and GIT_EDITOR which were already
advertised in the edit usage message.
2015-11-25 11:23:23 +01:00
deads2k a87d927588 update client.Config to use GroupVersion 2015-11-21 08:29:26 -05:00
Janet Kuo a6a64820d7 Make generation of the apply annotation optional 2015-11-06 15:08:50 -08:00
kargakis 73713ce268 edit: Windows fixes
Contains the following fixes for Windows users of kubectl edit:
* Defaults to notepad as the default Windows editor
* Uses CRLF line endings
* Ensures a file lock is freed
2015-10-24 17:06:49 +02:00
Janet Kuo f5adda3d81 Fixed the error for kubectl edit multiple resources 2015-10-22 22:35:15 -07:00
jackgr ef3f64612e Add calls to set annotation for kubectl apply 2015-10-07 17:15:56 -07:00
Janet Kuo 5a608446ba pull "kubectl edit" from openshift upstream 2015-09-15 19:16:23 -07:00