diff --git a/change_logs/release_0.1.9.md b/change_logs/release_0.1.9.md new file mode 100644 index 00000000..94184d4b --- /dev/null +++ b/change_logs/release_0.1.9.md @@ -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) diff --git a/internal/cmd/root.go b/internal/cmd/root.go index bdfb9ac4..ab002724 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -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", diff --git a/internal/k8s/config.go b/internal/k8s/config.go index de24afad..d8f7dbe9 100644 --- a/internal/k8s/config.go +++ b/internal/k8s/config.go @@ -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 } diff --git a/internal/views/table.go b/internal/views/table.go index c3b3c9b0..11754726 100644 --- a/internal/views/table.go +++ b/internal/views/table.go @@ -31,6 +31,7 @@ type ( sortFn resource.SortFn data resource.TableData cmdBuff *cmdBuff + tableMX sync.Mutex } ) @@ -123,9 +124,13 @@ func (v *tableView) SetColorer(f colorerFn) { // SetActions sets up keyboard action listener. func (v *tableView) setActions(aa keyActions) { - for k, a := range aa { - v.actions[k] = a + v.tableMX.Lock() + { + for k, a := range aa { + v.actions[k] = a + } } + v.tableMX.Unlock() } // Hints options