Skip to content
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: removes object cache updates from syncers. #2269

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pkg/controllers/resources/persistentvolumeclaims/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ func recreatePersistentVolumeClaim(ctx *synccontext.SyncContext, virtualClient c
}

// make sure we don't set the resource version during create
ctx.ObjectCache.Virtual().Delete(vPVC)
vPVC = vPVC.DeepCopy()
vPVC.ResourceVersion = ""
vPVC.UID = ""
Expand All @@ -285,6 +284,5 @@ func recreatePersistentVolumeClaim(ctx *synccontext.SyncContext, virtualClient c
return nil, errors.Wrap(err, "create pvc")
}

ctx.ObjectCache.Virtual().Put(vPVC)
return vPVC, nil
}
3 changes: 1 addition & 2 deletions pkg/controllers/resources/pods/ephemeral_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *podSyncer) syncEphemeralContainers(ctx *synccontext.SyncContext, physic

// do the actual update
ctx.Log.Infof("Update ephemeral containers for pod %s/%s", physicalPod.Namespace, physicalPod.Name)
updatedPod, err := physicalClusterClient.CoreV1().Pods(physicalPod.Namespace).UpdateEphemeralContainers(ctx, physicalPod.Name, physicalPod, metav1.UpdateOptions{})
_, err = physicalClusterClient.CoreV1().Pods(physicalPod.Namespace).UpdateEphemeralContainers(ctx, physicalPod.Name, physicalPod, metav1.UpdateOptions{})
if err != nil {
// The api-server will return a 404 when the EphemeralContainers feature is disabled because the `/ephemeralcontainers` subresource
// is missing. Unlike the 404 returned by a missing physicalPod, the status details will be empty.
Expand All @@ -75,6 +75,5 @@ func (s *podSyncer) syncEphemeralContainers(ctx *synccontext.SyncContext, physic
return false, fmt.Errorf("update ephemeral containers: %w", err)
}

ctx.ObjectCache.Host().Put(updatedPod)
return true, nil
}
1 change: 0 additions & 1 deletion pkg/controllers/resources/pods/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,5 @@ func (s *podSyncer) assignNodeToPod(ctx *synccontext.SyncContext, pObj *corev1.P
return err
}

ctx.ObjectCache.Virtual().Put(vPod)
return nil
}
2 changes: 0 additions & 2 deletions pkg/controllers/resources/services/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ func recreateService(ctx *synccontext.SyncContext, virtualClient client.Client,
}

// make sure we don't set the resource version during create
ctx.ObjectCache.Virtual().Delete(vService)
vService = vService.DeepCopy()
vService.ResourceVersion = ""
vService.UID = ""
Expand All @@ -257,7 +256,6 @@ func recreateService(ctx *synccontext.SyncContext, virtualClient client.Client,
return err
}

ctx.ObjectCache.Virtual().Put(vService)
return nil
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/controllers/resources/volumesnapshotcontents/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func (s *volumeSnapshotContentSyncer) Sync(ctx *synccontext.SyncContext, event *
if err != nil {
return ctrl.Result{}, err
}
ctx.ObjectCache.Virtual().Put(updated)
}

if !equality.Semantic.DeepEqual(event.Virtual.Status, event.Host.Status) {
Expand All @@ -137,7 +136,6 @@ func (s *volumeSnapshotContentSyncer) Sync(ctx *synccontext.SyncContext, event *
if err != nil && !kerrors.IsNotFound(err) {
return ctrl.Result{}, err
}
ctx.ObjectCache.Virtual().Put(updated)
}

return ctrl.Result{RequeueAfter: time.Second}, nil
Expand Down
6 changes: 0 additions & 6 deletions pkg/controllers/resources/volumesnapshots/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ func (s *volumeSnapshotSyncer) SyncToHost(ctx *synccontext.SyncContext, event *s
if err != nil {
return ctrl.Result{}, err
}

ctx.ObjectCache.Virtual().Put(event.Virtual)
}

return patcher.DeleteVirtualObject(ctx, event.Virtual, event.HostOld, "host object was deleted")
Expand Down Expand Up @@ -115,8 +113,6 @@ func (s *volumeSnapshotSyncer) Sync(ctx *synccontext.SyncContext, event *synccon
if err != nil {
return ctrl.Result{}, err
}

ctx.ObjectCache.Virtual().Put(updated)
}

if !equality.Semantic.DeepEqual(event.Virtual.Status, event.Host.Status) {
Expand All @@ -127,8 +123,6 @@ func (s *volumeSnapshotSyncer) Sync(ctx *synccontext.SyncContext, event *synccon
if err != nil && !kerrors.IsNotFound(err) {
return ctrl.Result{}, err
}

ctx.ObjectCache.Virtual().Put(updated)
}

return ctrl.Result{}, nil
Expand Down
Loading