Skip to content
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

engine: move default image exclusions #2513

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

samuelkarp
Copy link
Contributor

Summary

This commit moves the logic adding default excluded images from the cleanup list to the engine package, away from the config package, and in doing so fixes two bugs:

  1. Prior to this change, any value for ImageCleanupExclusionList provided by a config mechanism other than environmentConfig would be ignored. This is because environmentConfig has the highest precedence, the defaults were added to environmentConfig by parseImageCleanupExclusionList, and config.Merge will only merge a new value when the left config's field is its zero value. Since the default excluded images were populated, environmentConfig's ImageCleanupExclusionList field was never zero.
  2. CachedImageNamePauseContainer hard-coded a name for the pause container image that was used to populate the exclusion list, but the actual name of the pause container is a value populated at link-time into the DefaultPauseContainerImageName and DefaultPauseContainerTag variables. If the value was set to anything other than what was defined in CachedImageNamePauseContainer, the pause container image would not be correctly excluded from image cleanup.

Implementation details

Added defaulting logic to the constructor of dockerImageManager and wrote a test to cover the new logic.

Testing

New tests cover the changes: yes

Description for the changelog

Bug - Fixed a bug that caused configured values for ImageCleanupExclusionList to be ignored in some situations.

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yhlee-aws yhlee-aws added this to the 1.42 milestone Jul 15, 2020
This commit moves the logic adding default excluded images from the
cleanup list to the engine package, away from the config package, and in
doing so fixes two bugs:

1. Prior to this change, any value for ImageCleanupExclusionList
   provided by a config mechanism *other* than environmentConfig would
   be ignored.  This is because environmentConfig has the highest
   precedence, the defaults were added to environmentConfig by
   parseImageCleanupExclusionList, and config.Merge will only merge a
   new value when the left config's field is its zero value.  Since the
   default excluded images were populated, environmentConfig's
   ImageCleanupExclusionList field was never zero.
2. CachedImageNamePauseContainer hard-coded a name for the pause
   container image that was used to populate the exclusion list, but the
   actual name of the pause container is a value populated at link-time
   into the DefaultPauseContainerImageName and DefaultPauseContainerTag
   variables.  If the value was set to anything other than what was
   defined in CachedImageNamePauseContainer, the pause container image
   would not be correctly excluded from image cleanup.

Signed-off-by: Samuel Karp <[email protected]>
@yhlee-aws yhlee-aws merged commit 9a03cfb into aws:dev Jul 15, 2020
@samuelkarp samuelkarp deleted the default-image-exclusions branch July 23, 2020 07:11
@yhlee-aws yhlee-aws mentioned this pull request Jul 23, 2020
@yhlee-aws yhlee-aws modified the milestones: 1.42, 1.42.0 Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants