diff --git a/core/cmd/cmd.go b/core/cmd/cmd.go index 557ef378..4c0b50a5 100644 --- a/core/cmd/cmd.go +++ b/core/cmd/cmd.go @@ -128,6 +128,7 @@ import ( "github.com/horizoncd/horizon/pkg/token/generator" tokenservice "github.com/horizoncd/horizon/pkg/token/service" tokenstore "github.com/horizoncd/horizon/pkg/token/store" + "github.com/horizoncd/horizon/pkg/util/kube" "github.com/horizoncd/horizon/pkg/workload" templateschematagapi "github.com/horizoncd/horizon/core/http/api/v1/templateschematag" @@ -156,7 +157,7 @@ import ( "github.com/horizoncd/horizon/pkg/cluster/code" clustergitrepo "github.com/horizoncd/horizon/pkg/cluster/gitrepo" clusterservice "github.com/horizoncd/horizon/pkg/cluster/service" - //"github.com/horizoncd/horizon/pkg/cluster/tekton/factory" + "github.com/horizoncd/horizon/pkg/cluster/tekton/factory" oauthconfig "github.com/horizoncd/horizon/pkg/config/oauth" "github.com/horizoncd/horizon/pkg/config/pprof" roleconfig "github.com/horizoncd/horizon/pkg/config/role" @@ -373,10 +374,10 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { if err != nil { panic(err) } - //tektonFty, err := factory.NewFactory(coreConfig.TektonMapper) - //if err != nil { - // panic(err) - //} + tektonFty, err := factory.NewFactory(coreConfig.TektonMapper) + if err != nil { + panic(err) + } oauthAppDAO := oauthdao.NewDAO(mysqlDB) tokenStore := tokenstore.NewStore(mysqlDB) @@ -446,12 +447,12 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { tokenSvc := tokenservice.NewService(manager, coreConfig.TokenConfig) // init kube client - //_, client, err := kube.BuildClient(coreConfig.KubeConfig) - //if err != nil { - // panic(err) - //} + _, client, err := kube.BuildClient(coreConfig.KubeConfig) + if err != nil { + panic(err) + } - grafanaService := grafana.NewService(coreConfig.GrafanaConfig, manager, nil) + grafanaService := grafana.NewService(coreConfig.GrafanaConfig, manager, client) regionInformers := regioninformers.NewRegionInformers(manager.RegionMgr, 0) regionInformers.Register(workload.Resources...) go regionInformers.WatchRegion(ctx, 60*time.Second) @@ -472,9 +473,9 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { TemplateSchemaGetter: templateSchemaGetter, CD: cd.NewCD(regionInformers, clusterGitRepo, coreConfig.ArgoCDMapper, coreConfig.GroupArgoCDMapper, coreConfig.GitopsRepoConfig.DefaultBranch), - K8sUtil: cd.NewK8sUtil(regionInformers, manager.EventMgr), - OutputGetter: outputGetter, - //TektonFty: tektonFty, + K8sUtil: cd.NewK8sUtil(regionInformers, manager.EventMgr), + OutputGetter: outputGetter, + TektonFty: tektonFty, ClusterGitRepo: clusterGitRepo, PRService: prservice.NewService(manager), GitGetter: gitGetter, @@ -601,7 +602,7 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { eventHandlerJob, eventHandlerSvc := eventhandler.New(ctx, coreConfig.EventHandlerConfig, manager) webhookJob, _ := jobwebhook.New(ctx, eventHandlerSvc, coreConfig.WebhookConfig, manager) grafanaSyncJob := func(ctx context.Context) { - grafanasync.Run(ctx, coreConfig, manager, nil) + grafanasync.Run(ctx, coreConfig, manager, client) } k8seventJob := k8sevent.New(coreConfig.KubernetesEvent, regionInformers, manager, mysqlDB) go jobs.Run(ctx, &coreConfig.JobConfig, eventHandlerJob, webhookJob, @@ -708,7 +709,7 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { // start cloud event server go runCloudEventServer( - nil, + tektonFty, coreConfig.CloudEventServerConfig, parameter, ginlogmiddle.Middleware(gin.DefaultWriter, "/health", "/metrics"),