added support for impressionation

mine
derailed 2019-02-26 07:29:25 -08:00
parent 668bc063ef
commit 1d0c9e3bb3
4 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,22 @@
# Release v0.1.9
## Notes
Thank you to all that contributed with flushing out issues with K9s! I'll try
to mark some of these issues as fixed. But if you don't mind grab the latest
rev and see if we're happier with some of the fixes!
If you've filed an issue please help me verify and close.
Thank you so much for your support!!
---
## Change Logs
---
## Resolved Bugs
* [Issue #83](https://github.com/derailed/k9s/issues/83)
* [Issue #84](https://github.com/derailed/k9s/issues/84)

View File

@ -173,6 +173,20 @@ func initK8sFlags() {
"The name of the kubeconfig user to use",
)
rootCmd.Flags().StringVar(
k8sFlags.Impersonate,
"as",
"",
"Username to impersonate for the operation",
)
rootCmd.Flags().StringArrayVar(
k8sFlags.ImpersonateGroup,
"as-group",
[]string{},
"Group to impersonate for the operation",
)
rootCmd.Flags().BoolVar(
k8sFlags.Insecure,
"insecure-skip-tls-verify",

View File

@ -168,6 +168,9 @@ func (c *Config) ClusterNames() ([]string, error) {
// CurrentUserName retrieves the active user name.
func (c *Config) CurrentUserName() (string, error) {
if isSet(c.flags.Impersonate) {
return *c.flags.Impersonate, nil
}
if isSet(c.flags.AuthInfoName) {
return *c.flags.AuthInfoName, nil
}

View File

@ -31,6 +31,7 @@ type (
sortFn resource.SortFn
data resource.TableData
cmdBuff *cmdBuff
tableMX sync.Mutex
}
)
@ -123,10 +124,14 @@ func (v *tableView) SetColorer(f colorerFn) {
// SetActions sets up keyboard action listener.
func (v *tableView) setActions(aa keyActions) {
v.tableMX.Lock()
{
for k, a := range aa {
v.actions[k] = a
}
}
v.tableMX.Unlock()
}
// Hints options
func (v *tableView) hints() hints {