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

Fake Client should generate name for resources #439

Closed
copejon opened this issue Jul 10, 2018 · 3 comments
Closed

Fake Client should generate name for resources #439

copejon opened this issue Jul 10, 2018 · 3 comments
Assignees

Comments

@copejon
Copy link

copejon commented Jul 10, 2018

The Fake Clientset does not behave as expected when the GenerateName field is defined in a resource. On creation, the resource does not get a Name with a unique suffix.

When 2 or more resources are created by the Fake ClientSet in testing, an api error occurs because of a Name collision, e.g. "Pod 'default/' already exists" (where Name is an empty string).

This has become a problem for us in testing a custom controller that creates 2 pods sequentially with the GenerateName field defined.

cc @screeley44 @jeffvance

@liggitt
Copy link
Member

liggitt commented Jul 10, 2018

the fake clientset doesn't attempt to duplicate server-side behavior like validation, name generation, uid assignment, etc. if you want to test things like that, you can add reactors to mock that behavior.

@liggitt
Copy link
Member

liggitt commented Jul 10, 2018

/close

@mihaitodor
Copy link

If anyone is trying to figure out how to add such reactors, I wrote a detailed explanation here: https://stackoverflow.com/questions/68794562/kubernetes-fake-client-doesnt-handle-generatename-in-objectmeta/68794563#68794563

fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue May 7, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue May 7, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue May 8, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue Jun 18, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue Jun 18, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
fossedihelm added a commit to fossedihelm/kubevirt that referenced this issue Jun 24, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
Acedus pushed a commit to Acedus/kubevirt that referenced this issue Jun 27, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
Acedus pushed a commit to Acedus/kubevirt that referenced this issue Jul 2, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
Sreeja1725 pushed a commit to Sreeja1725/kubevirt that referenced this issue Jul 10, 2024
Add the virtclientset to be used when vmirs and vmi
client is interrogated.

Add k8s.io/apiserver/pkg/storage/names dependency to
allow performing server-side name generation behavior.
(kubernetes/client-go#439)

Signed-off-by: fossedihelm <[email protected]>
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

4 participants