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

Delete platform specific codes from pipedv1 #5051

Merged
merged 1 commit into from
Jul 17, 2024
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
10 changes: 0 additions & 10 deletions pkg/app/piped/cmd/piped/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
"github.com/pipe-cd/pipecd/pkg/app/piped/controller/controllermetrics"
"github.com/pipe-cd/pipecd/pkg/app/piped/driftdetector"
"github.com/pipe-cd/pipecd/pkg/app/piped/eventwatcher"
"github.com/pipe-cd/pipecd/pkg/app/piped/livestatereporter"
"github.com/pipe-cd/pipecd/pkg/app/piped/livestatestore"
k8slivestatestoremetrics "github.com/pipe-cd/pipecd/pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics"
"github.com/pipe-cd/pipecd/pkg/app/piped/notifier"
Expand Down Expand Up @@ -356,14 +355,6 @@ func (p *piped) run(ctx context.Context, input cli.Input) (runErr error) {
liveStateGetter = s.Getter()
}

// Start running application live state reporter.
{
r := livestatereporter.NewReporter(applicationLister, liveStateGetter, apiClient, cfg, input.Logger)
group.Go(func() error {
return r.Run(ctx)
})
}

decrypter, err := p.initializeSecretDecrypter(cfg)
if err != nil {
input.Logger.Error("failed to initialize secret decrypter", zap.Error(err))
Expand All @@ -375,7 +366,6 @@ func (p *piped) run(ctx context.Context, input cli.Input) (runErr error) {
d, err := driftdetector.NewDetector(
applicationLister,
gitClient,
liveStateGetter,
apiClient,
appManifestsCache,
cfg,
Expand Down
59 changes: 0 additions & 59 deletions pkg/app/piped/driftdetector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import (
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"

"github.com/pipe-cd/pipecd/pkg/app/piped/driftdetector/cloudrun"
"github.com/pipe-cd/pipecd/pkg/app/piped/driftdetector/kubernetes"
"github.com/pipe-cd/pipecd/pkg/app/piped/driftdetector/terraform"
"github.com/pipe-cd/pipecd/pkg/app/piped/livestatestore"
"github.com/pipe-cd/pipecd/pkg/app/server/service/pipedservice"
"github.com/pipe-cd/pipecd/pkg/cache"
"github.com/pipe-cd/pipecd/pkg/config"
Expand Down Expand Up @@ -78,7 +74,6 @@ type providerDetector interface {
func NewDetector(
appLister applicationLister,
gitClient gitClient,
stateGetter livestatestore.Getter,
apiClient apiClient,
appManifestsCache cache.Cache,
cfg *config.PipedSpec,
Expand All @@ -97,60 +92,6 @@ func NewDetector(

for _, cp := range cfg.PlatformProviders {
switch cp.Type {
case model.PlatformProviderKubernetes:
sg, ok := stateGetter.KubernetesGetter(cp.Name)
if !ok {
return nil, fmt.Errorf(format, cp.Name)
}
d.detectors = append(d.detectors, kubernetes.NewDetector(
cp,
appLister,
gitClient,
sg,
d,
appManifestsCache,
cfg,
sd,
logger,
))

case model.PlatformProviderCloudRun:
sg, ok := stateGetter.CloudRunGetter(cp.Name)
if !ok {
return nil, fmt.Errorf(format, cp.Name)
}
d.detectors = append(d.detectors, cloudrun.NewDetector(
cp,
appLister,
gitClient,
sg,
d,
appManifestsCache,
cfg,
sd,
logger,
))

case model.PlatformProviderTerraform:
if !*cp.TerraformConfig.DriftDetectionEnabled {
continue
}
sg, ok := stateGetter.TerraformGetter(cp.Name)
if !ok {
return nil, fmt.Errorf(format, cp.Name)
}
d.detectors = append(d.detectors, terraform.NewDetector(
cp,
appLister,
gitClient,
sg,
d,
appManifestsCache,
cfg,
sd,
logger,
))

default:
}
}
Expand Down
19 changes: 1 addition & 18 deletions pkg/app/piped/livestatereporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"

"github.com/pipe-cd/pipecd/pkg/app/piped/livestatereporter/cloudrun"
"github.com/pipe-cd/pipecd/pkg/app/piped/livestatereporter/kubernetes"
"github.com/pipe-cd/pipecd/pkg/app/piped/livestatestore"
"github.com/pipe-cd/pipecd/pkg/app/server/service/pipedservice"
"github.com/pipe-cd/pipecd/pkg/config"
"github.com/pipe-cd/pipecd/pkg/model"
Expand Down Expand Up @@ -56,7 +53,7 @@
ProviderName() string
}

func NewReporter(appLister applicationLister, stateGetter livestatestore.Getter, apiClient apiClient, cfg *config.PipedSpec, logger *zap.Logger) Reporter {
func NewReporter(appLister applicationLister, apiClient apiClient, cfg *config.PipedSpec, logger *zap.Logger) Reporter {

Check warning on line 56 in pkg/app/piped/livestatereporter/reporter.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/livestatereporter/reporter.go#L56

Added line #L56 was not covered by tests
r := &reporter{
reporters: make([]providerReporter, 0, len(cfg.PlatformProviders)),
logger: logger.Named("live-state-reporter"),
Expand All @@ -65,20 +62,6 @@
const errFmt = "unable to find live state getter for platform provider: %s"
for _, cp := range cfg.PlatformProviders {
switch cp.Type {
case model.PlatformProviderKubernetes:
sg, ok := stateGetter.KubernetesGetter(cp.Name)
if !ok {
r.logger.Error(fmt.Sprintf(errFmt, cp.Name))
continue
}
r.reporters = append(r.reporters, kubernetes.NewReporter(cp, appLister, sg, apiClient, logger))
case model.PlatformProviderCloudRun:
sg, ok := stateGetter.CloudRunGetter(cp.Name)
if !ok {
r.logger.Error(fmt.Sprintf(errFmt, cp.Name))
continue
}
r.reporters = append(r.reporters, cloudrun.NewReporter(cp, appLister, sg, apiClient, logger))
}
}

Expand Down
80 changes: 0 additions & 80 deletions pkg/app/pipedv1/analysisprovider/http/http.go

This file was deleted.

47 changes: 0 additions & 47 deletions pkg/app/pipedv1/analysisprovider/log/factory/factory.go

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/app/pipedv1/analysisprovider/log/provider.go

This file was deleted.

43 changes: 0 additions & 43 deletions pkg/app/pipedv1/analysisprovider/log/stackdriver/stackdriver.go

This file was deleted.

Loading
Loading