-
Notifications
You must be signed in to change notification settings - Fork 49
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
Custodian controller improvements #180
Custodian controller improvements #180
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.
Thanks a lot for the changes and some much needed corrections! Not the least, the long-pending use of gomock
❤️
/lgtm
filteredStatefulSets, err := m.ClaimStatefulsets(statefulSets) | ||
err = m.cl.List(ctx, statefulSets, client.InNamespace(etcd.Namespace), client.MatchingLabelsSelector{Selector: selector}) |
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 for this correction ❤️
I have created the #186 to separately address simplification of the claim logic.
// TODO: (timuthy) remove this as it could block important health checks | ||
if etcd.Status.LastError != nil && *etcd.Status.LastError != "" { | ||
logger.Info(fmt.Sprintf("Requeue item because of last error: %v", *etcd.Status.LastError)) | ||
return ctrl.Result{ | ||
RequeueAfter: 30 * time.Second, | ||
}, nil | ||
} |
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 agree 👍 This should be removed.
@abdasgupta Can you please give your comments? Based on that I will merge. |
I have went through the PR. I am fine with the changes. I also tested it in local cluster. It works as it should. Thanks @timuthy for your 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.
LGTM
How to categorize this PR?
/area robustness
/kind enhancement
What this PR does / why we need it:
This PR improves several aspects of the custodian and etcd controllers as a preparation for #151:
logrus
create/update/delete
events foretcd
andcreate/delete
events forstatefulset
, as well asstatus update
forstatefulsets
. Additionally, a mapper has been introduced which maps thestatefulset
for which an event was triggered to the correspondingetcd
resource. Earlier, this has only worked because in most of the casesetcd
andstatefulset
have the samenamespace/name
.statefulset
anymore, since this is the job of theetcd controller
.statefulset
condition sync has been removed as I didn't find anystatefulsets
whichconditions
in our system and further more, we should not try to sync and information fromstatefulset.status
toetcd
by default. If astatusfulset.status.condition
is really of interest, then it can be read directly from thestatefulset
.I created dedicated commits to simply the review.
Which issue(s) this PR fixes:
Fixes parts of #151
Special notes for your reviewer:
Previously, the custodian controller was setup by the following instruction:
builder.For(&appsv1.StatefulSet{}).Owns(&druidv1alpha1.Etcd{})
This caused event triggers for all
statefulset
s (ref) (-> we don't need to enqueue for events of allstatefulset
s in the cluster) andetcd
s with anownerReference
(ref) (->etcd
s don't have an owner reference).Release note: