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

drop CRTClient abstraction #473

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ func main() {
}
}

app, err := server.NewInClusterApplication(cl, configuration.Namespace())
if err != nil {
panic(err.Error())
}
app := server.NewInClusterApplication(cl, configuration.Namespace())
// Initialize toolchain cluster cache service
// let's cache the member clusters before we start the services,
// this will speed up the first request
Expand Down
6 changes: 2 additions & 4 deletions pkg/application/service/context/service_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package context

import (
"github.com/codeready-toolchain/registration-service/pkg/application/service"
"github.com/codeready-toolchain/registration-service/pkg/kubeclient"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/codeready-toolchain/registration-service/pkg/namespaced"
)

type ServiceContextProducer func() ServiceContext

type ServiceContext interface {
CRTClient() kubeclient.CRTClient
Client() client.Client
Client() namespaced.Client
Services() service.Services
}
22 changes: 5 additions & 17 deletions pkg/application/service/factory/service_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,30 @@ import (
servicecontext "github.com/codeready-toolchain/registration-service/pkg/application/service/context"
"github.com/codeready-toolchain/registration-service/pkg/configuration"
informerservice "github.com/codeready-toolchain/registration-service/pkg/informers/service"
"github.com/codeready-toolchain/registration-service/pkg/kubeclient"
"github.com/codeready-toolchain/registration-service/pkg/log"
"github.com/codeready-toolchain/registration-service/pkg/namespaced"
clusterservice "github.com/codeready-toolchain/registration-service/pkg/proxy/service"
signupservice "github.com/codeready-toolchain/registration-service/pkg/signup/service"
verificationservice "github.com/codeready-toolchain/registration-service/pkg/verification/service"
"sigs.k8s.io/controller-runtime/pkg/client"
)

type serviceContextImpl struct {
kubeClient kubeclient.CRTClient
client client.Client
services service.Services
client namespaced.Client
services service.Services
}

type ServiceContextOption = func(ctx *serviceContextImpl)

func CRTClientOption(kubeClient kubeclient.CRTClient) ServiceContextOption {
return func(ctx *serviceContextImpl) {
ctx.kubeClient = kubeClient
}
}

func InformerOption(client client.Client) ServiceContextOption {
func NamespacedClientOption(client namespaced.Client) ServiceContextOption {
return func(ctx *serviceContextImpl) {
ctx.client = client
}
}

func (s *serviceContextImpl) Client() client.Client {
func (s *serviceContextImpl) Client() namespaced.Client {
return s.client
}

func (s *serviceContextImpl) CRTClient() kubeclient.CRTClient {
return s.kubeClient
}

func (s *serviceContextImpl) Services() service.Services {
return s.services
}
Expand Down
51 changes: 0 additions & 51 deletions pkg/kubeclient/banneduser.go

This file was deleted.

138 changes: 0 additions & 138 deletions pkg/kubeclient/client.go

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/kubeclient/client_test.go

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/kubeclient/mur.go

This file was deleted.

Loading
Loading