Updated minikube profile name

I fixed the issue with minikube_started() and helm_started() where the
grep command was not grepping the correct docker image and helm chart
due to matching substring. It was solved using helm ls command and the
option --kube-context when minikube eixist to pass minikube profile
and helm ls with the option --namespace when minikube is not exist.

TESTS
========================================

* setup a use profile names "MINIKUBENAME" Eg "stx" and "stx1"
* setup a similar environment to reproduce the issue

Closes-Bug: 1995400
Change-Id: Ic9b2224240e0e02be30957a96e7deb24da122136
Signed-off-by: Willy Njomen <willy.njomen@windriver.com>
This commit is contained in:
Willy Njomen 2023-09-20 13:00:33 -04:00
parent 8ae16c3ac8
commit f44dfffbe5
1 changed files with 17 additions and 2 deletions

View File

@ -70,9 +70,16 @@ CLEAN_CONFIG=0
USE_DOCKER_CACHE=0
minikube_started() {
docker ps | grep kicbase | grep -q $MINIKUBENAME
local result
result=$(
minikube profile list \
| tr -d '|' \
| awk -v profile="$MINIKUBENAME" '{ if ($1 == profile && $7 == "Running") print $1 }'
)
[[ -n "$result" ]]
}
minikube_exists() {
local script=$(cat <<'END'
import json,sys
@ -89,7 +96,15 @@ END
}
helm_started() {
helm ls | grep -q stx
local result
result=$(
if [ "$STX_PLATFORM" == "minikube" ]; then
helm --kube-context "$MINIKUBENAME" ls --short --filter '^stx$'
else
helm --namespace "$STX_K8S_NAMESPACE" ls --short --filter '^stx$'
fi 2>/dev/null
) || true
[[ -n "$result" ]]
}
cmdline_error() {