Skip to content

List namespaced services missing first element #183

Closed
@ahaeber

Description

@ahaeber

When using ListNamespacedServiceWithHttpMessagesAsync and watch I seem to not get the first element of the list.

I tried to follow the example at https://github.com/kubernetes-client/csharp/blob/master/examples/watch/Program.cs to watch list of services in a namespace. At first I always found one service missing in the list of services I got in the watch-response handler. Then I enabled Microsoft.Rest.ServiceClientTracing and found that the missing service is shown in the body of the response from Kubernetes. It does not show traces for the rest of the services, which is a bit weird but I guess that is how watches work.

I also tried simply running the watch example to list pods to see whether there was any difference, but it has the same behavior. In a namespace for Nginx ingress kubectl shows two pods:

$ kubectl get pods -n ingress-nginx
NAME READY STATUS RESTARTS AGE
default-http-backend-170366572-2tc9b 1/1 Running 0 36d
nginx-ingress-controller-3129142458-0x4k6 1/1 Running 0 36d

With the example Program it only shows one "Added" event:

$ dotnet run -- "ingress-nginx"
press ctrl + c to stop watching
Added: name=nginx-ingress-controller-3129142458-0x4k6,labels=[app=ingress-nginx,pod-template-hash=3129142458]

(missing the pod default-http-backend-170366572-2tc9b here)
This is running in an AKS cluster with Kubernetes version 1.7.7.

I looked at the tests (https://github.com/kubernetes-client/csharp/blob/master/tests/KubernetesClient.Tests/WatchTests.cs) and found a few comments that says

first line of response is eaten by WatcherDelegatingHandler

L87, L223, L290
Could it be that the WatcherDelegatingHandler should not eat anything here and pass it to the watch-listener instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions