Commit Graph

209 Commits (c47c6432f582c790d2f6eefc647d21b8c9642c5f)

Author SHA1 Message Date
Pingan2017 f824b58ba2 validate args for kubectl config view 2018-11-02 16:17:43 +08:00
k8s-ci-robot 85e460e362
Merge pull request #69809 from sc14aec/create-context-error-messages
Fix error messages suggesting invalid flag
2018-10-18 19:50:43 -07:00
Sean Sullivan 6a2ef97d46 kubectl: update to use correct printers package 2018-10-15 11:02:19 -07:00
Andy Crow 4400996c48 Fix error messages suggesting invalid flag 2018-10-15 16:39:53 +01:00
Sean Sullivan d076897be7 kubectl: copy printer tabwriter into kubectl 2018-10-12 15:10:46 -07:00
Maciej Szulik 61899e1654
Generated changes 2018-10-11 22:01:06 +02:00
Maciej Szulik 21789b85a6
Move pkg/kubectl/cmd/templates -> pkg/kubectl/util/temlpates 2018-10-11 22:01:03 +02:00
Christoph Blecker 97b2992dc1
Update gofmt for go1.11 2018-10-05 12:59:38 -07:00
Sean Sullivan 6e990b715b kubectl small fix for config view to replace legacyscheme with kubectl scheme 2018-09-27 13:20:10 -07:00
Clayton Coleman 02099f445b
Reduce the minwidth of the cli table printer
For a few columns we want to have a smaller width and 10 is excessive.
2018-08-31 14:13:48 -04:00
Kubernetes Submit Queue 8fb6939853
Merge pull request #66980 from flimzy/typo
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>.

Correct typos and missing word in help text

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

Corrects a grammatical/readability error in the help output.
2018-08-23 02:44:43 -07:00
Jonathan Hall 2a24e37378 Add missing word to help text and remove double spaces 2018-08-22 16:08:40 +02:00
Maciej Szulik 5b55e1f8ed
Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
Jordan Liggitt fe53c618e8
Allow modifying current context with kubectl set-context 2018-07-12 17:19:01 -04:00
juanvallejo 25a4932653 add --template tests for commands
Adds --template printing test-cmd tests for the following commands:
kubectl annotate, kubectl apply, kubectl autoscale, kubectl
convert, kubectl create, kubectl expose, kubectl get, kubectl label,
kubectl patch.
2018-07-03 13:53:06 -04:00
David Eads 52d45cfd4f move template printers to genericclioptions 2018-07-03 07:46:51 -04:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07: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 bf422b7b04
Merge pull request #64371 from CaoShuFeng/invalid_o
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>.

fix kubectl -o

Fix kubectl -o error message:
Before this change:
```
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:
```
Kubectl get pods -o foo
error: unable to match a printer suitable for the output format "foo", allowed formats are: json,yaml,name,template,go-template,go-template-file,templatefile,jsonpath,jsonpath-file,custom-columns-file,custom-columns,wide
```



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

**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
kubectl will list all allowed print formats when an invalid format is passed.
```
2018-06-06 04:15:56 -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
Di Xu acabdcb96a apply global flag "context" for kubectl config view 2018-06-02 13:31:58 +08:00
Guoliang Wang bae074ef38 use subtest for table units (pkg/kubectl) 2018-05-27 10:04:55 +08:00
juanvallejo d1603c9560 move PrintOptions to genericclioptions 2018-05-21 14:59:41 -04:00
David Eads 420dd9bf66 move type setting into an optional layer above normal printing 2018-05-17 17:22:12 -04:00
juanvallejo 876629f690 move ConfigFlags to pkg/kubectl/genericclioptions 2018-05-16 11:31:48 -04:00
juanvallejo 40e52bf07d remove legacyscheme dep from printFlags 2018-05-10 14:51:12 -04:00
Kubernetes Submit Queue 9091c26d72
Merge pull request #63291 from WanLinghao/set_const_clean
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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>.

	clean unused variables

