Skip to content

Commit

Permalink
feat: support group-env-argocd mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
iamyeka committed Apr 24, 2024
1 parent b07c56f commit 90bb185
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions core/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 90bb185

Please sign in to comment.