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

KubernetesClient does not use sendInitialEvents for watching #5368

Closed
cwrau opened this issue Jul 31, 2023 · 5 comments · Fixed by #5369
Closed

KubernetesClient does not use sendInitialEvents for watching #5368

cwrau opened this issue Jul 31, 2023 · 5 comments · Fixed by #5369
Assignees
Milestone

Comments

@cwrau
Copy link

cwrau commented Jul 31, 2023

Describe the bug

I'm watching a resource like

kubernetesClient.pods().watch(ListOptionsBuilder().withSendInitialEvents(false).build(), watcher)

but I still receive the initial events and looking at the code here and here I don't see any usage of sendInitialEvents.

Fabric8 Kubernetes Client version

6.8.0

Steps to reproduce

Look at the code or step through a minimal code snippet to see that the option is never used.

Expected behavior

The option is appended to the URL so I don't get the initial events.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

other (please specify in additional context)

Environment

Linux

Fabric8 Kubernetes Client Logs

No response

Additional context

k8s version; 1.27.4

@cwrau cwrau changed the title KubernetesClient does not usesendInitialEvents for watching KubernetesClient does not use sendInitialEvents for watching Jul 31, 2023
@shawkins
Copy link
Contributor

but I still receive the initial events and looking at the code here and here I don't see any usage of sendInitialEvents.

That is correct the client is currently ignorant of sendInitialEvents. However this does not match the behavior of what you are describing - this is an alpha feature that requries a feature gate and sending sendIntialEvents=true to get the initial events. What kubernetes server are you testing against?

Related to #5081

@cwrau
Copy link
Author

cwrau commented Jul 31, 2023

Oh, didn't know that, I just saw the flag and the fact that I was getting an initial list of all resources 😅

I'm just using plain vanilla k8s without any feature gate, installed via kubeadm

This even happens on a 1.25.8 cluster

@shawkins
Copy link
Contributor

Oh, didn't know that, I just saw the flag and the fact that I was getting an initial list of all resources

If you leave the resourceVersion unpopulated or set to 0, then you will be sent the full state as add events https://kubernetes.io/docs/reference/using-api/api-concepts/#semantics-for-watch

Only if you start the watch at a particular resourceVersion will they be omitted.

@cwrau
Copy link
Author

cwrau commented Jul 31, 2023

Oh, didn't know that, I just saw the flag and the fact that I was getting an initial list of all resources

If you leave the resourceVersion unpopulated or set to 0, then you will be sent the full state as add events kubernetes.io/docs/reference/using-api/api-concepts/#semantics-for-watch

Only if you start the watch at a particular resourceVersion will they be omitted.

Ah, I see, then I misunderstood that flag 😅

This can be closed then, thanks for the quick response!

@cwrau cwrau closed this as completed Jul 31, 2023
@shawkins shawkins reopened this Jul 31, 2023
@shawkins
Copy link
Contributor

If you don't mind, I'll reopen this to actually add support for sendInitialEvents and at least resourceVersionMatch - I'll need that later in any case for #5081

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jul 31, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jul 31, 2023
@manusa manusa added this to the 6.9.0 milestone Aug 1, 2023
manusa pushed a commit that referenced this issue Aug 1, 2023
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

Successfully merging a pull request may close this issue.

3 participants