Commit Graph

36 Commits (f34a24e98e7c837b567b78be3af958ac1156cd80)

Author SHA1 Message Date
ymqytw b776df8a20 move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
xiangpengzhao a6be3b64f8 Make "kubectl version" json output more readable. 2017-07-18 11:21:35 +08:00
Alexander Campbell 43c83d47d8 cmd/version: refactor to use the -Options pattern
This pattern is described in
49d65710b3/contributors/devel/kubectl-conventions.md (command-implementation-conventions)
2017-07-12 08:37:01 -07:00
Alexander Campbell 6fd36c10ad kubectl/cmd: many small refactors
* Rename variables and functions to match Go convention.
   For example, UsageError --> UsageErrorf.
 * Remove redundant or unreachable code.
 * Simplify some utility functions (no functionality changes).
 * Fix hanging 'if { return } else { return }' constructs.
 * Fix several incorrect printf verbs.
2017-06-27 16:25:20 -07:00
Kubernetes Submit Queue d9ba19c751 Merge pull request #46468 from alexandercampbell/cleanup-in-kubectl
Automatic merge from submit-queue

Cleanup pkg/kubectl

I was reading through `pkg/kubectl` in preparation for completing https://github.com/kubernetes/kubectl/issues/11 and noticed several opportunities for improvement. This should be easy to review since it's mostly mechanical changes. The only complicated changes are in `addFromEnvFile`, which I refactored into two functions and wrote tests for.

**Release note**:

```release-note
NONE
```
2017-06-24 08:32:09 -07:00
Jordan Liggitt fe8b5e9263
Fix kubectl api-versions caching 2017-06-24 01:14:31 -04:00
Alexander Campbell ef9ae61240 kubectl: simplify code with help of linter 2017-06-23 09:49:30 -07:00
bruceauyeung ab4029c85b Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
rename variables to make sure that they conform to golang variable name convention
2017-04-25 15:07:01 +08:00
Brendan Burns 79f51923d3 Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
Alejandro Escobar a5e6dcb434 addressing issue #39427 adding a flag --output to allow for either json or yaml.
updating with PR changes requested.

latest changes to having short for human readable only, and error cases moved a bit to the end.

rebase fixes

latest pr. changes.

small change moving return nil out of switch.

updated the nil check for the error in the humanreadable case.

more optimization in humanreadable code.

pushed up current test changes, this is purely temporary

finished writing tests

updated test and function names.

changed output extensions from .sh to output.

updated version, version struct now just called Version and not VersionObj.

made a few changes to testing.

fixed testing issues, created better test and cleanup

go format change.
2017-03-28 10:07:53 -07:00
Brendan Burns d9c4a289a6 Extract strings for translation. 2017-02-06 22:32:01 -08:00
Phillip Wittrock 9abd275607 Switch kubectl version and api-versions to create a discovery client directly.
The clientset will throw an error for aggregated apiservers because the
clientset looks for specific versions of apis that are compiled into
the client.  These will be missing from aggregated apiservers.
The discoveryclient is fully dynamic and does not rely on compiled
in apiversions.
2017-02-04 08:38:19 -08:00
Phillip Wittrock dc2fffe5d4 Improve kubectl help with examples. 2017-01-06 13:35:43 -08:00
Brandon Philips 9216057589 kubectl: add less verbose version
The kubectl version output is very complex and makes it hard for users
and vendors to give actionable information. For example during the
recent Kubernetes 1.4.3 TLS security scramble I had to write a one-liner
for users to get out the version number to give to figure out if they
are vulnerable:

    $ kubectl version | grep -i Server | sed  -n 's%.*GitVersion:"\([^"]*\).*%\1%p'

Instead this patch outputs simply output with `--short`

    ./kubectl version --short
    Client Version: v1.4.3
    Server Version: v1.4.3
2016-11-10 14:07:42 -08:00
AdoHe b2280a646a update various commands to adapt the new Factory interface 2016-10-13 21:01:14 +08:00
deads2k 9d43f7e52c convert more command to use a generated clientset 2016-09-12 07:38:34 -04:00
k8s-merge-robot 2da247ffbc Merge pull request #26977 from joe2far/fix-help-strings
Automatic merge from submit-queue

Make kubectl help strings consistent
2016-07-07 00:12:22 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
joe2far 25b4341dc7 Make kubectl help strings consistent 2016-06-29 12:50:24 +01:00
feihujiang 6290aee8b8 Remove shorthand for client flag in kubectl version 2015-10-13 02:02:54 +08:00
feihujiang 6b394e7212 Kubectl version should show client version at least
when couldn't read server version
2015-08-26 15:00:28 +08:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -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
deads2k 6344cf3c3a refactor to move kubectl.cmd.Factory to kubect/cmd/util 2015-04-07 14:43:50 -04:00
Tamer Tas b39e31d8a3 Remove cmd from kubectl/cmd/factory 2015-03-18 14:23:14 +02:00
Jeff Lowdermilk cd7d78b696 Make kubectl commands return errors and centralize exit handling 2015-03-10 10:19:43 -07:00
Brendan Burns f505a33998 Differentiate between server error messages and client error messages in kubectl 2015-03-07 11:39:23 +01:00
MikeJeffrey e5459c8802 Clean up kubectl help for auto-gen'd kubectl.md 2015-02-10 12:02:05 -08:00
Jeff Lowdermilk d46ae5d841 Refactor kubectl/cmd helpers into pkg/kubectl/cmd/util
Allows helpers to be used by config commands.
2015-02-05 09:39:42 -08:00
Clayton Coleman 8a4f225941 Make expandResourceShortcuts part of RESTMapper on client 2015-01-09 11:59:11 -05:00
deads2k 480635bb72 Revert "Revert "add kubeconfig types""
This reverts commit 02dbad7094.
2015-01-08 09:42:30 -05:00
Brendan Burns 02dbad7094 Revert "add kubeconfig types" 2015-01-07 12:39:37 -08:00
deads2k 0e688dc271 add kubeconfig file 2015-01-07 13:09:10 -05:00
deads2k 2dbfb80349 add utility for binding flags and building api server clients 2014-11-26 07:50:51 -05:00
fabianofranz c43637b73c Extract several kubectl helpers from cmd/cmd.go 2014-11-10 15:09:32 -02:00
Sam Ghods 4b220f8b0a kubectl: kubecfg rewrite for better modularity and improved UX 2014-10-15 15:29:54 -07:00