fix(upgrade-job): avoid quotes when setting yaml bools, null, int #334
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.
This PR fixes a the case when yq sets a value other than a string on to a yaml file (i.e. a bool or a null). This removes the
"
character surrounding the set value when the value set is 'true', 'false', an int or 'null'.Description
This upgrade-job needs to be idempotent. The job may restart, and it has to be able to avoid repeating itself. The yq_set_string_value() method sets values with
""
surrounding the values. This works well with the other set values that the helm::values module uses, however, witheventing.enabled
, the value that is expected is a bool, but the yq_set_string_value() method's quotes sets it as a string. The first helm upgrade run (without restarts), works fine, as helm is able to derive the bool value out of the string. However, the helm::chart module expects theeventing.enabled
key to have a value of type bool.This change in the this PR, matches the boolean values 'true' and 'false' to decide if it should avoid using
""
around the value before setting it. This change also handles the cases for 'null' and integer values.How Has This Been Tested?
Tested manually using a kubeadm cluster.