Skip to content
Snippets Groups Projects

GONRG-4491: Add elastic config to df

Merged Nastassia Rabeichykava (EPAM) requested to merge GONRG-4491-add-elastic-config-to-DF into master
Files
3
@@ -3,6 +3,7 @@
set -ex
IDENTITY_TOKEN=`gcloud auth print-identity-token --audiences=${AUDIENCES}`
DATA_PARTITION_ID_UPPER=${DATA_PARTITION_ID^^}
generate_post_data()
{
@@ -40,6 +41,22 @@ generate_post_data()
"crmAccountID": {
"sensitive": false,
"value": "[${DATA_PARTITION_ID},${DATA_PARTITION_ID}]"
},
"elasticsearch.host": {
"sensitive": false,
"value": "${ELASTIC_HOST}"
},
"elasticsearch.port": {
"sensitive": false,
"value": "${ELASTIC_PORT}"
},
"elasticsearch.user": {
"sensitive": true,
"value": "ELASTIC_USER_${DATA_PARTITION_ID_UPPER}"
},
"elasticsearch.password": {
"sensitive": true,
"value": "ELASTIC_PASS_${DATA_PARTITION_ID_UPPER}"
}
}
}
@@ -55,4 +72,17 @@ status_code=$(curl -X POST \
-H "Content-Type: application/json" \
--data-raw "$(generate_post_data)")
if [ "$status_code" == 201 -o "$status_code" == 409 ] ; then echo partition bootstrap was OK! ; else exit 1 ; fi
if [ "$status_code" == 201 ]
then
echo "partition bootstrap was OK!"
elif [ "$status_code" == 409 ]
then
curl -X PATCH \
--url "http://${PARTITION_NAME}/api/partition/v1/partitions/${DATA_PARTITION_ID}" --write-out "%{http_code}" --silent --output "/dev/null" \
-H "Authorization: Bearer ${IDENTITY_TOKEN}" \
-H "Content-Type: application/json" \
--data-raw "$(generate_post_data)"
echo "partition was patched because datastore has already had some entities!"
else
exit 1
fi
Loading