jordanwilson230 / kubectl-plugins

A Collection of Plugins for kubectl Integration (exec as any user, context switching, etc).
Apache License 2.0
624 stars 63 forks source link

exec-as will fail if username not in lowercase #30

Open stepanselyuk opened 3 years ago

stepanselyuk commented 3 years ago

Hello,

https://github.com/jordanwilson230/kubectl-plugins/blob/98ee1158cb6c5952f3f6760ebd462dd2dc41abad/kubectl-exec-as#L88

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"
jordanwilson230 commented 3 years ago

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

marcomancusooutra commented 8 months ago

This has not been fixed yet