**What this PR does / why we need it**:
clean unused variables on set.go
**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-05-08 13:16:11 -07:00
juanvallejo a74b28d961 rm GetStandardPrinter 2018-05-07 15:37:55 -04:00
juanvallejo 5a34e4f594 remove printer helpers 2018-05-07 15:37:55 -04:00
juanvallejo 3ca222b2d9 wire config flags through factory 2018-05-04 17:02:20 -04:00
WanLinghao 771882bbba clean unused variables 2018-04-30 16:39:12 +08:00
Christoph Blecker 857aac9ae4
Update gofmt for go1.10 2018-04-02 17:44:04 -07:00
zhengjiajin 457a7e76d9 add kubectl config view --raw example help user use 2018-03-23 09:51:47 +08:00
Di Xu 33b3fb9bed flag value bindings for kubectl create/get/set commands 2018-02-27 11:00:55 +08:00
David Eads be04e7c1b1 collapse printing paths 2018-02-21 08:15:22 -05:00
Kubernetes Submit Queue 370540f90d
Merge pull request #60057 from deads2k/cli-07-printer
Automatic merge from submit-queue (batch tested with PRs 59391, 58097, 60057, 60090). 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>.

cleanup printers some more

This cleans up some more dead printer flags and unnecessary arguments for various methods.  We're getting closer.  Still need to clean up some ugly around `PrintSuccess` and then its time to start trimming layers.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-02-20 13:51:35 -08:00
David Eads dd6405681f cleanup printers some more 2018-02-20 12:59:40 -05:00
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
zhengjiajin 46f760e8d0 add example for kubectl config unset, this will help user use 2018-02-05 20:33:49 +08:00
Kubernetes Submit Queue 048757b8a5
Merge pull request #53631 from dixudx/enforce_cobra_required_flags
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>.

update vendor spf13/cobra to enforce required flags

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

spf13/cobra#502 has enforced checking flags that marked as required, an error will be raised if unset.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*:fixes #54855
xref #48400
fixes kubernetes/kubectl#121 

**Special notes for your reviewer**:
/assign @liggitt @eparis 

**Release note**:

```release-note
kubectl now enforces required flags at a more fundamental level
```
2018-01-18 02:00:27 -08:00
Kubernetes Submit Queue a2bce0d74e
Merge pull request #56769 from dixudx/forbid_unnamed_context
Automatic merge from submit-queue (batch tested with PRs 57521, 56769). 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>.

forbid unnamed context

**What this PR does / why we need it**:
forbid unnamed contexts with validation

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

**Special notes for your reviewer**:
/assign @sttts @fabianofranz 

**Release note**:

```release-note
forbid unnamed context
```
2018-01-07 11:19:45 -08:00
Di Xu 792a229936 forbid unnamed context 2018-01-07 10:52:03 +08:00
Di Xu 1c715d51c4 some code change
fix wrong required flags

disable the addition of [flags] to the usage, use customized useline

fix function rename
2017-12-25 16:23:38 +08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
juanvallejo c53120e6b9
ensure PrinterForCommand is consumed through cmdutil.Factory 2017-12-05 13:39:29 -05:00
juanvallejo f5ab356043
pass printOpts by pointer 2017-11-20 14:49:23 -05:00
juanvallejo d3773b4b06
consolidate printer OutputOpts w PrintOpts
This patch removes the use of printers.OutputOptions in favor of only
having a single struct for setting / passing printer options set by user
flags.
2017-11-20 14:49:23 -05:00
Kubernetes Submit Queue a78d6b85ce
Merge pull request #46946 from kellycampbell/sort-contexts
Automatic merge from submit-queue (batch tested with PRs 46946, 45792). 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 config get-contexts: sort output

This sorts the output of kubectl config get-contexts because the ordering is otherwise non-stable and makes it harder to find the context you're looking for when you have more than a few.

```release-note
The output of kubectl config get-contexts is now sorted alphabetically by the context name.
```
2017-11-09 11:27:37 -08:00
Kubernetes Submit Queue 79d858660c
Merge pull request #55044 from ahmetb/wording
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/config/rename: fix wording

Using `Context %q renamed to %q.` in rename-context to be consistent with other
commands like delete-context, set-context, use-context.

/sig cli
/release-note none
2017-11-09 01:52:26 -08:00
Ahmet Alp Balkan d7b0890217
kubectl/config/rename: fix wording
Using "Context %q renamed to %q." in rename-context to be consistent with other
commands like delete-context, set-context, use-context.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-11-02 21:10:11 -07:00