Commit Graph

44 Commits (c582a37cae02b4d1a850e6668ea8ea0a81dcd204)

Author SHA1 Message Date
juanvallejo 5e79a25e0c
add support for "success" output for edit command
Adds support for the "success" printer in the "edit" command, while
ensuring outputFormat constraints for the in-editor printer.
2018-07-16 12:06:32 -04:00
David Eads 9fe20cfd46 make delete waits match on UID 2018-07-12 14:48:13 -04:00
David Eads fabe703756 re-make print flags composeable for sophisticated callers 2018-07-10 08:08:01 -04:00
juanvallejo 2b0b605c80
wire PrintFlags through rollout commands
Binds PrintFlags to rollout commands.
Adds tests ensuring --template printing is supported by rollout cmds.
2018-07-06 17:32:42 -04:00
David Eads a31d2c44f4 flatten nested lists for flatten in visitor 2018-07-05 07:57:53 -04:00
juanvallejo 122e748e18
fix go-template defaulting for commands w default output format
Fixes defaulting done for commands that default to a specific output
format (such as yaml, json) when a --template flag is provided and no
explicit --output value is given.

Under the above case, these commands will now properly default to
honoring the --template argument given, and default their --output
format to "go-template".
2018-07-03 17:50:33 -04:00
David Eads 70417ca150 make template printers a recommended printer 2018-07-03 07:47:17 -04:00
David Eads 52d45cfd4f move template printers to genericclioptions 2018-07-03 07:46:51 -04:00
Kubernetes Submit Queue 20453a7a4f
Merge pull request #65700 from soltysh/output_format
Automatic merge from submit-queue (batch tested with PRs 65648, 65700, 64976, 65692, 65667). 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>.

Update output format so that it matches actual accepted values

/assign @juanvallejo 

**Release note**:

```release-note
NONE
```
2018-07-02 19:46:12 -07:00
Maciej Szulik 972f1444c5
Update output format so that it matches actual accepted values 2018-07-02 13:35:31 +02:00
David Eads bc10b25465 make builder tolerant of restmapper failures when it doesn't need the answer 2018-06-29 11:07:36 -04:00
yue9944882 c5c88006ef show kind for multiple resource types
review: simplify and trim codes

refactor ToPrinter and pass show kind flag

remove tests together with removed function
2018-06-28 11:22:09 +08:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
David Eads 6dd9d1fff7 fix printer check to tolerate vendoring 2018-06-21 13:33:59 -04:00
Kubernetes Submit Queue debc5387fe
Merge pull request #63747 from wgliang/master.test.kubectl
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>.

use subtest for table units (pkg/kubectl)

**What this PR does / why we need it**:
Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Many table-driven tests in pkg/kubectl are not using this feature.

/kind cleanup
/area kubectl

Further reading: [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)


**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 #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-20 12:39:21 -07:00
Kubernetes Submit Queue 2fa32e717b
Merge pull request #64504 from wgliang/master.fix-format
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). 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>.

Errorf format %q has arg b.labelSelector of wrong type *string

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

Errorf format %q has arg b.labelSelector of wrong type *string

**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 #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-20 05:48:15 -07:00
Cao Shufeng 995c5a07ea fix kubectl -o
Fix kubectl -o error message:
Before this change:
```shell
kubectl get pods -o foo
error: unable to match a printer suitable for the output format "" and the options specified: &get.PrintFlags{JSONYamlPrintFlags:(*genericclioptions.JSONYamlPrintFlags)(0x23aa610), NamePrintFlags:(*genericclioptions.NamePrintFlags)(0xc42058b4e0), TemplateFlags:(*printers.KubeTemplatePrintFlags)(0xc4206765e0), CustomColumnsFlags:(*printers.CustomColumnsPrintFlags)(0xc420676620), HumanReadableFlags:(*get.HumanPrintFlags)(0xc4204eb180), NoHeaders:(*bool)(0xc4206fefbc), OutputFormat:(*string)(0xc42058b4d0)}
```

After this change:
```shell
Kubectl get pods -o foo
error: unable to match a printer suitable for the output format "aaa", allowed formats are: custom-columns,custom-columns-file,go-template,go-template-file,json,jsonpath,jsonpath-file,name,template,templatefile,wide,yaml
```
2018-06-05 19:49:07 +08:00
Kubernetes Submit Queue 6b2172741d
Merge pull request #64453 from deads2k/cli-73-resourcebuidlerflags
Automatic merge from submit-queue (batch tested with PRs 63328, 64316, 64444, 64449, 64453). 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 resource builder flags API

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

