add little k8s function, kdcrd, for deleting finalizers from CRDs

This commit is contained in:
Jesse Hitch 2025-07-01 14:43:29 +02:00
parent a74cbdebed
commit e279caeb4f
No known key found for this signature in database
2 changed files with 15 additions and 1 deletions

View file

@ -185,6 +185,11 @@ function kc() {
kubecolor config use-context $1
}
# delete a crd by removing finalizers
function kdcrd() {
kubectl patch crd/$1 -p '{"metadata":{"finalizers":[]}}' --type=merge
}
# help text for k commands
function khelp {
BLUE='\033[1;34m'
@ -195,6 +200,7 @@ function khelp {
echo -e "${GREEN}kc${NC} = ${BLUE}k config use-context (switch to EXACT cluster name)${NC}";
echo -e "${GREEN}kcc${NC} = ${BLUE}echoes current k8s cluster you're connecting to${NC}";
echo -e "${GREEN}kd${NC} = ${BLUE}k describe${NC}";
echo -e "${GREEN}kdcrd${NC} = ${BLUE}k delete crd${NC}";
echo -e "${GREEN}kdn${NC} = ${BLUE}k describe nodes${NC}";
echo -e "${GREEN}ke${NC} = ${BLUE}k exec -it${NC}";
echo -e "${GREEN}kfd${NC} <pod-name> = ${BLUE}k force delete of pod${NC}";

View file

@ -41,7 +41,7 @@ complete -F _kgsvc_completions kgsvc
# kubernetes configmaps
_kgcm_completions()
{
COMPREPLY=($(compgen -W "$(kubecolor get configmap --no-headers -o custom-columns=Name:.metadata.name)" -- "${COMP_WORDS[1]}"))
COMPREPLY=($(compgen -W "$(kubecolor get configmap --no-headers -o custom-columns=name:.metadata.name)" -- "${COMP_WORDS[1]}"))
}
complete -F _kgcm_completions kgcm
@ -54,3 +54,11 @@ _kc_completions()
}
complete -F _kc_completions kc
# kubernetes crds
_kdcrd_completions()
{
COMPREPLY=($(compgen -W "$(kubecolor get crds --no-headers -o custom-columns=name:.metadata.name)" -- "${COMP_WORDS[1]}"))
}
complete -F _kdcrd_completions kdcrd