-
Notifications
You must be signed in to change notification settings - Fork 15
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
DRAFT + WIP [DPE-5661] patch stateful set to ensure pod isn't removed prematurely #348
base: 6/edge
Are you sure you want to change the base?
Conversation
2a9b2bf
to
2a9415f
Compare
2a9415f
to
9c88b59
Compare
0af8c24
to
fc992f0
Compare
# updating the termination grace period is only useful for shards, whose sudden removal | ||
# can result in data-loss | ||
if not self.is_role(Config.Role.SHARD): | ||
return |
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.
im unsure about this bit
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 should be working.
I would try to leave it to run and play with it to see how stable it stays in the time
from lightkube import Client | ||
from lightkube.resources.apps_v1 import StatefulSet | ||
from lightkube.types import PatchType |
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.
Need to import lightkube in pyproject.toml
"spec": { | ||
"template": { | ||
"spec": {"terminationGracePeriodSeconds": ONE_YEAR}, | ||
"metadata": {"annotations": {"force-update": str(int(time.time()))}}, |
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.
What it the force-update annotation useful for here?
patch_data = { | ||
"spec": { | ||
"template": { | ||
"spec": {"terminationGracePeriodSeconds": ONE_YEAR}, |
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.
Isn't one year a bit too much?
It means that your pod can take up to 1 year to be removed.
I would keep it lower, up to a day?
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 chose a ridiculously long amount on purpose to ensure that shard drainage would have enough time in worst case scenarios.
i.e. if there are jumbo-chunks that we cannot automatically drain (because the user should decide the new shard key) - then that will require user intervention and I would like to give them more than enough time to do so.
name=self.app.name, | ||
namespace=self.model.name, | ||
obj=patch_data, | ||
patch_type=PatchType.MERGE, |
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 think MERGE or STRATEGIC don't change anything here so I would not specify it and keep the default value of STRATEGIC
, but it's a nitpick.
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 should be working.
I would try to leave it to run and play with it to see how stable it stays in the time
81d2589
to
d51f6a2
Compare
d51f6a2
to
f726e56
Compare
Issue
Solution