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

Fix fluent dsl #1827

Merged
merged 5 commits into from Oct 25, 2019
Merged

Fix fluent dsl #1827

merged 5 commits into from Oct 25, 2019

Conversation

andreaTP
Copy link
Member

The return type of withGracePeriod and of withPropagationPolicy prevent additional composition (and make the two settings mutually exclusive ATM).

The gracePeriod default to 0L using the empty constructor of OperationContext which is possibly harmful (e.g. it will trigger a force kill).

@centos-ci
Copy link

Can one of the admins verify this patch?

@rohanKanojia
Copy link
Member

ok to test

Copy link
Member

@rohanKanojia rohanKanojia left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR 👍 . Could you please add a line to CHANGELOG regarding this change? Also a small test validating the desired change would be nice to have :-)

@rohanKanojia rohanKanojia added the changelog missing A line to changelog.md regarding the change is not added label Oct 23, 2019
Copy link
Member

@iocanel iocanel left a comment

Choose a reason for hiding this comment

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

Overall, it looks good to me.
Along with the changelog, I'd like to see a test or example that demonstrates this improvement.

@@ -922,13 +922,13 @@ public OperationInfo forOperationType(String type) {
}

@Override
public Deletable<Boolean> withGracePeriod(long gracePeriodSeconds)
public FilterWatchListDeletable<T, L, Boolean, Watch, Watcher<T>> withGracePeriod(long gracePeriodSeconds)
Copy link
Member

Choose a reason for hiding this comment

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

Since, it works without breaking anything I am fine with it.

I don't see however, how it solves the two methods being mutually exclusive.

Copy link
Member Author

Choose a reason for hiding this comment

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

withGracePeriod now return a Deletable and on it you can only call delete, you need to do an unsafe cast to be able to chain further methods (i.e. such as withPropagationPolicy)

Copy link
Member Author

Choose a reason for hiding this comment

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

added a "demonstration" test for it

@andreaTP
Copy link
Member Author

added changelog and tests for the changes.

@@ -39,7 +39,8 @@
protected boolean cascading;
protected boolean reloadingFromServer;

protected long gracePeriodSeconds;
// Default to k8s 30s value: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
protected long gracePeriodSeconds = 30L;
Copy link
Contributor

Choose a reason for hiding this comment

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

I run into this issue today when I found out that when deleting pods the termination grace period in my pods is always overwritten to 0 and the pods are basically force deleted.

However, I'm wondering if this is the right fix. It still overwrites whatever the user configured in his pod which is IMHO wrong. I think the default should be -1 which will mean that the gracePeriod is not set in the request and the default from the resource will be used by Kubernetes => that will be either 30 seconds if the user didn't specified anything or whatever the user specified in his pods.

Copy link
Member Author

Choose a reason for hiding this comment

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

haven't had time to test the grace period to -1, but, if it works, I see your concern and I agree on the approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

this PR got already merged, do you mind to follow up?

Copy link
Member

Choose a reason for hiding this comment

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

@andreaTP : oops, my bad. I didn't go through this conversation. I would appreciate if you could test it with gracePeriod set to -1 and create a follow up PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I opened #1833 to change the default grace period value.

@rohanKanojia rohanKanojia removed the changelog missing A line to changelog.md regarding the change is not added label Oct 25, 2019
@rohanKanojia
Copy link
Member

[merge]

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.

None yet

7 participants