Use `WatchAsync` for the functions of both `ListAsync` and `WatchAsync` in `RunAsync` in YARP Kubernetes Ingress Controller
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
### Introduction
The [RunAsync](https://github.com/dotnet/yarp/blob/main/src/Kubernetes.Controller/Client/ResourceInformer.cs#L128) in `ResourceInformer.cs` first invokes [ListAsync](https://github.com/dotnet/yarp/blob/main/src/Kubernetes.Controller/Client/ResourceInformer.cs#L204) to list all resources of a given type and then invokes [WatchAsync](https://github.com/dotnet/yarp/blob/main/src/Kubernetes.Controller/Client/ResourceInformer.cs#L285) to watch newly events. I recently found this blog [Kubernetes v1.33: Streaming List responses
](https://kubernetes.io/blog/2025/05/09/kubernetes-v1-33-streaming-list-responses/) and its feature state is [beta](https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists).
### What should we add or change to make your life better?
I'm wondering if we could refactor the current code to only use `WatchAsync` performing `List + Watch`, following the documentation https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists.
### Why is this important to you?
We could make the code simplier by adopting the new Kubernetes's feature. In addition, for my own good, I learned C# and YARP along the way based on YARP's Ingress Controller implementation.
**Caveat**: The feature state is `Beta`. I'm not sure if we want to implement this before its state is `GA`.
Contributor guide
Assessment
This issue has not been assessed yet.