-
Notifications
You must be signed in to change notification settings - Fork 245
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
base: main
Are you sure you want to change the base?
Conversation
6ae071d
to
0d03da3
Compare
internal/providers/util/unzip.go
Outdated
} | ||
|
||
func GunzipIfNeeded(raw []byte) ([]byte, error) { | ||
if hasGzipMagicNumber(raw) { |
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.
What do you think about inverting this logic so we can un-nest the bulk of the logic here ?
if !hasGzipMagicNumber(raw) { return raw, nil }
...
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 :) |
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.