Skip to content
Open
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
1 change: 1 addition & 0 deletions simulator/resourceapplier/resourceapplier.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func removeUnnecessaryMetadata(resource *unstructured.Unstructured) *unstructure
resource.SetUID("")
resource.SetGeneration(0)
resource.SetResourceVersion("")
resource.SetCreationTimestamp(metav1.Time{})

return resource
}
Expand Down
3 changes: 3 additions & 0 deletions simulator/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ func (s *Service) applyPods(ctx context.Context, r *ResourcesForLoad, eg *util.S
pod := r.Pods[i]
if err := eg.Go(func() error {
pod.ObjectMetaApplyConfiguration.UID = nil
pod.ObjectMetaApplyConfiguration.CreationTimestamp = nil
pod.ObjectMetaApplyConfiguration.ResourceVersion = nil

Comment on lines +498 to +500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix it by making SnapshotService use resourceapplier? I think SnapshotService also should use resourceapplier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, removeUnnecessaryMetadata is a private function and cannot be referenced in snapshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the input parameters do not match

Copy link
Contributor

@saza-ku saza-ku Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, removeUnnecessaryMetadata is a private function and cannot be referenced in snapshots.

I mean SnapshotService should use resourceapplier to create resources, not by using clientset.Interface.

And the input parameters do not match

Yeah we might need to think about things like FieldManager. If you aren't having trouble with SnapshotService, you could leave it. I would create another issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, removeUnnecessaryMetadata is a private function and cannot be referenced in snapshots.

I mean SnapshotService should use resourceapplier to create resources, not by using clientset.Interface.

And the input parameters do not match

Yeah we might need to think about things like FieldManager. If you aren't having trouble with SnapshotService, you could leave it. I would create another issue.

I haven't encountered this problem. It seems that all resources that need to be applied should be implemented in this way. In this case, can we merge this PR first, and then I will open a separate one to follow up on your question?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we could first merge the fix to resourceapplier and then fix SnapshotService.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saza-ku Is there anything else I need to do with this PR? Or can it be merged?

pod.WithAPIVersion("v1").WithKind("Pod")
_, err := s.client.CoreV1().Pods(*pod.Namespace).Apply(ctx, &pod, metav1.ApplyOptions{Force: true, FieldManager: "simulator"})
if err != nil {
Expand Down