From 5e966e148b65655af24649f303d3948b33fbb419 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 00:43:10 -0600 Subject: [PATCH 1/3] test new regex to better match apps --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index ad8bf630..472995b5 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0)" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From 4348deb7fe56ec48b5add037064fe01f7b90c7f0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 00:46:17 -0600 Subject: [PATCH 2/3] add space after -0 for dep containers --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 472995b5..b683bcb0 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0)" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From 093d6ca1d7c1f23eabd12d97bd38f67f1baed3e2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 01:01:43 -0600 Subject: [PATCH 3/3] grab containers by namespace name --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b683bcb0..fa2803b6 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0[[:space:]])" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -v "[[:space:]]svclb-" | grep -E "[[:space:]]ix-${app_name}[[:space:]]" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do