Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: watch resource with selectors (#1661)
* add namespaceSelectors watch mode for Kubernetes provider Add namespaceSelectors watch mode for Kubernetes provider. Users will need to specify `EnvoyGateway.Provider.Type` and precisely one of `EnvoyGateway.Provider.Kubernetes.Wach.Namespaces` and `EnvoyGateway.Provider.Kubernetes.Wach.NamespaceSelectors` to set the KuberNtes wach mode. The namespaceSelectors doesn't change the namespace informers watch. The informer still watches all namespaces. The events which have Objects that are not under namesapces with the labels set by `NamespaceSelectors` are filtered out. Signed-off-by: Den Tsou <den3tsou@gmail.com> * fix: fix typos Signed-off-by: Den Tsou <den3tsou@gmail.com> * fix: fix a test and fix a bug that pointer wasn't checked Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: remove an unneeded comment Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: replace string type with KubernetesWatchModeType Signed-off-by: Den Tsou <den3tsou@gmail.com> * fix: use right values for KubernetesWatchModeType Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: run make generate Signed-off-by: Den Tsou <den3tsou@gmail.com> * wip: update to check all object's namespaces returned by client * This is a protytpe. Refactoring is required to make the code more readable because the code is getting more complex after adding this logic * Update to check all labels of namespaces of objects returned by client * Fix a bug that wrong type was checked * Don't apply predicate to filter out the event related to GatewayClass because GatewayClass is cluster scoped object * Simple test to check if only certain number of gateway is returned. More test logic is indeed needed to be added Signed-off-by: Den Tsou <den3tsou@gmail.com> * refactor: move namespace labels to struct field Signed-off-by: Den Tsou <den3tsou@gmail.com> * resolve the issue casued by resolving conflicts Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: add test for gateway Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: clean up some todo and add a comment Signed-off-by: Den Tsou <den3tsou@gmail.com> * chore: address PR comments * Update hasMatchingNamespaceLabels signature because labels is part of the struct field now * Remove the logic to check namespace of certificate ref because it is not necessary * Refactor the checkNamespaceLabels with new interface, so the code is more readable now Signed-off-by: Den Tsou <den3tsou@gmail.com> * fix: fix typos Signed-off-by: Den Tsou <den3tsou@gmail.com> * fix: fix the lint errors Signed-off-by: Den Tsou <den3tsou@gmail.com> * refactor: revert back to get namespace from caller Signed-off-by: Den Tsou <den3tsou@gmail.com> * test: add a integration test for the change Signed-off-by: Den Tsou <den3tsou@gmail.com> --------- Signed-off-by: Den Tsou <den3tsou@gmail.com> Signed-off-by: Den <6628668+den3tsou@users.noreply.github.com> Co-authored-by: Xunzhuo <bitliu@tencent.com>
- Loading branch information