Commit Graph

103 Commits

Author SHA1 Message Date
Zihong Zheng
6b9860cf54 Allows kubectl create -f to filter by selector. 2017-01-17 19:18:51 -08:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue
3951ae4e1d Merge pull request #38112 from juanvallejo/jvallejo/add-output-format-support-kubectl-create
Automatic merge from submit-queue

Add json,yaml output format support to kubectl create, kubectl apply

Fixes: https://github.com/kubernetes/kubernetes/issues/37390

**Release note**:
```release-note
Added support for printing in all supported `--output` formats to `kubectl create ...` and `kubectl apply ...`
```

This patch adds the ability to specify an output format other than
"name" to `kubectl create ...`. It can be used in conjunction with the
`--dry-run` option. Converts unstructured objects into known types in
order to support all `--output` values.

The patch prints `*resource.Info`s returned by the server. If a resource does not yet exist (and the `--dry-run` option is not set), the resource is created and printed in the specified format.

@kubernetes/cli-review @fabianofranz
2017-01-03 14:18:33 -08:00
deads2k
8b25c21e79 add create rolebinding 2016-12-21 09:03:27 -05:00
juanvallejo
cbe479039b Add json,yaml output format support kubectl create
This patch adds the ability to specify an output format other than
"name" to `kubectl create ...`. It can be used in conjunction with the
`--dry-run` option. Converts unstructured objects into known types in
order to support all `--output` values.
2016-12-12 16:09:12 -05:00
Clayton Coleman
42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -05:00
Michail Kargakis
065b652961 kubectl: add create pdb subcommand 2016-12-02 18:42:25 +01:00
Kubernetes Submit Queue
74066816b6 Merge pull request #37098 from deads2k/cli-12-create-cbinding
Automatic merge from submit-queue

add create clusterrolebinding command

Adds `kubectl create clusterrolebinding`.

@kubernetes/sig-cli
2016-12-02 08:44:58 -08:00
Clayton Coleman
35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
deads2k
e300f01a1b add create clusterrolebinding command 2016-11-21 08:50:06 -05:00
juanvallejo
988e747649 update default run function for sub-commands
This patch updates parent commands of sub-commands to exit with a usage
error and exit code 1 on an invalid (non-sub-command) argument.
2016-10-31 10:08:12 -04:00
ymqytw
c641834bb3 support editing before creating resource 2016-10-24 09:56:37 -07:00
Fabiano Franz
f6d1ac72a0 Use our own normalizers for cmd examples and descriptions 2016-10-17 11:49:55 -02:00
Kubernetes Submit Queue
a010d3b195 Merge pull request #34028 from juanvallejo/jvallejo/add-dry-run-flag-kubectl-apply
Automatic merge from submit-queue

add --dry-run flag to `kubectl apply, kubectl create`

Partially addresses https://github.com/kubernetes/kubernetes/issues/11488

**Release note**:
```release-note
release-note-none
```

Related StackOverflow:
http://stackoverflow.com/questions/38824409/validate-openshift-objects-defined-in-yaml-before-actually-applying-or-executing

This patch adds a `--dry-run` flag to the `apply` command in order to
allow validation of objects, without patching or creating them. If a
`--dry-run` flag is present and no validation errors are found, the
command will exit before "configuring" or creating any objects.

@ncdc @fabianofranz
2016-10-15 05:30:40 -07:00
AdoHe
b2280a646a update various commands to adapt the new Factory interface 2016-10-13 21:01:14 +08:00
juanvallejo
63e0279d93
add --dry-run flag to kubectl apply
Related StackOverflow:
http://stackoverflow.com/questions/38824409/validate-openshift-objects-defined-in-yaml-before-actually-applying-or-executing

This patch adds a `--dry-run` flag to the `apply` command in order to
allow validation of objects, without actually creating them. If a
`--dry-run` flag is present and no validation errors are found, the
command will exit before patching or creating any objects.

It also adds a `--dry-run` option to the `kubectl create` root command.
2016-10-12 16:48:20 -04: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
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
Kris
7511412ca6 Make kubectl create use dynamic clients 2016-08-15 22:07:54 -07:00
Angus Salkeld
bd0b7528b5 Add "create deployment" sub-command 2016-08-08 13:24:30 +10:00
Angus Salkeld
42ca885edb Add "create service" sub-commands
This adds:
 create service clusterip
 create service nodeport
 create service loadbalancer
2016-08-08 12:31:21 +10:00
maaz khan
5b95524d65 Add support for kubectl create quota command 2016-07-26 11:32:08 +02: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
Michail Kargakis
3cbb6b0104 kubectl: move printObjectSpecificMessage in factory 2016-05-28 18:33:58 +02:00
k8s-merge-robot
e543bd6452 Merge pull request #26007 from smarterclayton/watch_opt
Automatic merge from submit-queue

Additional optimizations to the encode/decode paths

Builds on top of #25983 with a number of other optimizations.
2016-05-28 06:27:00 -07:00
Minhan Xia
a1bd33f510 promote sourceRange into service spec 2016-05-26 10:42:30 -07: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
Clayton Coleman
fdb110c859
Fix the rest of the code 2016-04-29 17:12:10 -04: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
Jordan Liggitt
560b02b3ec Prefer fetched version when determining HPA group version kind 2016-03-11 00:03:38 -05:00
k8s-merge-robot
739285b146 Merge pull request #21265 from stevekuznetsov/skuznets/new-sa
Auto commit by PR queue bot
2016-03-01 01:14:06 -08:00
AdoHe
9cc668f7c6 update commented examples just remove $ 2016-02-29 09:41:09 -05:00
Steve Kuznetsov
e5b696ee43 added 'kubectl create sa' to create serviceaccounts 2016-02-26 10:27:37 -05:00
Paul Morie
51a9c2c9ba Add kubectl create configmap 2016-02-18 21:24:21 -05: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
derekwaynecarr
5e0948586c Add kubectl create [SUBCOMMAND] pattern 2015-12-14 13:43:45 -05:00
Janet Kuo
37f35d9342 Make kubectl apply create resources if not found 2015-11-08 22:47:40 -08:00
Janet Kuo
a6a64820d7 Make generation of the apply annotation optional 2015-11-06 15:08:50 -08:00
Jordan Liggitt
b58e62e7d4 Pass runtime.Object to Helper.Create/Replace 2015-10-28 12:43:21 -04:00
jackgr
ef3f64612e Add calls to set annotation for kubectl apply 2015-10-07 17:15:56 -07:00
Brendan Burns
9ba13ff361 Address comments 2015-09-11 13:55:16 -07:00
Brendan Burns
d9e1a00a14 Add caching for swagger schemas 2015-09-10 21:18:52 -07:00
deads2k
f1b81ff678 bind filenames var instead of looking up 2015-09-01 08:35:57 -04:00
Janet Kuo
5823ef771b Make --validate default on and shows how to turn if off 2015-08-25 03:18:32 -07:00