jordanwilson230 / kubectl-plugins

A Collection of Plugins for kubectl Integration (exec as any user, context switching, etc).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exec-as will fail if username not in lowercase

stepanselyuk opened this issue · comments

Hello,

test "$(exec "${KUBECTL}" get po "$(whoami|tr -dc '[:alnum:]')-1" 2>/dev/null)" && container="$(whoami|tr -dc '[:alnum:]')-2" || container="$(whoami|tr -dc '[:alnum:]')-1"

Locally I modified it as:

test "$(exec "${KUBECTL}" get po "$(whoami|tr '[:upper:]' '[:lower:]'|tr -dc '[:alnum:]')-1" 2>/dev/null)" && container="$(whoami|tr '[:upper:]' '[:lower:]'|tr -dc '[:alnum:]')-2" || container="$(whoami|tr '[:upper:]' '[:lower:]'|tr -dc '[:alnum:]')-1"

@stepanselyuk nice catch! As soon as I have time, I'll create a PR to test and merge your change in. Thanks!

This has not been fixed yet