This pull expands the utility of the resource builder flags and demonstrates a second use-case with `kubectl set selector`.

@kubernetes/sig-cli-maintainers 
/assign @juanvallejo 
/assign @soltysh 

```release-note
NONE
```
2018-05-30 08:42:29 -07:00
Guoliang Wang 76059f874f Errorf format %q has arg b.labelSelector of wrong type *string 2018-05-30 17:51:17 +08:00
David Eads 4b836d77d5 update set selector to use resource builder flags 2018-05-29 12:47:19 -04:00
Monis Khan 631124cde4
Correctly apply request transforms with flattened resource builder
This change moves the NewClientWithOptions call into
Builder.getClient.  Since getClient is the only way for Builder and
its visitors to create a RESTClient, we can reasonably guarantee
that the request transforms will be honored.  Previously, it was
possible for a call to NewFlattenListVisitor to return resource Info
objects whose Client field did not honor the request transforms.

Signed-off-by: Monis Khan <mkhan@redhat.com>
2018-05-29 12:22:57 -04:00
David Eads 9c5bdd4b5c add resource builder flags 2018-05-29 10:46:54 -04:00
David Eads c85e69aeb9
remove unnecessary factory delegation for RESTClientGetter method 2018-05-28 15:12:41 +02:00
juanvallejo b4af3a4ffb
move filename flags to genericclioptions 2018-05-28 11:09:51 +02:00
juanvallejo d463bbddb1
move resource builder flags to genericclioptions 2018-05-28 11:08:58 +02:00
Guoliang Wang bae074ef38 use subtest for table units (pkg/kubectl) 2018-05-27 10:04:55 +08:00
Kubernetes Submit Queue 6e1727a865
Merge pull request #64114 from juanvallejo/jvallejo/remove-command-method-from-factory
Automatic merge from submit-queue (batch tested with PRs 59851, 64114, 63912, 64156, 64191). 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 f.Command out of the factory

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

Moves the "f.Command" method out of factory_client_access

cc @soltysh
2018-05-23 09:06:11 -07:00
juanvallejo 0d3e85608f move f.Command out of the factory 2018-05-22 13:31:01 -04:00
David Eads 49258593c3 add a discarding printer for testing and delegation 2018-05-22 08:47:42 -04:00
David Eads 76794643c5 add wait 2018-05-22 08:47:42 -04:00
juanvallejo d1603c9560 move PrintOptions to genericclioptions 2018-05-21 14:59:41 -04:00
Kubernetes Submit Queue 221909540d
Merge pull request #63966 from mfojtik/cli-01-fix-flatten
Automatic merge from submit-queue (batch tested with PRs 63871, 63927, 63966, 63957, 63844). 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: fix Flatten() when used without Latest()

**What this PR does / why we need it**:

If `Flatten()` is used on resource builder the list is not flattened unless the `Latest()` is used in the chain.
We should support `Flatten()` without Latest() as well. For example:

```
$ oc apply -l foo=bar -f /tmp/list.yaml
```
 will fail with:
```
F0517 13:45:07.831195   31795 helpers.go:119] error: object does not implement the Object interfaces
```

**Release note**:
```release-note
NONE
```
2018-05-17 13:40:22 -07:00
David Eads eabfcfaa2b start splitting polymorphic functions out of the factory 2018-05-17 08:55:31 -04:00
Michal Fojtik 390b60f103
kubectl: fix Flatten() when used without Latest() 2018-05-17 14:01:42 +02:00
juanvallejo 876629f690 move ConfigFlags to pkg/kubectl/genericclioptions 2018-05-16 11:31:48 -04:00
juanvallejo 4059355743 move cached_discovery to client-go/discovery 2018-05-15 10:20:56 -04:00
David Eads fd044d152e fix dynamic client name 2018-05-11 13:12:09 -04:00
David Eads d8924bc1c9 move old dynamic client to deprecated-client 2018-05-11 08:00:46 -04:00
David Eads 16d6a6c52f move resource builder to generic options 2018-05-10 14:15:12 -04:00
David Eads 8ef56776b9 provide standard iostream struct for commands 2018-04-20 12:54:11 -04:00
David Eads ecd9a6be2e final record flag cleanup 2018-04-19 14:56:00 -04:00
David Eads 484d81ab01 use recordFlags 2018-04-19 08:50:01 -04:00
David Eads e2a5c39b23 use record flags 2018-04-18 13:56:59 -04:00
David Eads b523c915e4 fix up record flags 2018-04-18 13:56:59 -04:00