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

Add simple ResourceVersion tracking in fake.Clientset #1385

Open
stippi2 opened this issue Oct 30, 2024 · 0 comments
Open

Add simple ResourceVersion tracking in fake.Clientset #1385

stippi2 opened this issue Oct 30, 2024 · 0 comments

Comments

@stippi2
Copy link

stippi2 commented Oct 30, 2024

Currently, the fake.Clientset does not maintain any ResourceVersions on the objects that are added via it's API functions. For example:

client := fake.NewClientset()
namespaces := clientset.CoreV1().Namespaces()

// Create a namespace via the API:
ns := &corev1.Namespace{
	ObjectMeta: metav1.ObjectMeta{
		Name: "test-namespace",
	},
}
_, _ := namespaces.Create(ctx, ns, metav1.CreateOptions{})

// Retrieve the namespace by name
ns, _ = namespaces.Get(context.TODO(), "test-namespace", metav1.GetOptions{})

// ns.ResourceVersion == ""

In the above example, the ResourceVersion of the object is not maintained by the fake client. For some type of tests, it would be a great benefit to update the resource version in the fake client.

We open this issue to get feedback whether this feature is considered valuable. If so, we offer to implement it. We saw there was already an earlier issue that got closed due to lack of activity.

We have successfully implemented the resource version updates by registering a Reactor that watches the Create, Update and Patch actions. But it feels like it would not hurt to have this functionality directly in client-go. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant