Skip to content

Commit 99376ed

Browse files
committed
feat: updating watson discovery backup restore scripts for 5.3.0.
1 parent 9281a3a commit 99376ed

7 files changed

Lines changed: 527 additions & 49 deletions

File tree

discovery-data/latest/all-backup-restore.sh

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Basically, you don't need these advanced options.
4242
--datastore-archive-option="<tar_option>" Tar options for compression used on archiving the backup files of ElasticSearch, MinIO and internal configuration. Default "-z".
4343
--postgresql-archive-option="<tar_option>" Tar options for compression used on archiving the backup files of postgres. Note that the backup files of postgresql are archived on its pod by default. Default "-z".
4444
--etcd-archive-option="<tar_option>" Tar options used on archiving the backup files of etcd. Note that the backup files of etcd are archived on its pod by default. Default "-z".
45-
--reindex-old-index Reindex elastic search indices from version 6 to 7 before making the backup. If existing elastic search indices version is already 7, this flag does nothing. They have to be reindexed if you want to restore to 4.8.x. Reindex actually won't change your data, but it takes time. If you want to make the backup without reindex, use '--ignore-old-index' instead.
46-
--ignore-old-index Whether to skip reindexing old (version 6) elastic search indices before making the backup. You can proceed backup without reindex, but you can't restore the backup data to 4.8.x.
45+
--reindex-old-index Reindex old Elasticsearch indices before making a backup. If you want to restore into 4.8.6 and later, you'll need to reindex to elasticsearch7. If you want to restore into 5.3.0 and later, you'll need to reindex to opensearch2. Reindex actually won't change your data, but it takes time. If you want to make the backup without reindex, use '--ignore-old-index' instead.
46+
--ignore-old-index Whether to skip reindexing old elastic search indices before making the backup.
4747
--skip-verify-archive Skip the all verifying process of the archive.
4848
--skip-verify-backup Skip verifying the backup file.
4949
--skip-verify-datastore-archive Skip verifying the archive of datastores.
@@ -381,9 +381,9 @@ if ! "${BACKUP_RESTORE_IN_POD:-false}" ; then
381381
fi
382382

383383
if [ ${COMMAND} = 'backup' ] ; then
384-
if [ $(compare_version "${WD_VERSION}" "5.2.0") -lt 0 ] ; then
385-
ELASTIC_VERSION=$(get_elastic_version)
386-
validate_elastic_version "${ELASTIC_VERSION}"
384+
if [ $(compare_version "${WD_VERSION}" "5.3.0") -lt 0 ] ; then
385+
ELASTIC_INDEX_VERSION=$(get_ELASTIC_INDEX_VERSION)
386+
validate_ELASTIC_INDEX_VERSION "${ELASTIC_INDEX_VERSION}"
387387
fi
388388
if [ $(compare_version "${WD_VERSION}" "4.0.6") -ge 0 ] ; then
389389
create_backup_instance_mappings
@@ -393,10 +393,24 @@ if [ ${COMMAND} = 'backup' ] ; then
393393
quiesce
394394
fi
395395
fi
396-
if [ $(compare_version "${WD_VERSION}" "5.2.0") -lt 0 ] ; then
397-
if [[ ${ELASTIC_VERSION} = "ES6" ]] && [[ ${REINDEX_OLD_INDEX} = "true" ]]; then
398-
reindex_elastic_es6
399-
fi
396+
# Reindex old indices if requested (only for versions before OpenSearch 2 / 5.3.0)
397+
if [[ ${REINDEX_OLD_INDEX} = "true" ]]; then
398+
# Reindex ES6 -> ES7 (WD versions: 2.2.0 <= version < 5.2.0)
399+
if [ $(compare_version "${WD_VERSION}" "2.2.0") -ge 0 ] && \
400+
[ $(compare_version "${WD_VERSION}" "5.2.0") -lt 0 ] && \
401+
[[ ${ELASTIC_INDEX_VERSION} = "ES6" ]]; then
402+
reindex_elastic "${ELASTIC_INDEX_VERSION}"
403+
ELASTIC_INDEX_VERSION=$(get_ELASTIC_INDEX_VERSION)
404+
validate_ELASTIC_INDEX_VERSION "${ELASTIC_INDEX_VERSION}"
405+
fi
406+
# Reindex ES7 -> OS2 (WD versions: 4.8.6 <= version < 5.3.0)
407+
if [ $(compare_version "${WD_VERSION}" "4.8.6") -ge 0 ] && \
408+
[ $(compare_version "${WD_VERSION}" "5.3.0") -lt 0 ] && \
409+
[[ ${ELASTIC_INDEX_VERSION} = "ES7" ]]; then
410+
reindex_elastic "${ELASTIC_INDEX_VERSION}"
411+
ELASTIC_INDEX_VERSION=$(get_ELASTIC_INDEX_VERSION)
412+
validate_ELASTIC_INDEX_VERSION "${ELASTIC_INDEX_VERSION}"
413+
fi
400414
fi
401415

