From 85cbb5eb5b00055ce7137f8a48e2cd725308dc27 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 12:43:26 +0100 Subject: [PATCH] Port DNS to HeavyScript functions --- includes/dns.sh | 27 --------------------------- truetool.sh | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100755 includes/dns.sh diff --git a/includes/dns.sh b/includes/dns.sh deleted file mode 100755 index 0e12e90a..00000000 --- a/includes/dns.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -dns(){ - echo -e "${BWhite}Service DNS Names Tool${Color_Off}" -clear -x -echo "Generating Internal Service DNS Names..." -#ignored dependency pods, may need to add more in the future. -dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" - -# Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) - -# Pulling all ports -all_ports=$(k3s kubectl get service -A) - -clear -x -count=0 -for i in "${main[@]}" -do - [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - [[ -n "$port" ]] && echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L -} -export -f dns diff --git a/truetool.sh b/truetool.sh index 6e03990f..e7801881 100755 --- a/truetool.sh +++ b/truetool.sh @@ -19,7 +19,7 @@ source includes/chores.sh # shellcheck source=includes/colors.sh source includes/colors.sh # shellcheck source=includes/dns.sh -source includes/dns.sh +source functions/dns.sh # shellcheck source=includes/help.sh source includes/help.sh # shellcheck source=includes/help.sh