From 549eb2d99e6225d2dac8ed9cbd585e47b73ed08e Mon Sep 17 00:00:00 2001 From: Le Zhang Date: Tue, 21 Nov 2023 16:57:24 -0500 Subject: [PATCH] Issue open-horizon#3944 (part2) - Bug: agent-install.sh breaks on some k8s environments when when looking for HZN_NAMESPACE_SCOPED env variable Signed-off-by: Le Zhang --- agent-install/agent-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent-install/agent-install.sh b/agent-install/agent-install.sh index fc2761189..e993badeb 100755 --- a/agent-install/agent-install.sh +++ b/agent-install/agent-install.sh @@ -3595,7 +3595,7 @@ function check_agent_deployment_exist() { # check 1) agent image in deployment # eg: {image-registry}:5000/{repo}/{image-name}:{version} - local agent_image_in_use=$($KUBECTL get deployment agent -o jsonpath='{$.spec.template.spec.containers[:1].image}' -n ${AGENT_NAMESPACE}) + local agent_image_in_use=$($KUBECTL get deployment agent -n ${AGENT_NAMESPACE} -o json | jq -r '.spec.template.spec.containers[0].image') # {image-registry}:5000/{repo} local agent_image_on_edge_cluster_registry=${agent_image_in_use%:*} @@ -3603,7 +3603,7 @@ function check_agent_deployment_exist() { log_fatal 3 "Current deployment image registry cannot be updated, please run agent-uninstall.sh and re-run agent-install.sh" fi - local image_pull_secrets_length=$($KUBECTL get deployment agent -n ${AGENT_NAMESPACE} -o jsonpath='{.spec.template.spec.imagePullSecrets}' | jq length) + local image_pull_secrets_length=$($KUBECTL get deployment agent -n ${AGENT_NAMESPACE} -o json | jq '.spec.template.spec.imagePullSecrets' | jq length) local use_image_pull_secrets if [[ "$image_pull_secrets_length" == "1" ]]; then use_image_pull_secrets="true"