systemd: build: fix service startup failure when using IMDSv2 - #10221
Conversation
cc450b4 to
08fdd4a
Compare
|
Hi there, any chance this could be merged in soon? We have paused updates on our servers because we don't want to have to write an automation script to disable the fluent-bit repository on each instance. (The related bug affects ~125 instance within my org.) Thanks! |
cosmo0920
left a comment
There was a problem hiding this comment.
I'd confirmed that this patch works under IMDSv2.
Could you rebase off the current master?
This is because at the moment of sending this PR, our CI was broken.
So, we wanted to do CI at least once.
|
I'd confirmed that the same logs on my created EC2 instance: |
d11d346 to
08fdd4a
Compare
PR fluent#9845 added a service dependency "sethostname.service" for Amazon Linux 2, which uses Amazon's Instance Metadata Service (IMDS) to query and set the hostname. This works for instances using the legacy IMDSv1, however it fails when admins have enforced the usage of IMDSv2. This patch is a modification of @cpandya-we comment/work on fluent#10186. Fixes fluent#10186 Signed-off-by: Charlton Stanley <charlton@charltonstanley.com>
08fdd4a to
5d83094
Compare
@cosmo0920 Thanks for verifying my patch. Rebase has been done! |
PR #9845 added a service dependency
sethostname.servicefor Amazon Linux 2, which uses Amazon's Instance Metadata Service (IMDS) to query and set the hostname. This works for instances using the legacy IMDSv1, however it fails when admins have enforced the usage of IMDSv2. This patch is a modification of @cpandya-we's comment/work on #10186. Closes #10186Note: I used modified versions of the code samples @cosmo0920 submitted in #9845. Specifically, note the differences in the packer file, where IMDSv2 support was enabled.
Testing
Log output confirming both
fluent-bit.serviceandsethostname.serviceservice start successfully.Here is the packer template for creating AMI. Note the addition of the the
imds_supportproperty, as well as the additionalmetadata_options.If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.