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
Fix fluent dsl #1827
Conversation
Can one of the admins verify this patch? |
ok to test |
There was a problem hiding this 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 :-)
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
[merge] |
The return type of
withGracePeriod
and ofwithPropagationPolicy
prevent additional composition (and make the two settings mutually exclusive ATM).The
gracePeriod
default to0L
using the empty constructor ofOperationContext
which is possibly harmful (e.g. it will trigger a force kill).