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

start many informer,pod resourceVersion will duplicate base64。 #3377

Closed
niuyueyang1996 opened this issue Apr 10, 2023 · 8 comments · Fixed by #3376
Closed

start many informer,pod resourceVersion will duplicate base64。 #3377

niuyueyang1996 opened this issue Apr 10, 2023 · 8 comments · Fixed by #3376
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@niuyueyang1996
Copy link
Contributor

niuyueyang1996 commented Apr 10, 2023

What happened:
when i start two or more informer,i see pod resourceVersion changed
1.659432795
2.eyJ3eC10ZXN0IjoiNjU5NDMyNzk1In0
{"wx-test":"659432795"}
3.eyJ3eC10ZXN0IjoiZXlKM2VDMTBaWE4wSWpvaU5qVTVORE15TnprMUluMCJ9
{"wx-test":"eyJ3eC10ZXN0IjoiNjU5NDMyNzk1In0"}

if i list pod,pod resourceVersion is number,like 659432795,i don't understand why not use base64 code?

if i start one watcher to watch pod ,pod resourceVersion is base64 code like eyJ3eC10ZXN0IjoiNjU5NDMyNzk1In0

if i start more than one watcher to watch pod,pod resourceVersion maybe is wrong base64 code like eyJ3eC10ZXN0IjoiZXlKM2VDMTBaWE4wSWpvaU5qVTVORE15TnprMUluMCJ9. this is bug.

What you expected to happen:
list pod resourceVersion is base64.
start more than one watcher to wach pod,pod resourceVersion only base64 one times.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Karmada version:
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version):
  • Others:
@XiShanYongYe-Chang
Copy link
Member

Thanks~, In favor of #3376
/assign @niuyueyang1996

@ikaven1024
Copy link
Member

if i list pod,pod resourceVersion is number,like 659432795,i don't understand why not use base64 code?

Yes, we only convert the resourceVersion in List, not items. Such as:

kind: PodList
apiVersion: v1
metadata:
    resourceVersion:    <= converted RV
items:
  - metadata:
        name: pod1
        resourceVersion:     <= original RV

Mostly we use the List rv, rather than item rv, such as List&Watch. So we don't convert it.

If you have the case using rv in items, welcome your pr to supplement it.

@niuyueyang1996
Copy link
Contributor Author

when i use informer.
first will list all resource, all resource resourceVersion is number.
after some resource change, watch event will make resourceVersion be base64code.
if i use resourceVersion to sort resource, the resourceVersion will inconsistent.

@ikaven1024
Copy link
Member

if i use resourceVersion to sort resource, the resourceVersion will inconsistent.

In k8s doc https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions:
You must not assume resource versions are numeric or collatable. API clients may only compare two resource versions for equality (this means that you must not compare resource versions for greater-than or less-than relationships).

@niuyueyang1996
Copy link
Contributor Author

if i use resourceVersion to sort resource, the resourceVersion will inconsistent.

In k8s doc https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions: You must not assume resource versions are numeric or collatable. API clients may only compare two resource versions for equality (this means that you must not compare resource versions for greater-than or less-than relationships).

if i use informer like informers.NewSharedInformerFactory(clientset, time.Second*30).
the informer will list all resource 30 seconds.
example:
pod a resourceVersion 1
1.first list resourceVersion is 1
2.pod change resourceVersion is 2 with base64Encode
3.second list pod resourceVersion change to 2.

step2 to step3, pod without resourceVersion change,but client receive resourceVersion is changed

@ikaven1024
Copy link
Member

I will test it at my free time. Thanks for your feedback.

@XiShanYongYe-Chang
Copy link
Member

Hi @niuyueyang1996, with the integration of #3376 , the current issue is closed.

For the get/list resourceVersion, you can create an issue to trace the issue.

@niuyueyang1996
Copy link
Contributor Author

if i use informer like informers.NewSharedInformerFactory(clientset, time.Second*30). the informer will list all resource 30 seconds. example: pod a resourceVersion 1 1.first list resourceVersion is 1 2.pod change resourceVersion is 2 with base64Encode 3.second list pod resourceVersion change to 2.

step2 to step3, pod without resourceVersion change,but client receive resourceVersion is changed

#3382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
3 participants