Repository navigation
fix: quote rendered env values in app store templates - #187
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
An app-store template that renders an env value to a bare YAML number or boolean, for example a chart shipping
SESSION_LIFETIMEasvalue: 12000or a TLS flag asvalue: false, hands the apiserver a number or bool whereenv[].valuemust be a string, so the workload is rejected and never created.applynow walks each rendered document and turns env values that came out as numbers or booleans back into strings before sending them, so such templates install without the chart having to quote every value.Verification
go build ./...,go vet ./...quoteEnvValueson a rendered Deployment manifest: env values8080(float),2(int64) andtrue(bool) each became the equivalent string, and already-string values were untouched.liebianbao(it ships numeric env values such asSESSION_LIFETIME: 12000andREDIS_CACHE_DB: 1, plus boolean ones) before and after this change. Before: the StatefulSet is rejected withjson: cannot unmarshal bool into Go struct field EnvVar.spec.template.spec.containers.env.value of type stringand no workload is created. After: the StatefulSet is created and its pod is scheduled; the template's remaining install problems are its own unsupported parts (a cert-manager Issuer/Certificate and a mongodb provider casos has no engine for) and are untouched by this change.