402416
if [ $(compare_version "${WD_VERSION}" "2.1.3") -ge 0 ] ; then

discovery-data/latest/elastic-backup-restore.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ if [ $(compare_version ${WD_VERSION} "5.2.0") -ge 0 ]; then
312312
brlog "INFO" "Scale down opensearch operator"
313313
OPENSEARCH_CLUSTER=$(get_opensearch_cluster)
314314
OPENSEARCH_VERSION=$(oc ${OC_ARGS} get cluster.opensearch ${OPENSEARCH_CLUSTER} -o jsonpath='{.status.release}{"\n"}')
315-
OPENSEARCH_OPERATOR_DEPLOY=( $(oc get deploy -A -l "olm.owner=ibm-opensearch-operator.v${OPENSEARCH_VERSION}" | tail -n1 | awk '{print $1,$2}') )
315+
OPENSEARCH_OPERATOR_DEPLOY=( $(get_opensearch_operator_deployment) )
316316
oc ${OC_ARGS} scale deploy -n "${OPENSEARCH_OPERATOR_DEPLOY[0]}" "${OPENSEARCH_OPERATOR_DEPLOY[1]}" --replicas=0
317317
trap_add "oc ${OC_ARGS} scale deploy -n ${OPENSEARCH_OPERATOR_DEPLOY[0]} ${OPENSEARCH_OPERATOR_DEPLOY[1]} --replicas=1"
318318
fi
@@ -599,7 +599,8 @@ EOF
599599
run_cmd_in_pod ${ELASTIC_POD} "${restore_whitelist_indices_cmd}" ${OC_ARGS} -c "${ELASTIC_POD_CONTAINER}"
600600
result=$(get_last_cmd_result_in_pod)
601601
brlog "DEBUG" "restore whitelist indices result: ${result}"
602-
if ! echo "${result}" | grep -Eq '"total":1,"failed":0,"successful":1'; then
602+
# TODO handle multiple whitelist indicies case.
603+
if ! echo "${result}" | grep -Eq '"total":1,"failed":0,"successful":1|"index_not_found_exception"'; then
603604
brlog "ERROR" "Could not restore the ${whitelist_indices} index due to the following error: ${result}. Please check the cluster."
604605
clean_up
605606
exit 1

discovery-data/latest/etcd-backup-restore.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,15 @@ mkdir -p ${BACKUP_RESTORE_LOG_DIR}
5454
wd_version=${WD_VERSION:-$(get_version)}
5555

5656
setup_etcd_env
57+
ETCD_VARIABLES=$(export_etcd_variable_command)
5758

5859
# backup etcd
5960
if [ ${COMMAND} = 'backup' ] ; then
6061
BACKUP_FILE=${BACKUP_FILE:-"etcd_snapshot_$(date "+%Y%m%d_%H%M%S").db"}
6162
brlog "INFO" "Start backup etcd..."
6263
run_cmd_in_pod ${ETCD_POD} "rm -rf ${ETCD_BACKUP_DIR} ${ETCD_BACKUP} && \
6364
mkdir -p ${ETCD_BACKUP_DIR} && \
64-
export ETCDCTL_USER='${ETCD_USER}:${ETCD_PASSWORD}' && \
65-
export ETCDCTL_CERT='/etc/etcdtls/operator/etcd-tls/etcd-client.crt' && \
66-
export ETCDCTL_CACERT='/etc/etcdtls/operator/etcd-tls/etcd-client-ca.crt' && \
67-
export ETCDCTL_KEY='/etc/etcdtls/operator/etcd-tls/etcd-client.key' && \
68-
export ETCDCTL_ENDPOINTS='https://${ETCD_SERVICE}:2379' && \
65+
${ETCD_VARIABLES} && \
6966
etcdctl get --prefix '/' -w fields > ${ETCD_BACKUP_FILE}" ${OC_ARGS}
7067

