From: aravind.est Date: Fri, 25 Oct 2024 09:42:27 +0000 (+0100) Subject: SMO-TEIV: Check secret existence before copy X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F13704%2F1;p=it%2Fdep.git SMO-TEIV: Check secret existence before copy Secrets existence check added before copying it to smo namespace Issue-ID: SMO-154 Change-Id: I3849c574c699040d3ad411e208d0b1ea6172f16a Signed-off-by: aravind.est --- diff --git a/smo-install/scripts/sub-scripts/install-smo.sh b/smo-install/scripts/sub-scripts/install-smo.sh index 04a4665b..4f4187ff 100755 --- a/smo-install/scripts/sub-scripts/install-smo.sh +++ b/smo-install/scripts/sub-scripts/install-smo.sh @@ -23,6 +23,17 @@ OVERRIDEYAML=$1 helm install --debug oran-smo local/smo --namespace smo -f $OVERRIDEYAML +check_for_secrets() { + try=0 + retries=60 + until (kubectl get secret -n onap | grep -P "\b$1\b") >/dev/null 2>&1; do + try=$(($try + 1)) + [ $try -gt $retries ] && exit 1 + echo "$1 not found. Retry $try/$retries" + sleep 10 + done + echo "$1 found" +} # Copying kafka secrets from onap namespace # SMO installation uses ONAP strimzi kafka # All KafkaUser and KafkaTopic resources should be created as part of ONAP namespace @@ -30,5 +41,6 @@ helm install --debug oran-smo local/smo --namespace smo -f $OVERRIDEYAML # Once the secrets are created, it should be copied to the SMO namespace while IFS= read -r secret; do echo "Copying $secret from onap namespace..." + check_for_secrets $secret kubectl get secret $secret -n onap -o json | jq 'del(.metadata["namespace","creationTimestamp","resourceVersion","selfLink","uid","ownerReferences"])' | kubectl apply -n smo -f - done < <(yq r -d0 $OVERRIDEYAML smo.secrets[*]) \ No newline at end of file