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

autocleanup nonECS Containers and Images #1722

Closed
wants to merge 1 commit into from
Closed

autocleanup nonECS Containers and Images #1722

wants to merge 1 commit into from

Conversation

cyastella
Copy link
Contributor

Summary

Automatically cleanup NonECS containers and NonECS images to reduce disk space usage for customers.

Implementation details

(1)Clean NonECS containers and images periodically.
(2)Each time period we delete the images limit ECS_NUM_IMAGES_DELETE_PER_CYCLE (default is 5).
(3)User are able to set env config (ECS_ENABLE_NONECS_IMAGES_REMOVE = true) to realize. Default value is false
(4)The NonECSImages eligible to be deleted sorted by the image size with ascending order.
(5)Users are able to specify the images that they don't want to remove for nonECS images.

Testing

  • Builds on Linux (make release)
  • Builds on Windows (go build -out amazon-ecs-agent.exe ./agent)
  • Unit tests on Linux (make test) pass
  • Unit tests on Windows (go test -timeout=25s ./agent/...) pass
  • Integration tests on Linux (make run-integ-tests) pass
  • Integration tests on Windows (.\scripts\run-integ-tests.ps1) pass
  • Functional tests on Linux (make run-functional-tests) pass
  • Functional tests on Windows (.\scripts\run-functional-tests.ps1) pass

New tests cover the changes:

Description for the changelog

Licensing

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

@cyastella cyastella requested a review from petderek December 5, 2018 22:34
agent/config/config.go Outdated Show resolved Hide resolved
agent/config/config.go Outdated Show resolved Hide resolved
agent/dockerclient/dockerapi/docker_client.go Show resolved Hide resolved
agent/dockerclient/timeout.go Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
@aws aws deleted a comment from cyastella Dec 10, 2018
Copy link
Contributor

@haikuoliu haikuoliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly are minor comments

agent/config/config_test.go Show resolved Hide resolved
agent/dockerclient/dockerapi/docker_client.go Outdated Show resolved Hide resolved
agent/dockerclient/dockerapi/types.go Outdated Show resolved Hide resolved
agent/dockerclient/dockerapi/types.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager_test.go Outdated Show resolved Hide resolved
@@ -118,6 +118,9 @@ additional details on each available environment variable.
| `ECS_IMAGE_CLEANUP_INTERVAL` | 30m | The time interval between automated image cleanup cycles. If set to less than 10 minutes, the value is ignored. | 30m | 30m |
| `ECS_IMAGE_MINIMUM_CLEANUP_AGE` | 30m | The minimum time interval between when an image is pulled and when it can be considered for automated image cleanup. | 1h | 1h |
| `ECS_NUM_IMAGES_DELETE_PER_CYCLE` | 5 | The maximum number of images to delete in a single automated image cleanup cycle. If set to less than 1, the value is ignored. | 5 | 5 |
| `ECS_NONECS_IMAGE_CLEANUP_EXCLUDE` | amazonlinux:2, amazonlinux:1 | The imageCleanupExclusionList includes both ecs and nonecs images that agent won’t cleanup. | | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have jole/eric to review readme

Copy link
Contributor Author

@cyastella cyastella Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readme file will keep at the next PR, need to sync with jole/eric before put PR out.

@cyastella
Copy link
Contributor Author

this pull request is older version, please refer to #1736

@cyastella cyastella closed this Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants