-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(akamai): unzip user content #1934
Conversation
6ae071d
to
0d03da3
Compare
fe468da
to
e6d24f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me from a functional aspect. It has been tested successfully with Flatcar with both configuration (gzipped and not gzipped):
$ linode-cli linodes create \
--metadata.user_data "$(cat config.json | gzip | base64 -w0)" \
--label flatcar \
...
$ linode-cli linodes create \
--metadata.user_data "$(cat config.json | base64 -w0)" \
--label flatcar \
...
On the instance:
Flatcar Container Linux by Kinvolk developer 9999.0.0+tormath1-ignition-akamai for Akamai
core@172-236-99-29 ~ $ sudo cat /var/run/ignition.json
{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.5.0-experimental"},"kernelArguments...
- Tested patch here: sys-apps/ignition: pull akamai patch flatcar/scripts#2307
- Dev image available here: http://bincache.flatcar-linux.net/images/amd64/9999.0.0+tormath1-ignition-akamai/flatcar_production_akamai_image.bin.gz (instructions: https://www.flatcar.org/docs/latest/installing/community-platforms/akamai/)
e6d24f9
to
19fab24
Compare
Doesn't the response include a |
At the moment it does not seem that Akamai is sending a
@guilhem do you think that's something Akamai could consider?
That's discussed here I think: #1933 and from what I understand it's not the first time this topic is raised on Ignition. I'm just concerned about relying entirely on this |
I will speak to the metadata team and ask about this header :) |
So the header will not be added soon. What can we do to have this PR merged? |
@jlebon can we have a review? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! Thank you for contributing and thank you for testing @tormath1 ❤️
Functionally it lgtm I have some small nits that I dont feel very strong about but would like to at least bring them up.
And should we add a comment about #1934 (comment) and link an rfe or somthing else
internal/providers/util/unzip.go
Outdated
) | ||
|
||
var ( | ||
gzipMagic = []byte{0x1F, 0x8B, 0x08} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a little bit ambiguous, small nit. Maybe we can call it something like gzipSigniture or add a comment to explain the variable.
Preferably the former, and if we do change the name I think it would clean up some of the helper functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the way to test unzip by using a standard function: http.DetectContentType
.
I also added test to be sure that it's working as expected
@prestist is it something better than with “magic” variables :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guilhem absolutely! 💯
dc6434a
to
7e05458
Compare
@guilhem you have my approval, I just need to see green, looks like we have failing unit tests? |
Awesome 😎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again, and looking into whats going on with CI now. Thank you for bringing that to my attention.
Tracking bug here #1950
@prestist rebase done. |
This pull request introduces functionality to handle compressed userdata in the Linode Metadata Service and includes the implementation of a utility function to decompress gzip data if needed. The most important changes include modifications to the
fetchConfig
function and the addition of a new utility function for gzip decompression.Enhancements to userdata handling:
internal/providers/akamai/akamai.go
: Updated thefetchConfig
function to decompress gzip data if needed before parsing the configuration.New utility function:
internal/providers/util/unzip.go
: Added a new utility functionGunzipIfNeeded
to handle gzip decompression, including a helper functionhasGzipMagicNumber
to check for gzip magic numbers.