7168
if "${ARCHIVE_ON_LOCAL}" ; then
@@ -116,11 +113,7 @@ if [ ${COMMAND} = 'restore' ] ; then
116113
fi
117114
brlog "INFO" "Restoring data..."
118115
cmd='export ETCDCTL_API=3 && \
119-
export ETCDCTL_USER='${ETCD_USER}':'${ETCD_PASSWORD}' && \
120-
export ETCDCTL_CERT=/etc/etcdtls/operator/etcd-tls/etcd-client.crt && \
121-
export ETCDCTL_CACERT=/etc/etcdtls/operator/etcd-tls/etcd-client-ca.crt && \
122-
export ETCDCTL_KEY=/etc/etcdtls/operator/etcd-tls/etcd-client.key && \
123-
export ETCDCTL_ENDPOINTS=https://'${ETCD_SERVICE}':2379 && \
116+
'${ETCD_VARIABLES}' && \
124117
export ETCD_BACKUP='${ETCD_BACKUP_FILE}' && \
125118
etcdctl del --prefix "/" && \
126119
cat ${ETCD_BACKUP} | \

discovery-data/latest/lib/function.bash

Lines changed: 112 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ get_version(){
150150
fi
151151
}
152152

153+
# Return 0 if wd is installed with helm (non-OLM method). Otherwise 1.
154+
is_managed_by_helm() {
155+
if [ $(compare_version "${WD_VERSION}" "5.3.0") -lt 0 ] ; then
156+
return 1
157+
else
158+
label=$(oc get wd ${OC_ARGS} ${TENANT_NAME} -o jsonpath="{.metadata.labels.app\.kubernetes\.io/managed-by}")
159+
if [[ "$label" == "Helm" ]]; then
160+
return 0 # Managed by Helm.
161+
else
162+
return 1 # Managed by Ansible.
163+
fi
164+
fi
165+
}
166+
153167
# Return the major version, for instance if version is 4.x.y, return 4.
154168
major_version() {
155169
local version="$1"
@@ -715,14 +729,19 @@ get_migrator_tag(){
715729

716730
get_migrator_image(){
717731
local wd_version=${WD_VERSION:-$(get_version)}
732+
DISCOVERY_REGISTRY_NAMESPACE="cp/watson-discovery"
718733
if [ $(compare_version "${wd_version}" "4.6.0") -le 0 ] ; then
719734
echo "$(get_migrator_repo):${MIGRATOR_TAG:-$(get_migrator_tag)}"
720735
else
721736
utils_repo="$(oc get watsondiscoveryapi ${TENANT_NAME} -o jsonpath='{.spec.shared.dockerRegistryPrefix}')"
722737
utils_image="$(oc get watsondiscoveryapi ${TENANT_NAME} -o jsonpath='{.spec.shared.initContainer.utils.image.name}')"
723738
utils_tag="$(oc get watsondiscoveryapi ${TENANT_NAME} -o jsonpath='{.spec.shared.initContainer.utils.image.tag}')"
724739
utils_digest="$(oc get watsondiscoveryapi ${TENANT_NAME} -o jsonpath='{.spec.shared.initContainer.utils.image.digest}')"
725-
echo "${utils_repo}/${utils_image}:${utils_tag}@${utils_digest}"
740+
if [ $(compare_version "${wd_version}" "5.3.0") -lt 0 ] ; then
741+
echo "${utils_repo}/${utils_image}:${utils_tag}@${utils_digest}"
742+
else
743+
echo "${utils_repo}/${DISCOVERY_REGISTRY_NAMESPACE}/${utils_image}:${utils_tag}@${utils_digest}"
744+
fi
726745
fi
727746
}
728747

@@ -1320,62 +1339,124 @@ check_datastore_available(){
13201339
}
13211340

13221341
# Get elastic indices and return its version as a string. Return the oldest index version.
1323-
# Assume there are only version 6 or 7 indices in the cluster.
1324-
get_elastic_version() {
1342+
get_ELASTIC_INDEX_VERSION() {
13251343
ELASTIC_POD=$(get_elastic_pod)
13261344
ELASTIC_POD_CONTAINER=$(get_elastic_pod_container)
1327-
run_script_in_pod ${ELASTIC_POD} "${SCRIPT_DIR}/reindex_es6_indices.sh" "--dry-run" -c "${ELASTIC_POD_CONTAINER}" ${OC_ARGS}
1345+
run_script_in_pod ${ELASTIC_POD} "${SCRIPT_DIR}/reindex_es7_indices.sh" "--check-only" -c "${ELASTIC_POD_CONTAINER}" ${OC_ARGS}
13281346
result=$(get_last_cmd_result_in_pod)
13291347

13301348
if echo "$result" | grep -q "Skip ElasticSearch 6 index"; then
13311349
echo "ES6"
1332-
elif echo "$result" | grep -q "Skip ElasticSearch 7 index"; then
1350+
elif echo "$result" | grep -q "Detected ElasticSearch 7 index"; then
13331351
echo "ES7"
1334-
elif echo "$result" | grep -q "ElasticSearch has no index"; then
1352+
elif echo "$result" | grep -q "Skip OpenSearch 2 index"; then
1353+
echo "OS2"
1354+
elif echo "$result" | grep -q "OpenSearch has no index"; then
13351355
echo "NoIndex"
13361356
else
13371357
echo "Unknown"
13381358
fi
13391359
}
13401360

1341-
validate_elastic_version() {
1342-
ELASTIC_VERSION="${1:-$(get_elastic_version)}"
1361+
validate_ELASTIC_INDEX_VERSION() {
1362+
local wd_version="${WD_VERSION:-$(get_version)}"
1363+
ELASTIC_INDEX_VERSION="${1:-$(get_ELASTIC_INDEX_VERSION)}"
13431364

1344-
if [[ ${ELASTIC_VERSION} = "ES6" ]]; then
1365+
if [[ ${ELASTIC_INDEX_VERSION} = "ES6" ]]; then
13451366
brlog "WARN" "Elasticsearch 6 detected."
13461367
if [[ ${IGNORE_OLD_INDEX} = "true" ]]; then
1347-
brlog "WARN" "Ignoring old index."
1368+
brlog "WARN" "Ignoring elasticsearch 6 index."
13481369
elif [[ ${REINDEX_OLD_INDEX} = "true" ]]; then
1349-
brlog "INFO" "Elasticsearch 6 will be reindexed after quiescing."
1370+
if [ $(compare_version "${WD_VERSION}" "2.2.0") -ge 0 ] && [ $(compare_version "${WD_VERSION}" "5.2.0") -lt 0 ] ; then
1371+
brlog "INFO" "Elasticsearch 6 will be reindexed after quiescing."
1372+
else
1373+
brlog "ERROR" "Detected old index created in ElasticSearch 6 that is not supported in Watson Discovery 4.8.x. They have to be reindexed into elasticsearch7 if you want to restore to 4.8.x or higher. Please reindex into elasticsearch7 using Watson Discovery verison less than 5.2.2. If you would like to ignore the error, run backup script with '--ignore-old-index' option."
1374+
exit 1
1375+
fi
13501376
else
13511377
brlog "ERROR" "Detected old index created in ElasticSearch 6 that is not supported in Watson Discovery 4.8.x. They have to be reindexed if you want to restore to 4.8.x or higher. Reindex actually won't change your data, but it takes time. Run the backup script with '--reindex-old-index' option if you want to reindex them. You can proceed the backup without reindex, but you can't restore the backup data to 4.8.x. If you would like to ignore the error, run backup script with '--ignore-old-index' option."
13521378
exit 1
13531379
fi
13541380
fi
1381+
1382+
if [[ ${ELASTIC_INDEX_VERSION} = "ES7" ]]; then
1383+
brlog "WARN" "Elasticsearch 7 detected."
1384+
if [[ ${IGNORE_OLD_INDEX} = "true" ]]; then
1385+
brlog "WARN" "Ignoring elasticsearch 7 index."
1386+
elif [[ ${REINDEX_OLD_INDEX} = "true" ]]; then
1387+
if [ $(compare_version "${WD_VERSION}" "4.8.6") -ge 0 ] && [ $(compare_version "${WD_VERSION}" "5.3.0") -lt 0 ] ; then
1388+
brlog "INFO" "Elasticsearch 7 will be reindexed after quiescing."
1389+
else
1390+
brlog "ERROR" "Detected old index created in ElasticSearch 7 that is not supported in Watson Discovery 5.3.x. They have to be reindexed into opensearch2 if you want to restore to 5.3.x or higher. Please reindex into opensearch2 using Watson Discovery versions between 4.8.6 and below 5.3.0. If you would like to ignore the error, run backup script with '--ignore-old-index' option."
1391+
exit 1
1392+
fi
1393+
else
1394+
brlog "ERROR" "Detected old index created in ElasticSearch 7 that is not supported in Watson Discovery 5.3.x. They have to be reindexed if you want to restore to 5.3.x or higher. Reindex actually won't change your data, but it takes time. Run the backup script with '--reindex-old-index' option if you want to reindex them. You can proceed the backup without reindex, but you can't restore the backup data to 5.3.x. If you would like to ignore the error, run backup script with '--ignore-old-index' option."
1395+
exit 1
1396+
fi
1397+
fi
13551398
}
13561399

1357-
# Reindex elastic search indices from version 6 to 7.
1358-
reindex_elastic_es6() {
1400+
reindex_elastic() {
1401+
local reindex_source_version=$1
13591402
brlog "INFO" "Reindexing ..."
13601403
ELASTIC_POD_CONTAINER=$(get_elastic_pod_container)
1361-
run_script_in_pod ${ELASTIC_POD} "${SCRIPT_DIR}/reindex_es6_indices.sh" "" -c "${ELASTIC_POD_CONTAINER}" ${OC_ARGS}
1404+
reindex_script=""
1405+
if [[ ${reindex_source_version} = "ES6" ]]; then
1406+
reindex_script="reindex_es6_indices.sh"
1407+
elif [[ ${reindex_source_version} = "ES7" ]]; then
1408+
reindex_script="reindex_es7_indices.sh"
1409+
else
1410+
brlog "ERROR" "Unsupported reindex source version: ${reindex_source_version}"
1411+
exit 1
1412+
fi
1413+
1414+
run_script_in_pod ${ELASTIC_POD} "${SCRIPT_DIR}/${reindex_script}" "" -c "${ELASTIC_POD_CONTAINER}" ${OC_ARGS}
13621415
brlog "INFO" "Reindex completed. Waiting for ElasticSearch status to be green ..."
13631416
# Wait a few moments for elastic search to be ready after the reindex.
13641417
# TODO: implement waiting logic inside of reindex_es6_indices.sh, and remove the sleep below from this function.
13651418
sleep 60
13661419
check_elastic_available || { brlog "ERROR" "ElasticSearch is unavailable"; exit 1; }
13671420
}
13681421

1422+
get_etcd_pod(){
1423+
local wd_version=${WD_VERSION:-$(get_version)}
1424+
if [ $(compare_version ${wd_version} "5.3.0") -lt 0 ] ; then
1425+
echo "$(oc get pods ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l etcd_cluster=${TENANT_NAME}-discovery-etcd)"
1426+
else
1427+
echo "$(oc get pods ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l icpdsupport/podSelector=discovery-etcd)"
1428+
fi
1429+
}
1430+
1431+
export_etcd_variable_command(){
1432+
local wd_version=${WD_VERSION:-$(get_version)}
1433+
setup_etcd_env
1434+
if [ $(compare_version ${wd_version} "5.3.0") -lt 0 ] ; then
1435+
echo "export ETCDCTL_USER='${ETCD_USER}:${ETCD_PASSWORD}' && \
1436+
export ETCDCTL_CERT='/etc/etcdtls/operator/etcd-tls/etcd-client.crt' && \
1437+
export ETCDCTL_CACERT='/etc/etcdtls/operator/etcd-tls/etcd-client-ca.crt' && \
1438+
export ETCDCTL_KEY='/etc/etcdtls/operator/etcd-tls/etcd-client.key' && \
1439+
export ETCDCTL_ENDPOINTS='https://${ETCD_SERVICE}:2379'"
1440+
else
1441+
# In WD 5.3.0+, certificate environment variables are already set in the etcd StatefulSet.
1442+
echo "export ETCDCTL_USER='${ETCD_USER}:${ETCD_PASSWORD}' && \
1443+
export ETCDCTL_ENDPOINTS='https://${ETCD_SERVICE}:2379'"
1444+
fi
1445+
}
13691446

13701447
check_etcd_available(){
1448+
local wd_version=${WD_VERSION:-$(get_version)}
13711449
setup_etcd_env
1372-
ETCD_POD=$(oc get pods ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l etcd_cluster=${TENANT_NAME}-discovery-etcd)
1373-
oc exec ${OC_ARGS} "${ETCD_POD}" -- bash -c "export ETCDCTL_USER='${ETCD_USER}:${ETCD_PASSWORD}' && \
1374-
export ETCDCTL_CERT='/etc/etcdtls/operator/etcd-tls/etcd-client.crt' && \
1375-
export ETCDCTL_CACERT='/etc/etcdtls/operator/etcd-tls/etcd-client-ca.crt' && \
1376-
export ETCDCTL_KEY='/etc/etcdtls/operator/etcd-tls/etcd-client.key' && \
1377-
export ETCDCTL_ENDPOINTS='https://${ETCD_SERVICE}:2379' && \
1378-
etcdctl endpoint health > /dev/null" || return 1
1450+
ETCD_POD=$(get_etcd_pod)
1451+
ETCD_VARIABLES=$(export_etcd_variable_command)
1452+
if [ $(compare_version ${wd_version} "5.3.0") -lt 0 ] ; then
1453+
oc exec ${OC_ARGS} "${ETCD_POD}" -- bash -c "${ETCD_VARIABLES} && \
1454+
etcdctl endpoint health > /dev/null" || return 1
1455+
else
1456+
oc exec ${OC_ARGS} "${ETCD_POD}" -- bash -c "${ETCD_VARIABLES} && \
1457+
etcdctl endpoint health" || return 1
1458+
fi
1459+
13791460
return 0
13801461
}
13811462

@@ -1385,7 +1466,7 @@ setup_etcd_env(){
13851466
ETCD_SECRET=$(oc get secret ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l "tenant=${TENANT_NAME},app in (etcd,etcd-root)")
13861467
ETCD_USER=$(oc get secret ${OC_ARGS} ${ETCD_SECRET} --template '{{.data.username}}' | base64 --decode)
13871468
ETCD_PASSWORD=$(oc get secret ${OC_ARGS} ${ETCD_SECRET} --template '{{.data.password}}' | base64 --decode)
1388-
ETCD_POD=$(oc get pods ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l etcd_cluster=${TENANT_NAME}-discovery-etcd)
1469+
ETCD_POD=$(get_etcd_pod)
13891470
}
13901471

13911472
setup_pg_env(){
@@ -1451,6 +1532,15 @@ get_opensearch_cluster() {
14511532
echo "$(oc get cluster.opensearch ${OC_ARGS} -o jsonpath="{.items[0].metadata.name}" -l tenant=${TENANT_NAME},app=opensearch)"
14521533
}
14531534

1535+
get_opensearch_operator_deployment() {
1536+
local wd_version=${WD_VERSION:-$(get_version)}
1537+
if [ $(compare_version ${wd_version} "5.3.0") -ge 0 ] && is_managed_by_helm; then
1538+
echo "$(oc get deploy -A -l icpdsupport/addOnId=opencontent-opensearch | tail -n1 | awk '{print $1,$2}')"
1539+
else
1540+
echo "$(oc get deploy -A -l "olm.owner=ibm-opensearch-operator.v${OPENSEARCH_VERSION}" | tail -n1 | awk '{print $1,$2}')"
1541+
fi
1542+
}
1543+
14541544
check_elastic_available(){
14551545
ELASTIC_POD=$(get_elastic_pod)
14561546
ELASTIC_POD_CONTAINER=$(get_elastic_pod_container)

discovery-data/latest/lib/restore-updates.bash

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ UPDATE_DIR="$SCRIPT_DIR/src"
66
source "${SCRIPT_DIR}/lib/function.bash"
77

88
ELASTIC_POD_CONTAINER=$(get_elastic_pod_container)
9+
ETCD_VARIABLES=$(export_etcd_variable_command)
910

1011
elastic_updates(){
1112
if ls "$UPDATE_DIR"/*.elupdate &> /dev/null ; then
@@ -31,11 +32,7 @@ etcd_updates(){
3132
for ETCD_COMMAND in "$UPDATE_DIR"/*.etcdupdate; do
3233
value=$(<${ETCD_COMMAND})
3334
oc ${OC_ARGS} exec ${ETCD_POD} -- sh -c "export ETCDCTL_API=3 && \
34-
export ETCDCTL_USER=${ETCD_USER}:${ETCD_PASSWORD} && \
35-
export ETCDCTL_CERT=/etc/etcdtls/operator/etcd-tls/etcd-client.crt && \
36-
export ETCDCTL_CACERT=/etc/etcdtls/operator/etcd-tls/etcd-client-ca.crt && \
37-
export ETCDCTL_KEY=/etc/etcdtls/operator/etcd-tls/etcd-client.key && \
38-
export ETCDCTL_ENDPOINTS=https://${ETCD_SERVICE}:2379 && \
35+
${ETCD_VARIABLES} && \
3936
${value}" >> "${BACKUP_RESTORE_LOG_DIR}/${CURRENT_COMPONENT}.log"
4037
done
4138
fi

0 commit comments

Comments
 (0)