Fix snapshot/diagnostic url parsing #109
Open
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.
Description
The current version of the agent spits out tons of messages about not being able to get the diagnostics. The problem is that when you have a Kubernetes Deployment with:
Then after you apply it, Kubernetes automatically escapes
?
and=
with\
characters. This prevents the current library from successfully parsing the environment variables. This updates the function that parses the environment variable struct to override these two URL member fields with manual parsing that removes any\
characters first. There are likely other public libraries that would handle this edge case correctly, and a longer-term goal I have is to remove the envonfig package from Emissary everywhere since it is incredibly over-complicated. Still, for now, this will ensure that these URLs can be correctly parsed regardless of whether they have escaped special characters or not. This was technically only impacting the diagnostics URl, but I added the same logic for the snapshots URL just in case it ever changes before we get around to removing envconfig (unlikely but possible).Example error prior to this fix:
Fill ALL sections
Documentation
Dependencies
Testing
Testing Strategy
A few words describing your testing strategy, e.g., manual tests, automated tests, extra validations, etc.
Dependencies, related issues, and other notes