Skip to content

Commit

Permalink
wip(parser) use the manager client
Browse files Browse the repository at this point in the history
Use the manager client to retrieve resources for the parser rather than
the store.

WIP currently only does this for networking v1 Ingresses.

WIP all parser unit tests are disabled, because they now require a
Kubernetes client to run Build().
  • Loading branch information
rainest committed Feb 8, 2022
1 parent 7ee2fbb commit c6c5e5d
Show file tree
Hide file tree
Showing 8 changed files with 4,417 additions and 4,402 deletions.
10 changes: 6 additions & 4 deletions internal/dataplane/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
knative "knative.dev/networking/pkg/apis/networking/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/kong/kubernetes-ingress-controller/v2/internal/annotations"
"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/kongstate"
Expand All @@ -25,9 +26,10 @@ import (
configurationv1beta1 "github.com/kong/kubernetes-ingress-controller/v2/pkg/apis/configuration/v1beta1"
)

func parseAll(log logrus.FieldLogger, s store.Storer) ingressRules {
func parseAll(log logrus.FieldLogger, s store.Storer, client client.Client) ingressRules {
parsedIngressV1beta1 := fromIngressV1beta1(log, s.ListIngressesV1beta1())
parsedIngressV1 := fromIngressV1(log, s.ListIngressesV1())

parsedIngressV1 := fromIngressV1(log, s.ListIngressesV1Alternative(client))

tcpIngresses, err := s.ListTCPIngresses()
if err != nil {
Expand Down Expand Up @@ -69,8 +71,8 @@ func parseAll(log logrus.FieldLogger, s store.Storer) ingressRules {
// Build creates a Kong configuration from Ingress and Custom resources
// defined in Kuberentes.
// It throws an error if there is an error returned from client-go.
func Build(log logrus.FieldLogger, s store.Storer) (*kongstate.KongState, error) {
parsedAll := parseAll(log, s)
func Build(log logrus.FieldLogger, s store.Storer, client client.Client) (*kongstate.KongState, error) {
parsedAll := parseAll(log, s, client)
parsedAll.populateServices(log, s)

var result kongstate.KongState
Expand Down
Loading

0 comments on commit c6c5e5d

Please sign in to comment.