Fix the bug in the helm template for operator envs vars when they are numeric #552
+81
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
We had a bug in our helm templating function when we set the env vars
INIT_DATABASE_VERSION,DATABASE_VERSION,INIT_OPS_MANAGER_VERSION, andINIT_APPDB_VERSIONusing the helm values that are passed for the helm fields.Values.initDatabase.version,.Values.database.version,.Values.initOpsManager.versionand.Values.initAppDb.versionrespectively.Below is the snippet from our
oprator.yaml.If the values are alphanumeric (
1.2.3,jlk345,lkjsdf) that value is set to the env var properly and the deployment manifest is rendered successfully, but it fails when we pass plain numeric values for the helm fieldinitDatabase.version. And fails because value of env var in deployment manifest is expected to be string.The way operator is installed in our E2E tests is we build the images first using the master commit sha (starting 8 chars) as tag and then pass that tag as values for above mentioned helm fields. Now if the commit sha that is generated is alpha numeric, everything works as expected, but if a commit sha doesn't have any alphabets and just has numbers the rendering for operator deployment fails.
We got two commits (1, 2) in master that just had numbers (starting 8 charts) and we passed those numbers to operator to set as env var, the
helm installfailed.This PR fixes that by making sure that we always quote the passed versions to make them string.
Proof of Work
Unit test to make sure the values are quoted. And manual tests. Also CI runs in this PR.
Newly added
Environment Variable Quoting Checkhelm test passes:Checklist
skip-changeloglabel if not needed