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
endpointslicemirroring controller not create endpointslice #112143
Comments
/sig network |
@Dingshujie the first thing the informer does after restart is to list all the endpoint slices existing and send them to the event handler, unless there is a race it seems that the endpointslice should be present on the tracker Checking the code that you linked, how do you know if the comparison is not failing kubernetes/pkg/controller/endpointslice/endpointslice_tracker.go Lines 143 to 161 in e154260
|
@aojea thanks for reploy, endpointslicemirroring controller only add/update endpointsclice to endpointSliceTracker when endpointslice is need to create or update.when controller restarted, informer recevied all endpoint slices, and after reconcile, find nothing to create or update, so the endpointslices not present on endpointSliceTracker. // finalize creates, updates, and deletes slices as specified
func (r *reconciler) finalize(endpoints *corev1.Endpoints, slices slicesByAction) error {
// If there are slices to create and delete, recycle the slices marked for
// deletion by replacing creates with updates of slices that would otherwise
// be deleted.
recycleSlices(&slices)
epsClient := r.client.DiscoveryV1().EndpointSlices(endpoints.Namespace)
// Don't create more EndpointSlices if corresponding Endpoints resource is
// being deleted.
if endpoints.DeletionTimestamp == nil {
for _, endpointSlice := range slices.toCreate {
createdSlice, err := epsClient.Create(context.TODO(), endpointSlice, metav1.CreateOptions{})
if err != nil {
// If the namespace is terminating, creates will continue to fail. Simply drop the item.
if errors.HasStatusCause(err, corev1.NamespaceTerminatingCause) {
return nil
}
return fmt.Errorf("failed to create EndpointSlice for Endpoints %s/%s: %v", endpoints.Namespace, endpoints.Name, err)
}
r.endpointSliceTracker.Update(createdSlice)
metrics.EndpointSliceChanges.WithLabelValues("create").Inc()
}
}
for _, endpointSlice := range slices.toUpdate {
updatedSlice, err := epsClient.Update(context.TODO(), endpointSlice, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("failed to update %s EndpointSlice for Endpoints %s/%s: %v", endpointSlice.Name, endpoints.Namespace, endpoints.Name, err)
}
r.endpointSliceTracker.Update(updatedSlice)
metrics.EndpointSliceChanges.WithLabelValues("update").Inc()
}
for _, endpointSlice := range slices.toDelete {
err := epsClient.Delete(context.TODO(), endpointSlice.Name, metav1.DeleteOptions{})
if err != nil {
return fmt.Errorf("failed to delete %s EndpointSlice for Endpoints %s/%s: %v", endpointSlice.Name, endpoints.Namespace, endpoints.Name, err)
}
r.endpointSliceTracker.ExpectDeletion(endpointSlice)
metrics.EndpointSliceChanges.WithLabelValues("delete").Inc()
}
return nil
} |
/assign |
@Dingshujie did you self-assign because you want to try to fix? |
yes, can you review this bugfixs? #112197 thanks |
I see, so the problem is that the Delete is not handled because the endpointSlice is not in the tracker ... ... and the slice is not in the tracker because after the restart, the tracker starts clean, and the reconcile loop doesn't add it to the tracker, since there is no action to perform on the slice ... if the controller relies on the tracker, maybe we should consider this case on the reconcile loop , so the slice is correctly added to the tracker ... |
/triage accepted |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
What happened?
and endpointslice not recreate until endpoint/service update event or kube-controller-manager restart
What did you expect to happen?
endpointslice will be recreated
How can we reproduce it (as minimally and precisely as possible)?
Anything else we need to know?
after restart, endpointslicemirroring controller sync endpoint once, at that time, endpointslice exist and no need to update, so this endpointslice not add to endpointSliceTracker.
when endpointslicemirroring receive an endpointslice delete event, will check endpointSliceTracker has this endpointslice, if not exist, it will not requeue this endpoint slice,so if there is no relevant event happened,endpointslice will not be recreated.
Kubernetes version
v1.23.5
Cloud provider
OS version
CentOS 7.6
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: