apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
972 stars 337 forks source link

proposal: restructure `pkg/ingress` #1058

Open lingsamuel opened 2 years ago

lingsamuel commented 2 years ago

As support for the Gateway API progressed, we needed to redesign the structure of pkg/ingress. This directory now has multiple types of resources mixed together: Kubernetes native resources, APISIX Ingress resources, and Gateway API resources. More types of resources may be added in the future. In addition, the controller.go file has become increasingly large.

We need to redesign the controller so that supporting different resources doesn't require massive changes to the outer files, and to keep the changes in a smaller module as much as possible.

tao12345666333 commented 2 years ago

+1 I agree with you.

Do you have a more specific plan? We can put this proposal into this year's roadmap

lingsamuel commented 2 years ago

Perhaps we could create an interface called "(Feature)Provider". The provider holds several small controllers and associated clientet/listers/informers.

Also, we should separate the translators and only make the Kubernetes translator publicly accessible, since any other translator could potentially rely on it. APISIX Ingress and any other CRD translators should be private.

tao12345666333 commented 2 years ago

SGTM

I prefer to rename KubernetesProvider to CommonProvider.

When dealing with various resources(Ingress/CR/Gateway resource), we may need to deal with these basic resources of Kubernetes.