Merge pull request #20 from Heavybullets8/general-fixes

- Silence git reset output
- change DNS variables
- Remove ignore var
This commit is contained in:
Heavybullets8 2022-09-01 05:11:47 +00:00 committed by GitHub
commit c2d75c7c5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -4,24 +4,23 @@
dns(){ dns(){
clear -x clear -x
echo "Generating DNS Names.." echo "Generating DNS Names.."
# Ignore svclb
dep_ignore='svclb-'
# Pulling pod names # Pulling pod names
k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -Ev -- "$dep_ignore" | sed '1d' >> dns_file k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -v 'svclb-' | sed '1d' >> dns_file
mapfile -t ixName < <(< dns_file awk '{print $4}' | sort -u ) mapfile -t ix_name_array < <(< dns_file awk '{print $4}' | sort -u )
# Pulling all ports # Pulling all ports
all_ports=$(k3s kubectl get service -A) all_ports=$(k3s kubectl get service -A)
clear -x clear -x
count=0 count=0
for i in "${ixName[@]}" for i in "${ix_name_array[@]}"
do do
[[ count -le 0 ]] && echo -e "\n" && ((count++)) [[ count -le 0 ]] && echo -e "\n" && ((count++))
appName=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) full_app_name=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1)
port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") app_name=$(echo "$i" | cut -c 4-)
echo -e "$appName $appName.$i.svc.cluster.local $port" port=$(echo "$all_ports" | grep -E "\s$full_app_name\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}")
echo -e "$app_name $full_app_name.$i.svc.cluster.local $port"
done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port"
rm dns_file rm dns_file
} }

View File

@ -5,7 +5,7 @@ args=("$@")
self_update() { self_update() {
git fetch --tags &>/dev/null git fetch --tags &>/dev/null
git reset --hard git reset --hard &>/dev/null
latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)")
echo "🅂 🄴 🄻 🄵" echo "🅂 🄴 🄻 🄵"
echo "🅄 🄿 🄳 🄰 🅃 🄴" echo "🅄 🄿 🄳 🄰 🅃 🄴"