@@ -34,30 +34,26 @@ if [[ "${USE_VALUES_FILE}" == "true" ]]; then
3434 # Generate a temporary values file from environment variables
3535 # and merge it with the provided VALUES_FILE
3636 TEMP_ENV_VALUES=$( mktemp)
37- trap ' rm -f "${TEMP_ENV_VALUES:-}" "${COMBINED_VALUES:-}" ' EXIT
37+ trap ' rm -f "${TEMP_ENV_VALUES:-}"' EXIT
3838 ${SCRIPT_DIR} /env-to-values.sh " ${TEMP_ENV_VALUES} "
3939
40- # If VALUES_FILE exists, merge it with env-generated values using yq
41- # Otherwise just use the env-generated values
40+ # If VALUES_FILE exists, use both files with Helm's native multi-file
41+ # support (-f). Helm merges values in order, with later files taking
42+ # precedence — so env-generated values override the provided file.
4243 if [[ -f " ${VALUES_FILE} " ]]; then
4344 echo " "
4445 echo " Using provided values file: ${VALUES_FILE} "
4546 cat " ${VALUES_FILE} "
4647 echo " "
47- echo " Merged with environment -based values:"
48+ echo " Environment -based values (takes precedence) :"
4849 cat " ${TEMP_ENV_VALUES} "
4950
50- # Create a combined values file using yq for proper YAML merging
51- COMBINED_VALUES=$( mktemp)
52- if ! command -v yq > /dev/null 2>&1 ; then
53- echo " Error: yq is required to merge YAML values files but was not found in PATH." >&2
54- echo " Install yq: https://github.com/mikefarah/yq" >&2
55- exit 1
56- fi
57- # yq merges YAML properly, with later files taking precedence
58- yq ea ' . as $item ireduce ({}; . * $item )' " ${VALUES_FILE} " " ${TEMP_ENV_VALUES} " > " ${COMBINED_VALUES} "
59- VALUES_FILE=" ${COMBINED_VALUES} "
51+ # Pass both files to helm; the env values file comes second
52+ # so its values take precedence over the override file.
53+ EXTRA_VALUES_FILES=" -f ${VALUES_FILE} "
54+ VALUES_FILE=" ${TEMP_ENV_VALUES} "
6055 else
56+ EXTRA_VALUES_FILES=" "
6157 VALUES_FILE=" ${TEMP_ENV_VALUES} "
6258 fi
6359
@@ -113,7 +109,9 @@ if [[ "${USE_VALUES_FILE}" == "true" ]]; then
113109 echo " Using values file approach: ${VALUES_FILE} "
114110 ${HELM} install ${PROJECT_DIR} /deployments/gpu-operator --generate-name \
115111 -n " ${TEST_NAMESPACE} " \
112+ ${EXTRA_VALUES_FILES} \
116113 -f " ${VALUES_FILE} " \
114+ ${OPERATOR_OPTIONS} \
117115 --wait
118116else
119117 echo " Using --set flags approach"
0 commit comments