amazon-eks-ami
amazon-eks-ami copied to clipboard
Added an optional kernel parameter test to Packer Build
Issue #, if available:
N/A
Description of changes:
In the past, a few users have experienced major issues caused by changing kernel parameters from Amazon Linux upstream that were not caught by amazon-eks-ami maintainers. This PR aims at reducing the risk of releasing breaking changes by comparing the built kernel parameters against the set of 'known good' kernel parameters (in templates/shared/resources/
).
- By default, if there are any changes it will continue the build but issue a warning in the build log. This can be overwritten via
make sysctl_test_throw_err=true
, causing any differences in the kernel parameters to fail the build. - For debugging purposes, this test will also generate and populate the
sysctl_logs
folder. - In order to update the
known good
kernel parameters, simplycp ./sysctl_logs/* ./templates/shared/resources/
- The known good logs are 1:1 with the generated results of
sysctl_logs
, so no further conversion is needed.
- The known good logs are 1:1 with the generated results of
There also exists a blacklist (templates/shared/resources/sysctl_blacklist
) for kernel parameters that are highly volatile and shouldn't be compared (ex; kernel.random.uuid
). This blacklist uses regex and the diff -I
flag to ignore certain parameters.
Added functionality to the existing validate.sh
to compare the kernel parameters (via a sysctl -a -e output) against the set of 'known good' kernel parameters.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Testing Done
- Built on every AMI (46/46) including GPU instances.
- Verified that
sysctl_blacklist
works as intended and accepts changes. - Verified that
sysctl_test_throw_err
flag works as intended.
See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.