-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve node removal by validating departed|broken relations #80
Conversation
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.
LGTM!
isinstance(event, ops.RelationDepartedEvent) | ||
and event.relation.name in ["k8s-cluster", "cluster"] | ||
and event.departing_unit |
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.
Nice use of the and
operator 😄
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.
>>> 1 and 2 and 3 and 4
4
if not self._is_node_ready(): | ||
status.add(ops.WaitingStatus("Node not yet Ready")) | ||
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.
This is actually a nice little check for update-status to keep the node from showing "Ready" when -- actually it can't host any workloads yet because it's not Kubernetes Ready
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.
LGTM, great work.
Always fun to learn some new Python magic. (e.g. that and
chains return the last element)
@@ -618,6 +670,39 @@ def _on_update_status(self, _event: ops.UpdateStatusEvent): | |||
except status.ReconcilerError: | |||
log.exception("Can't update_status") | |||
|
|||
def kubectl(self, *args) -> str: |
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.
The charm file starts to get quite large. Maybe it makes sense to split it up in the future, e.g. by moving such utils into their own classes.
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.
it is -- and i got REALLY close to pulling the trigger on that here.
Summary
Attempts to lengthen the amount of time that a leaving node exists to give time to the lead control-plane charm time to remove the unit
Changes
k8s-cluster
andcluster
relations experience a RelationDepartedEventupdate_status
event now checks if the node itself is ready with kubectllast_gasp
now requires the node to be reported not in aReady
at least 3 times before ending the delay