Update the env variable and documentation
[nonrtric/plt/rappmanager.git] / scripts / install / install-acm.sh
index e5182e5..491c1de 100755 (executable)
@@ -29,11 +29,11 @@ K8S_CONFIGURATION_FILE="docker/helm/policy/components/policy-clamp-ac-k8s-ppnt/v
 K8S_VERSIONS_FILE="docker/compose/get-k8s-versions.sh"
 KAFKA_DIR="docker/helm/cp-kafka"
 
-IP_ADDRESS=$(hostname -I | awk '{print $1}')
+IP_ADDRESS=$(hostname -I | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | awk '{print $1}')
 echo "IP Address : $IP_ADDRESS"
 
 A1PMS_HOST=${A1PMS_HOST:-http://policymanagementservice.nonrtric:9080}
-CHART_REPO_HOST=${CHART_REPO_HOST:-'http://'$IP_ADDRESS':8879/charts'}
+CHART_REPO_GET_URI=${CHART_REPO_GET_URI:-'http://'$IP_ADDRESS':8879/charts'}
 
 function wait_for_pods_to_be_running() {
     while [[ $TIME -lt 2000 ]]; do
@@ -56,20 +56,16 @@ git clone "https://gerrit.onap.org/r/policy/docker"
 CWD=$(pwd)
 export WORKSPACE="$CWD/docker"
 
-#Temporary workaround, Should be removed once https://gerrit.onap.org/r/c/policy/docker/+/137075 or similar change is merged
-echo "Updating kafka advertised listeners..."
-sed -i 's|PLAINTEXT_INTERNAL://kafka:9092|PLAINTEXT_INTERNAL://kafka.default.svc.cluster.local:9092|g' $KAFKA_DIR/kafka.yaml
-
 # Kafka installation
 echo "Installing Confluent kafka"
-kubectl apply -f $KAFKA_DIR/zookeeper.yaml
-kubectl apply -f $KAFKA_DIR/kafka.yaml
+# Using "default" as namespace for kafka installation. As the policy CSIT helm charts contains the namespace "default" inbuilt.
+# ACM installation fails to run, If the kubernetes cluster setup with a different default namespace,
+# Expected kafka service is "kafka.default.svc.cluster.local"
+# This can be removed when the kafka charts provided with "default" namespace or when policy CSIT charts can be configurable with different namespace.
+kubectl apply -f $KAFKA_DIR/zookeeper.yaml -n default
+kubectl apply -f $KAFKA_DIR/kafka.yaml -n default
 wait_for_pods_to_be_running
 
-#Temporary workaround. Should be removed once this gets fixed in policy/docker repo
-echo "Update policy-db-migrator version..."
-yq eval '.dbmigrator.image="onap/policy-db-migrator:3.1-SNAPSHOT-latest"' -i $ACM_VALUES_FILE
-
 echo "Updating policy docker image versions..."
 bash $K8S_VERSIONS_FILE
 
@@ -87,14 +83,10 @@ for element in "${DISABLE_COMPONENTS[@]}"; do
 done
 
 echo "Updating A1PMS Participant"
-
-#Temporary workaround, Should be removed once https://gerrit.onap.org/r/c/policy/docker/+/137075 or similar change is merged
-sed -i 's|{{ \.Values\.global\.kafkaServer }}:9092|"\0"|g' $A1PMS_CONFIGURATION_FILE
-
 yq eval '.a1pms.baseUrl="'$A1PMS_HOST'"' -i $A1PMS_CONFIGURATION_FILE
 
 echo "Updating the k8s participant repo list"
-yq eval '.repoList.helm.repos += {"repoName":"local","address":"'$CHART_REPO_HOST'"}' -i $K8S_CONFIGURATION_FILE
+yq eval '.repoList.helm.repos += {"repoName":"local","address":"'$CHART_REPO_GET_URI'"}' -i $K8S_CONFIGURATION_FILE
 
 echo "Building policy helm charts..."
 helm dependency build docker/helm/policy/