Skip to content

Commit

Permalink
adds k8 function to raw search resource on cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Gohlke committed Aug 24, 2023
1 parent da6453e commit 50cf691
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ function k8_eks_choose_cluster {
| gum choose --height=20 \
| xargs aws eks --region eu-central-1 update-kubeconfig --name
}

function k8_kubectl_find {

if [[ -z $1 ]]; then
echo "missing argument"
else
kubectl get -A crds --no-headers --ignore-not-found 2>/dev/null | awk '{ print $1 }' |xargs -I{} /bin/bash -c "echo '> searching in {}' && kubectl get -A {} 2>/dev/null | grep $1"
kubectl api-resources --verbs=list -o name 2>/dev/null | xargs -I{} -n 1 /bin/bash -c "echo '> searching in {}' && kubectl get {} --show-kind 2>/dev/null | grep $1"
fi
}

0 comments on commit 50cf691

Please sign in to comment.