Add klib to populate environment from IMDS userdata #2111
+601
−0
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.
A new klib 'userdata_env' is added. This will attempt to read the 'userdata' from various cloud providers and use it to set environment variables.
This can be used to separate preparing images and populating the environment variables.
Cloud provider typically have IMDS (Instance Metadata service) that is ONLY reachable from within the instance on 169.254.169.254.
While providers have warnings like the following (from Azure):
"
Warning
User data will not be encrypted, and any process on the VM can query this data. You should not store confidential information in user data.
"
Since nanos does not have multiple processes or users this does not apply for nanovms.
See also nanovms/ops#1725 to add support to 'ops' for supplying UserData.