Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into deprecate-tc-spec…
Browse files Browse the repository at this point in the history
…-fields-contd2
  • Loading branch information
metlos committed Oct 4, 2024
2 parents f23e34f + c11f3a8 commit 665f99c
Show file tree
Hide file tree
Showing 59 changed files with 2,821 additions and 3,752 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @MatousJobanek @xcoulon @alexeykazakov @rajivnathan @ranakan19 @sbryzak @mfrancisc
* @MatousJobanek @xcoulon @alexeykazakov @rajivnathan @ranakan19 @mfrancisc
36 changes: 18 additions & 18 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
"github.com/codeready-toolchain/registration-service/pkg/auth"
"github.com/codeready-toolchain/registration-service/pkg/configuration"
"github.com/codeready-toolchain/registration-service/pkg/informers"
"github.com/codeready-toolchain/registration-service/pkg/log"
"github.com/codeready-toolchain/registration-service/pkg/proxy"
"github.com/codeready-toolchain/registration-service/pkg/proxy/metrics"
Expand Down Expand Up @@ -85,15 +84,7 @@ func main() {
}
}

informer, informerShutdown, err := informers.StartInformer(cfg)
if err != nil {
panic(err.Error())
}

app, err := server.NewInClusterApplication(*informer)
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 Expand Up @@ -121,11 +112,6 @@ func main() {
}
proxySrv := p.StartProxy(proxy.DefaultPort)

// stop the informer when proxy server shuts down
proxySrv.RegisterOnShutdown(func() {
informerShutdown <- struct{}{}
})

// ---------------------------------------------
// Registration Service
// ---------------------------------------------
Expand Down Expand Up @@ -202,9 +188,23 @@ func newCachedClient(ctx context.Context, cfg *rest.Config) (client.Client, erro

// populate the cache backed by shared informers that are initialized lazily on the first call
// for the given GVK with all resources we are interested in from the host-operator namespace
objectsToList := []client.ObjectList{&toolchainv1alpha1.ToolchainConfigList{}, &corev1.SecretList{}}
for i := range objectsToList {
if err := hostCluster.GetClient().List(ctx, objectsToList[i], client.InNamespace(configuration.Namespace())); err != nil {
objectsToList := map[string]client.ObjectList{
"MasterUserRecord": &toolchainv1alpha1.MasterUserRecordList{},
"Space": &toolchainv1alpha1.SpaceList{},
"SpaceBinding": &toolchainv1alpha1.SpaceBindingList{},
"ToolchainStatus": &toolchainv1alpha1.ToolchainStatusList{},
"UserSignup": &toolchainv1alpha1.UserSignupList{},
"ProxyPlugin": &toolchainv1alpha1.ProxyPluginList{},
"NSTemplateTier": &toolchainv1alpha1.NSTemplateTierList{},
"ToolchainConfig": &toolchainv1alpha1.ToolchainConfigList{},
"BannedUser": &toolchainv1alpha1.BannedUserList{},
"ToolchainCluster": &toolchainv1alpha1.ToolchainClusterList{},
"Secret": &corev1.SecretList{}}

for resourceName := range objectsToList {
log.Infof(nil, "Syncing informer cache with %s resources", resourceName)
if err := hostCluster.GetClient().List(ctx, objectsToList[resourceName], client.InNamespace(configuration.Namespace())); err != nil {
log.Errorf(nil, err, "Informer cache sync failed for %s", resourceName)
return nil, err
}
}
Expand Down
15 changes: 13 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/aws/aws-sdk-go v1.44.100
github.com/codeready-toolchain/api v0.0.0-20240909145803-3b27dcfb3ded
github.com/codeready-toolchain/api v0.0.0-20240927104325-b5bfcb3cb1b0
github.com/codeready-toolchain/toolchain-common v0.0.0-20240905135929-d55d86fdd41e
github.com/go-logr/logr v1.4.1
github.com/gofrs/uuid v4.2.0+incompatible
Expand Down Expand Up @@ -46,6 +46,10 @@ require (
cloud.google.com/go/auth v0.3.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.11.2 // indirect
Expand All @@ -67,6 +71,7 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
Expand All @@ -77,7 +82,12 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/migueleliasweb/go-github-mock v0.0.18 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/redhat-cop/operator-utils v1.3.3-0.20220121120056-862ef22b8cdf // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
Expand All @@ -94,6 +104,7 @@ require (
google.golang.org/grpc v1.63.2 // indirect
k8s.io/apiextensions-apiserver v0.25.0 // indirect
k8s.io/component-base v0.25.0 // indirect
k8s.io/kubectl v0.24.0 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
)

Expand Down Expand Up @@ -138,7 +149,7 @@ require (
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
github.com/ttacon/libphonenumber v1.2.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/atomic v1.10.0
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
Expand Down
Loading

0 comments on commit 665f99c

Please sign in to comment.