From: aravind.est Date: Thu, 17 Apr 2025 14:02:36 +0000 (+0100) Subject: Add flag to control strimzi secret copy X-Git-Tag: l-release~31^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=6bf6ac9a02aec8082e3ae1c47d1d4c020544df72;p=it%2Fdep.git Add flag to control strimzi secret copy New flag added based on which the decision to copy the secret is taken. If the specific service is not enabled. The respective secret will not be copied to the smo namespace. Issue-ID: NORTRIC-1020 Change-Id: I794120b4d0de6b4c3d0687aa4574d2230b80c83b Signed-off-by: aravind.est --- diff --git a/smo-install/helm-override/default/oran-override.yaml b/smo-install/helm-override/default/oran-override.yaml index e96ce319..c724693e 100644 --- a/smo-install/helm-override/default/oran-override.yaml +++ b/smo-install/helm-override/default/oran-override.yaml @@ -139,8 +139,12 @@ dashboard: ######### SMO ######### smo: installTeiv: true - #List of secrets to be copied from ONAP namespace to SMO + # List of secrets to be copied from ONAP namespace to SMO + # Based on the dependsOn value, the secrets will be copied to the SMO namespace secrets: - - topology-exposure-ku - - topology-ingestion-ku - - redpanda-console-ku \ No newline at end of file + - name: topology-exposure-ku + dependsOn: smo.installTeiv + - name: topology-ingestion-ku + dependsOn: smo.installTeiv + - name: redpanda-console-ku + dependsOn: nonrtric.installRanpm \ No newline at end of file diff --git a/smo-install/scripts/sub-scripts/install-smo.sh b/smo-install/scripts/sub-scripts/install-smo.sh index b676af44..1b64dec7 100755 --- a/smo-install/scripts/sub-scripts/install-smo.sh +++ b/smo-install/scripts/sub-scripts/install-smo.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved. +# Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -39,13 +39,26 @@ check_for_secrets() { 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 # This enables the strimzi entity operator to create the secrets as necessary # 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 '.smo.secrets[]' $OVERRIDEYAML) +SECRETS_SIZE=$(yq '.smo.secrets | length' $OVERRIDEYAML) +if [ "$SECRETS_SIZE" -eq 0 ]; then + echo "No secrets to copy from onap namespace" + exit 0 +else + for i in $(seq 0 $((SECRETS_SIZE - 1))); do + secret=$(yq ".smo.secrets[$i].name" $OVERRIDEYAML) + dependsOn=$(yq ".smo.secrets[$i].dependsOn" $OVERRIDEYAML) + if [ $(yq ".$dependsOn" $OVERRIDEYAML) != "true" ]; then + echo "$dependsOn is not set to true. Skipping $secret copy..." + continue + fi + 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 +fi