X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=install%2Finstall-nrt.sh;h=906fd31c0eed770bfd00f7fe7258bd2f8421f130;hb=refs%2Fchanges%2F08%2F11608%2F1;hp=4822e9a177afd9bb1a4bba4513db889ef532f11f;hpb=c5655db5780275b07b25b57b767808f2f1eac7d9;p=nonrtric%2Fplt%2Franpm.git diff --git a/install/install-nrt.sh b/install/install-nrt.sh index 4822e9a..906fd31 100755 --- a/install/install-nrt.sh +++ b/install/install-nrt.sh @@ -27,18 +27,45 @@ SAMELINE="\033[0K\r" # Variables -export KHOST=$(kube_get_controlplane_host) +export KUBERNETESHOST=$(kube_get_controlplane_host) if [ $? -ne 0 ]; then - echo $KHOST + echo $KUBERNETESHOST echo "Exiting" exit 1 fi echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" -echo "Kubernetes control plane host: $KHOST" +echo "Kubernetes control plane host: $KUBERNETESHOST" echo "Host obtained from current kubectl context" echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "Checking requirements" +echo " Checking if istio is installed" +kubectl $KUBECONF get authorizationpolicies -A &> /dev/null +if [ $? -ne 0 ]; then + echo " Istio api: kubectl get authorizationpolicies is not installed" + exit 1 +else + echo " OK" +fi +echo " Checking if jq is installed" +tmp=$(type jq) +if [ $? -ne 0 ]; then + echo " Command utility jq (cmd-line json processor) is not installed" + exit 1 +else + echo " OK" +fi +echo " Checking if envsubst is installed" +tmp=$(type envsubst) +if [ $? -ne 0 ]; then + echo " Command utility envsubst (env var substitution in files) is not installed" + exit 1 +else + echo " OK" +fi + echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Restarting istiod, workaround to refresh jwks cache" kubectl rollout restart deployments/istiod -n istio-system @@ -54,22 +81,13 @@ check_error() { fi } -################################################################################## -echo "##### Installing chart: namespaces" -################################################################################## - -helm install --wait namespaces helm/namespaces - -echo "" - ################################################################################## echo "##### Installing chart: nrt-base-0" ################################################################################## -helm install --wait -n nonrtric nrt-base-0 helm/nrt-base-0 +helm install --wait --create-namespace -n nonrtric nrt-base-0 helm/nrt-base-0 # Create realm in keycloak -##export KC_PORT=$(kube_get_nodeport keycloak nonrtric http) . scripts/populate_keycloak.sh create_realms nonrtric-realm @@ -84,63 +102,11 @@ check_error $? generate_client_secrets nonrtric-realm $cid check_error $? -# retcode=0 -# while [ $retcode -eq 0 ]; do -# #NRT_REALM_JWKS=$(kubectl exec -n nonrtric client -- curl -f http://keycloak.nonrtric:8080/realms/nonrtric-realm/protocol/openid-connect/certs) -# NRT_REALM_JWKS=$(curl -fs localhost:31788/realms/nonrtric-realm/protocol/openid-connect/certs) -# if [ $? -eq 0 ]; then -# retcode=1 -# #echo $NRT_REALM_JWKS -# echo "JWKS for nonrtric-realm obtained" -# else -# sleep 3 -# echo "Wating for keycloak to publish JWKS for nonrtric-realm" -# fi -# done - -# export NRT_REALM_JWKS - echo "" -# ################################################################################## -# echo "##### Installing chart httpecho" -# ################################################################################## - -#helm install --wait -n nonrtric httpecho helm/httpecho - - - -# TSEC=$SECONDS -# numok=0 -# while [ $numok -lt 10 ]; do -# echo "" -# echo "Time: $(($SECONDS-$TSEC))" -# cid="console-setup" -# __get_admin_token -# TOKEN=$(get_client_token nonrtric-realm $cid) -# decode_token "$TOKEN" -# curl -fv localhost:31789/ -H "Authorization: Bearer $TOKEN" -# if [ $? -eq 0 ]; then -# let numok=numok+1 -# fi -# sleep 5 -# done - -# TSEC=$SECONDS -# while [ true ]; do -# echo "" -# echo "Time: $(($SECONDS-$TSEC))" -# cid="console-setup" -# __get_admin_token -# TOKEN=$(get_client_token nonrtric-realm $cid) -# decode_token "$TOKEN" -# curl -v localhost:31789/ -H "Authorization: Bearer $TOKEN" -# sleep 5 -# done cid="console-setup" __get_admin_token TOKEN=$(get_client_token nonrtric-realm $cid) -decode_token "$TOKEN" ################################################################################## echo "##### Installing charts: strimzi and nrt-base-1" @@ -153,11 +119,9 @@ helm install --wait strimzi-kafka-crds -n nonrtric strimzi/strimzi-kafka-operato cp opa-rules/bundle.tar.gz helm/nrt-base-1/charts/opa-rule-db/data -#envsubst < helm/nrt-base-1/charts/httpecho/values-template.yaml > helm/nrt-base-1/charts/httpecho/values.yaml - helm install -n nonrtric nrt-base-1 helm/nrt-base-1 - +echo "Waiting for influx db - there may be error messages while trying..." retcode=1 while [ $retcode -eq 1 ]; do retcode=0 @@ -167,7 +131,7 @@ while [ $retcode -eq 1 ]; do sleep 1 elif [ "$CONFIG" == "{}" ]; then echo "Configuring db" - kubectl exec -n nonrtric influxdb2-0 -- influx setup -u bm -p mySuP3rS3cr3tT0keN -o est -b pm-bucket -f + kubectl exec -n nonrtric influxdb2-0 -- influx setup -u admin -p mySuP3rS3cr3tT0keN -o est -b pm-bucket -f if [ $? -ne 0 ]; then retcode=1 sleep 1 @@ -178,12 +142,14 @@ while [ $retcode -eq 1 ]; do done # Save influx user api-token to secret -INFLUXDB2_TOKEN=$(get_influxdb2_token influxdb2-0 nonrtric) -INFLUXDB2_TOKEN=$(echo -n $INFLUXDB2_TOKEN | base64) -PATCHDATA='[{"op": "add", "path": "/data/token", "value": "'$INFLUXDB2_TOKEN'" }]' +B64FLAG="-w 0" +case "$OSTYPE" in + darwin*) B64FLAG="" ;; +esac +INFLUXDB2_TOKEN=$(get_influxdb2_token influxdb2-0 nonrtric | base64 $B64FLAG) +PATCHDATA='[{"op": "add", "path": "/data/token", "value": "'$INFLUXDB2_TOKEN'"}]' kubectl patch secret influxdb-api-token -n nonrtric --type json -p "$PATCHDATA" - echo "Wait for kafka" _ts=$SECONDS until $(kubectl exec -n nonrtric kafka-client -- kafka-topics --list --bootstrap-server kafka-1-kafka-bootstrap.nonrtric:9092 1> /dev/null 2> /dev/null); do @@ -207,7 +173,7 @@ echo "##### Installing: chart ran" ./helm/ran/certs/gen-certs.sh 10 check_error $? -helm install --wait -n ran ran helm/ran +helm install --wait --create-namespace -n ran -f helm/global-values.yaml ran helm/ran echo "" @@ -282,10 +248,7 @@ export APP_CLIENT_SECRET=$(< .sec_nonrtric-realm_$cid) envsubst < helm/nrt-pm/charts/dfc/values-template.yaml > helm/nrt-pm/charts/dfc/values.yaml - -#envsubst < helm/nrt-pm/charts/ics/values-template.yaml > helm/nrt-pm/charts/ics/values.yaml - -helm install --wait -n nonrtric nrt-pm helm/nrt-pm +helm install --wait -f helm/global-values.yaml -n nonrtric nrt-pm helm/nrt-pm echo "" @@ -294,4 +257,4 @@ echo "ranpm installed" echo "Wait until all pods are running before installation additional charts" echo "Do: 'kubectl get po -n nonrtric' and verify that all pods are in status Running" echo " and all included containers are Ready" -echo "######################################################################" +echo "######################################################################" \ No newline at end of file