Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: decouple toDeckConfig/OnUpdate from controller, and expose as libraries #1029

Merged
merged 12 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cli/ingress-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
configclientv1 "github.com/kong/kubernetes-ingress-controller/pkg/client/configuration/clientset/versioned"
configinformer "github.com/kong/kubernetes-ingress-controller/pkg/client/configuration/informers/externalversions"
"github.com/kong/kubernetes-ingress-controller/pkg/sendconfig"
"github.com/kong/kubernetes-ingress-controller/pkg/store"
"github.com/kong/kubernetes-ingress-controller/pkg/util"
"github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down Expand Up @@ -82,7 +83,7 @@ var (

func controllerConfigFromCLIConfig(cliConfig cliConfig) controller.Configuration {
return controller.Configuration{
Kong: controller.Kong{
Kong: sendconfig.Kong{
URL: cliConfig.KongAdminURL,
FilterTags: cliConfig.KongAdminFilterTags,
Concurrency: cliConfig.KongAdminConcurrency,
Expand Down
27 changes: 5 additions & 22 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import (
"sync/atomic"
"time"

"github.com/blang/semver"
"github.com/eapache/channels"
"github.com/kong/go-kong/kong"
"github.com/kong/kubernetes-ingress-controller/internal/ingress/election"
"github.com/kong/kubernetes-ingress-controller/internal/ingress/status"
"github.com/kong/kubernetes-ingress-controller/internal/ingress/task"
configClientSet "github.com/kong/kubernetes-ingress-controller/pkg/client/configuration/clientset/versioned"
"github.com/kong/kubernetes-ingress-controller/pkg/parser"
"github.com/kong/kubernetes-ingress-controller/pkg/sendconfig"
"github.com/kong/kubernetes-ingress-controller/pkg/store"
"github.com/kong/kubernetes-ingress-controller/pkg/util"
"github.com/sirupsen/logrus"
Expand All @@ -44,26 +43,10 @@ import (
knativeClientSet "knative.dev/networking/pkg/client/clientset/versioned"
)

// Kong Represents a Kong client and connection information
type Kong struct {
URL string
FilterTags []string
// Headers are injected into every request to Kong's Admin API
// to help with authorization/authentication.
Client *kong.Client

InMemory bool
HasTagSupport bool
Enterprise bool

Version semver.Version

Concurrency int
}

// Configuration contains all the settings required by an Ingress controller
type Configuration struct {
Kong
sendconfig.Kong

KongCustomEntitiesSecret string

KubeClient clientset.Interface
Expand Down Expand Up @@ -143,7 +126,7 @@ func NewKongController(ctx context.Context,
updateCh: updateCh,

stopLock: &sync.Mutex{},
PluginSchemaStore: *NewPluginSchemaStore(config.Kong.Client),
PluginSchemaStore: *util.NewPluginSchemaStore(config.Kong.Client),

Logger: config.Logger,
}
Expand Down Expand Up @@ -228,7 +211,7 @@ type KongController struct {

store store.Storer

PluginSchemaStore PluginSchemaStore
PluginSchemaStore util.PluginSchemaStore

Logger logrus.FieldLogger
}
Expand Down
Loading