v3.8.0
===================================================================== --- Changes ------------------------------ - kubectl driver updates; getting better, but still need to fix autocomplete in certain circumstances - added -y|--yes flags to scwrypts to auto-accept user-prompts (use with caution) - figured out the whole mikefarah/yq vs kislyuk/yq thing; use YQ for compatiblity --- Bug fixes ---------------------------- - helm template generation now loads values in a more appropriate order which prevents overwrite by the wrong values file
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
unalias k h >/dev/null 2>&1
|
||||
k() { _SCWRYPTS_KUBECTL_DRIVER kubectl $@; }
|
||||
h() { _SCWRYPTS_KUBECTL_DRIVER helm $@; }
|
||||
f() { _SCWRYPTS_KUBECTL_DRIVER flux $@; }
|
||||
|
||||
|
||||
_SCWRYPTS_KUBECTL_DRIVER() {
|
||||
@ -57,7 +58,7 @@ _SCWRYPTS_KUBECTL_DRIVER() {
|
||||
"
|
||||
|
||||
local USAGE__description="
|
||||
Provides 'k' (kubectl) and 'h' (helm) shorthands to the respective
|
||||
Provides 'k' (kubectl), 'h' (helm), and 'f' (flux) shorthands to the respective
|
||||
utility. These functions leverage redis and scwrypts environments to
|
||||
allow quick selection of contexts and namespaces usable across all
|
||||
active shell instances.
|
||||
@ -100,14 +101,12 @@ _SCWRYPTS_KUBECTL_DRIVER() {
|
||||
--subsession ) SUBSESSION=$2; shift 1 ;;
|
||||
|
||||
-n | --namespace )
|
||||
echo "TODO: set namespace ('$2')" >&2
|
||||
USER_ARGS+=(--namespace $2); shift 1
|
||||
_SCWRYPTS_KUBECTL_DRIVER kubectl meta set namespace $2
|
||||
shift 1
|
||||
;;
|
||||
|
||||
-k | --context | --kube-context )
|
||||
echo "TODO: set context ('$2')" >&2
|
||||
[[ $CLI =~ ^helm$ ]] && USER_ARGS+=(--kube-context $2)
|
||||
[[ $CLI =~ ^kubectl$ ]] && USER_ARGS+=(--context $2)
|
||||
_SCWRYPTS_KUBECTL_DRIVER kubectl meta set context $2
|
||||
shift 1
|
||||
;;
|
||||
|
||||
@ -149,6 +148,7 @@ _SCWRYPTS_KUBECTL_DRIVER() {
|
||||
|
||||
[ $CONTEXT ] && [[ $CLI =~ ^helm$ ]] && CLI_ARGS+=(--kube-context $CONTEXT)
|
||||
[ $CONTEXT ] && [[ $CLI =~ ^kubectl$ ]] && CLI_ARGS+=(--context $CONTEXT)
|
||||
[ $CONTEXT ] && [[ $CLI =~ ^flux$ ]] && CLI_ARGS+=(--context $CONTEXT)
|
||||
|
||||
[[ $STRICT -eq 1 ]] && {
|
||||
[ $CONTEXT ] || ERROR "missing kubectl 'context'"
|
||||
|
@ -30,8 +30,15 @@ SCWRYPTS_KUBECTL_CUSTOM_COMMAND_PARSE__meta() {
|
||||
USAGE__args="set (namespace|context)"
|
||||
USAGE__description="interactively set a namespace or context for '$SCWRYPTS_ENV'"
|
||||
case $2 in
|
||||
namespace | context ) USER_ARGS+=($1 $2) ;;
|
||||
namespace | context ) USER_ARGS+=($1 $2 $3); [ $3 ] && shift 1 ;;
|
||||
-h | --help ) HELP=1 ;;
|
||||
'' )
|
||||
: \
|
||||
&& SCWRYPTS_KUBECTL_CUSTOM_COMMAND__meta set context \
|
||||
&& SCWRYPTS_KUBECTL_CUSTOM_COMMAND__meta set namespace \
|
||||
;
|
||||
return $?
|
||||
;;
|
||||
|
||||
* ) ERROR "cannot set '$2'" ;;
|
||||
esac
|
||||
@ -94,7 +101,7 @@ SCWRYPTS_KUBECTL_CUSTOM_COMMAND__meta() {
|
||||
;;
|
||||
|
||||
set )
|
||||
scwrypts -n --name set-$2 --type zsh --group kubectl -- --subsession $SUBSESSION >/dev/null \
|
||||
scwrypts -n --name set-$2 --type zsh --group kubectl -- $3 --subsession $SUBSESSION >/dev/null \
|
||||
&& SUCCESS "$2 set"
|
||||
;;
|
||||
|
||||
|
Reference in New Issue
Block a user