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

Prune from JVM hook if Ryuk is disabled #4960

Merged
merged 3 commits into from Jan 31, 2022
Merged

Prune from JVM hook if Ryuk is disabled #4960

merged 3 commits into from Jan 31, 2022

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Jan 28, 2022

a.k.a. Poor Man's Ryuk :D

a.k.a. Poor Man's Ryuk :D
@bsideup bsideup added this to the next milestone Jan 28, 2022
.exec();

containers.parallelStream().forEach(container -> {
stopContainer(container.getId(), container.getImage());
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if the stopContainer method name has become misleading and should be renamed. When I read this, my first thought was that this overall switch construct would stop containers but not explicitly remove them.

Copy link
Member

@kiview kiview Jan 31, 2022

Choose a reason for hiding this comment

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

stop behaves like this for a long time (since forever?) of course (and differentiates from the semantics of Docker's container stop). So while I was always in favor of aligning our domain language to the Docker one, by now this would a such a breaking change of semantics in our API, I am unsure how to easily deliver it?

Copy link
Member

Choose a reason for hiding this comment

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

stopContainer specifically is a private method, and IIRC is only called by this and a stopAndRemove (public) method.

So maybe more do-able?

(+100 for aliging to docker's domain language)

Copy link
Member Author

Choose a reason for hiding this comment

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

Happy to add it to the scope - do you have naming recommendations? reapContainer? :D

Copy link
Member

Choose a reason for hiding this comment

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

@rnorth Ok you are right, I was mixing it up with our public stop() method, which will call stopAndRemoveContainer (which I consider confusing but hard to change).

@bsideup WDTY about just removeContainer, since this would be aligned with the methods for other Docker resources?

  public synchronized void performCleanup() {
      registeredContainers.forEach(this::stopContainer);
      registeredNetworks.forEach(this::removeNetwork);
      registeredImages.forEach(this::removeImage);
  }

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good to me 👍

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

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

Only left some superficial comments - LGTM overall.

@bsideup bsideup requested review from rnorth and kiview January 31, 2022 13:04
@bsideup bsideup merged commit 205f21c into master Jan 31, 2022
@bsideup bsideup deleted the prune_if_no_ryuk branch January 31, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants