summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-01-26 21:59:28 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-02-05 01:13:01 +0100
commit058c64ae668191ca8223afa581c7b3214b52fe4a (patch)
tree8fc6c8f1bb23cf8606d0a2e371979f5b3da23567 /ci
parent30d5ba634a5c249697509d7c4f29f4aca0597457 (diff)
[PDF] Switch to generate_config, unify templates
- move bash template handling (previously expanded via `envsubst`) to lib.sh; - move j2 template handling to lib.sh; - move virsh network templates to 'mcp/scripts/virsh_net' subdir; - switch virsh network templates from `envsubst` expansion to j2 and leverage generate_config.py, similar to PDF Fuel installer adapter; - add relevant runtime env vars (e.g. SALT_MASTER, MAAS_IP) on the fly to PDF, to consume them in templates like params coming from PDF; - parameterize virsh network definitions based on PDF (mgmt, public); JIRA: FUEL-322 Change-Id: Ib94e78fc4f25797b9354a0552e884104da5d0003 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy.sh45
1 files changed, 8 insertions, 37 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
index b6ff801bd..20c002674 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -120,7 +120,6 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
REPO_ROOT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")
DEPLOY_DIR=$(cd "${REPO_ROOT_PATH}/mcp/scripts"; pwd)
STORAGE_DIR=$(cd "${REPO_ROOT_PATH}/mcp/deploy/images"; pwd)
-RECLASS_CLUSTER_DIR=$(cd "${REPO_ROOT_PATH}/mcp/reclass/classes/cluster"; pwd)
DEPLOY_TYPE='baremetal'
BR_NAMES=('admin' 'mgmt' 'private' 'public')
OPNFV_BRIDGES=('pxebr' 'mgmt' 'internal' 'public')
@@ -263,27 +262,12 @@ fi
# Clone git submodules and apply our patches
make -C "${REPO_ROOT_PATH}/mcp/patches" deepclean patches-import
-# Convert Pharos-compatible POD Descriptor File (PDF) to reclass model input
-PHAROS_GEN_CONFIG_SCRIPT="./pharos/config/utils/generate_config.py"
-PHAROS_INSTALLER_ADAPTER="./pharos/config/installers/fuel/pod_config.yml.j2"
-BASE_CONFIG_PDF="${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}.yaml"
-BASE_CONFIG_IDF="${BASE_CONFIG_URI}/labs/${TARGET_LAB}/idf-${TARGET_POD}.yaml"
-LOCAL_PDF="${STORAGE_DIR}/$(basename "${BASE_CONFIG_PDF}")"
-LOCAL_IDF="${STORAGE_DIR}/$(basename "${BASE_CONFIG_IDF}")"
-LOCAL_PDF_RECLASS="${STORAGE_DIR}/pod_config.yml"
-rm -f "${LOCAL_PDF_RECLASS}"
-ln -sf "$(readlink -f "../config/labs/local")" "./pharos/labs/"
-if ! curl --create-dirs -o "${LOCAL_PDF}" "${BASE_CONFIG_PDF}"; then
- notify_e "[ERROR] Could not retrieve PDF (Pod Descriptor File)!"
-elif ! curl -o "${LOCAL_IDF}" "${BASE_CONFIG_IDF}"; then
- notify_e "[ERROR] Could not retrieve IDF (Installer Descriptor File)!"
-elif ! "${PHAROS_GEN_CONFIG_SCRIPT}" -y "${LOCAL_PDF}" \
- -j "${PHAROS_INSTALLER_ADAPTER}" > "${LOCAL_PDF_RECLASS}"; then
- notify_e "[ERROR] Could not convert PDF+IDF to reclass model input!"
-fi
+# Expand scenario files, pod_config based on PDF
+SCENARIO_DIR="$(readlink -f "../config/scenario")"
+do_templates "${REPO_ROOT_PATH}" "${STORAGE_DIR}" "${TARGET_LAB}" \
+ "${TARGET_POD}" "${BASE_CONFIG_URI}" "${SCENARIO_DIR}"
# Check scenario file existence
-SCENARIO_DIR="../config/scenario"
if [ ! -f "${SCENARIO_DIR}/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then
notify_e "[ERROR] Scenario definition file is missing!"
fi
@@ -293,6 +277,10 @@ if [ ! -f "${SCENARIO_DIR}/defaults-$(uname -i).yaml" ]; then
notify_e "[ERROR] Scenario defaults file is missing!"
fi
+# Expand jinja2 templates based on PDF data and env vars
+do_templates "${REPO_ROOT_PATH}" "${STORAGE_DIR}" "${TARGET_LAB}" \
+ "${TARGET_POD}" "${BASE_CONFIG_URI}"
+
# Get required infra deployment data
set +x
eval "$(parse_yaml "${SCENARIO_DIR}/defaults-$(uname -i).yaml")"
@@ -329,23 +317,6 @@ for sc in ${base_image_flavors}; do
done
virtual_repos_pkgs=${virtual_repos_pkgs%^}
-# Expand reclass and virsh network templates
-for tp in "${RECLASS_CLUSTER_DIR}/all-mcp-arch-common/opnfv/"*.template \
- net_*.template; do
- eval "cat <<-EOF
- $(<"${tp}")
- EOF" 2> /dev/null > "${tp%.template}"
-done
-
-# Convert Pharos-compatible PDF to reclass network definitions
-find "${RECLASS_CLUSTER_DIR}" -name '*.j2' | while read -r tp
-do
- if ! "${PHAROS_GEN_CONFIG_SCRIPT}" -y "${LOCAL_PDF}" \
- -j "${tp}" > "${tp%.j2}"; then
- notify_e "[ERROR] Could not convert PDF to reclass network defs!"
- fi
-done
-
# Determine 'admin', 'mgmt', 'private' and 'public' bridge names based on IDF
for ((i = 0; i < ${#BR_NAMES[@]}; i++)); do
br_jump=$(eval echo "\$parameters__param_opnfv_jump_bridge_${BR_NAMES[i]}")