Commit Graph

182 Commits

Author SHA1 Message Date
Ahmet Alp Balkan
d0c352c5bf
Implement list (via exec kubectl), clearer color settings
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-18 14:05:32 -07:00
Ahmet Alp Balkan
3e34177cb9
Move kubeconfig loader utils to cmdutil pkg
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-18 13:32:53 -07:00
Ahmet Alp Balkan
d4112ce088
kubens: Start implementing stubs
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-18 13:09:59 -07:00
Ahmet Alp Balkan
56f3370d36
Create test utils for crafting kubeconfig strings
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-16 21:37:29 -07:00
Ahmet Alp Balkan
7b96a338a3
extract kubeconfig test utils to a type
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-16 21:00:00 -07:00
Ahmet Alp Balkan
49539fbcb3
do not fail on non-existing kubeconfig files
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-16 19:55:34 -07:00
Ahmet Alp Balkan
10f53bb15b
Better success msgs, handle -d without args
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 23:06:17 -07:00
Ahmet Alp Balkan
0ebccceeab
Tidy up colors, help msgs, TODOs
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 23:05:22 -07:00
Ahmet Alp Balkan
57f2bb1eb4
Create printer pkg, fix color force enable/disable
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 22:30:10 -07:00
Ahmet Alp Balkan
0ab135af99
Move kubeconfig utility to a shared pkg
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 18:19:38 -07:00
Ahmet Alp Balkan
73c1f268ee
Extend test coverage
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 18:17:03 -07:00
Ahmet Alp Balkan
562631ad2b
Fix UnsupportedOp tests through custom comparer
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 18:03:06 -07:00
Ahmet Alp Balkan
077d8a829d
Re-introduce DEBUG env var stack traces
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 17:57:57 -07:00
Ahmet Alp Balkan
195e6315da
Update tests for homeDir and kubeconfigPath()
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 17:53:09 -07:00
Ahmet Alp Balkan
e5a09017d0
Unify errors from kubeconfig.Parse
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 16:20:34 -07:00
Ahmet Alp Balkan
37ba52f357
Extract env vars to a file + test
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 16:15:17 -07:00
Ahmet Alp Balkan
91e00f9867
Support for fzf, color ignore/force knobs
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 15:59:48 -07:00
Ahmet Alp Balkan
17f6ffe73b
Move all yaml logic to pkg/kubeconfig
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 14:22:52 -07:00
Ahmet Alp Balkan
fb5e8bc904
Move ctx-related YAML parse methods to pkg
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 13:46:14 -07:00
Ahmet Alp Balkan
1313d98f57
Use kubeconfig pkg for parsing utils
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 13:17:08 -07:00
Ahmet Alp Balkan
94664bcaf9
kubeconfig pkg for loading/parsing
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 12:59:20 -07:00
Ahmet Alp Balkan
21d0a6aeeb
add printSuccess, pass writers to print funcs
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 12:37:04 -07:00
Ahmet Alp Balkan
7c2cf62cf0
define Run(stdout,stderr) method on **Ops
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-12 12:29:08 -07:00
Ahmet Alp Balkan
68ea776826
add some TODOs
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 16:41:21 -07:00
Ahmet Alp Balkan
37441b648f
Fix bugs for test pass, update tests
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 16:23:23 -07:00
Ahmet Alp Balkan
8ce95d4a00
Add support for renaming contexts
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 16:11:38 -07:00
Ahmet Alp Balkan
5ec2f4f032
Support for -d (deleting contexts)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 15:38:50 -07:00
Ahmet Alp Balkan
32d65fc527
Add support for -u/--unset
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 15:04:31 -07:00
Ahmet Alp Balkan
c5696a46b7
Add support for -c/--current
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 14:50:14 -07:00
Ahmet Alp Balkan
5f40b12a4e
Integrate ctx swap, check for wrong ctx names
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 14:41:57 -07:00
Ahmet Alp Balkan
74a30a60e0
Save last context name in state file
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 14:27:52 -07:00
Ahmet Alp Balkan
7a40a5ed07
Add utils for r/w ~/.kube/kubectx file
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 14:25:00 -07:00
Ahmet Alp Balkan
a9476f3215
Implement switch via editing yaml in-place
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 14:07:12 -07:00
Ahmet Alp Balkan
04e963c02c
Implement context listing
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 13:21:52 -07:00
Ahmet Alp Balkan
da08491f0b
Implement facilities to parse kubeconfig file
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 13:02:00 -07:00
Ahmet Alp Balkan
7c2f8ffa75
Add logic to determine kubeconfig path
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 12:34:31 -07:00
Ahmet Alp Balkan
d2267aa60c
Support help op, add color to error
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 12:07:58 -07:00
Ahmet Alp Balkan
1b2fc5961a
Handle supported operation in main
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 12:00:12 -07:00
Ahmet Alp Balkan
68a8276146
Start porting to Go: parse flags
Parse help/list/swap command line flags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2020-04-10 11:54:01 -07:00
Ahmet Alp Balkan
d3295e5b7a
Release v0.8.0 2020-02-20 15:12:06 -08:00
rob salmond
3369d42e2d
add unset flag (#187)
* add unset flag

* test unsetting selected context

* update readme with new unset flag

* testdata notes

* set a current context

* cleanup

* omit fixture changes
2020-02-04 09:39:47 -08:00
Rajat Jindal
f48c4198e7 Add krew-release-bot support (#189)
* try github actions

* create release

* open pr using krew-release-bot
2020-01-22 11:30:36 -08:00
Ahmet Alp Balkan
26d3422917
Install option as a kubectl plugin (#182)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-11-11 11:19:34 -08:00
Ahmet Alp Balkan
56e30d2b43
Detect invocation style only in usage() (#183)
- removes global SELF variable
- fixes #181

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-11-11 11:15:48 -08:00
Ahmet Alp Balkan
dcb43fdf1b
Release v0.7.1 2019-11-09 16:46:53 -08:00
Ahmet Alp Balkan
e2f7dc0de2
Print plugin-friendly usage string
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-11-09 16:46:27 -08:00
Pedro Rodrigues
9645e5c62c Add zsh completion for kubectx subcommand (-d) (#178)
- Add basic completion for subcommand -d.
  Note: Kubectx will suggest all available contexts.

- References:
  - http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System
  - https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
2019-10-24 15:25:31 -07:00
Oliver Ford
00a1e12bfb Disable preview when fuzzy-finding (#163)
The user may have global settings that enable the preview pane in fzf.

Whatever the preview command is set as, it probably doesn't render
anything meaningful for kubens - I can't think what would be.

For kubectx, the context yaml itself would _maybe_ be helpful, but it
likely contains secrets, so I don't personally think I'd find it useful
enough to get into.

This commit thus disables the preview, so that if the user did have it
enabled, there's now no pane where there would previously have probably
been an error, such as:

    [bat error]: '<namespace>': No such file or directory (os error 2)
2019-10-11 12:14:32 -04:00
Eugene Aseev
c3dd1e5deb Add missing instruction for zsh on Linux (#173)
* Add missing instruction for zsh on Linux

* Add completion reloading to .zshrc
2019-09-09 08:13:33 -07:00
Ahmet Alp Balkan
a21638226f
Release v0.7.0 2019-08-30 11:50:15 -07:00