Open zeropoint46 opened 2 years ago
I modified the script to have something like this:
while getopts "d:t:l:n:" opt
do
case "$opt" in
d) diag="$OPTARG" ;;
t) targetfolder="$OPTARG" ;;
l) limitandavoiddescribe="$OPTARG" ;;
n) namespace="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
# setup k8 command
if [ -z "namespace" ]
then
k8cmd=$(which kubectl)
else
k8cmd="$(which kubectl) -n $namespace"
fi
then I changed all the kubectl commands to something like this:
${k8cmd} get all >> all.txt; ${k8cmd} get all -o yaml >> all.txt;
additional changes need to be done for the python script.
allow specifying namespace for collecting k8 info from cluster. This is esspecially valuable for cases when the cluster is either large or parts of the cluster can't be shared for security reasons and for namespaced deployments of splunk-operator.