Skip to content

Commit

Permalink
drop CRTClient abstraction (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatousJobanek authored Oct 3, 2024
1 parent d0b1f7d commit c11f3a8
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 655 deletions.
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

0 comments on commit c11f3a8

Please sign in to comment.