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

Fix application store listBy method #4075

Merged
merged 1 commit into from
Dec 14, 2022
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: 5 additions & 5 deletions pkg/app/piped/apistore/applicationstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Lister interface {
// List lists all applications that should be handled by this piped.
// All disabled applications will be ignored.
List() []*model.Application
// ListByCloudProvider lists all applications for a given cloud provider name.
ListByCloudProvider(name string) []*model.Application
// ListByPlatformProvider lists all applications for a given cloud provider name.
ListByPlatformProvider(name string) []*model.Application
// Get retrieves a specifiec deployment for the given id.
Get(id string) (*model.Application, bool)
}
Expand Down Expand Up @@ -127,8 +127,8 @@ func (s *store) List() []*model.Application {
return apps.([]*model.Application)
}

// ListByCloudProvider lists all applications for a given cloud provider name.
func (s *store) ListByCloudProvider(name string) []*model.Application {
// ListByPlatformProvider lists all applications for a given platform provider name.
func (s *store) ListByPlatformProvider(name string) []*model.Application {
list := s.applicationList.Load()
if list == nil {
return nil
Expand All @@ -139,7 +139,7 @@ func (s *store) ListByCloudProvider(name string) []*model.Application {
out = make([]*model.Application, 0, len(apps))
)
for _, app := range apps {
if app.CloudProvider == name {
if app.PlatformProvider == name {
out = append(out, app)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/driftdetector/cloudrun/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type gitClient interface {
Expand Down Expand Up @@ -183,7 +183,7 @@ func (d *detector) cloneGitRepository(ctx context.Context, repoID string) (git.R
// and then groups them by repoID.
func (d *detector) listGroupedApplication() map[string][]*model.Application {
var (
apps = d.appLister.ListByCloudProvider(d.provider.Name)
apps = d.appLister.ListByPlatformProvider(d.provider.Name)
m = make(map[string][]*model.Application)
)
for _, app := range apps {
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/piped/driftdetector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type deploymentLister interface {
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/driftdetector/kubernetes/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type gitClient interface {
Expand Down Expand Up @@ -282,7 +282,7 @@ func (d *detector) loadHeadManifests(ctx context.Context, app *model.Application
// and then groups them by repoID.
func (d *detector) listGroupedApplication() map[string][]*model.Application {
var (
apps = d.appLister.ListByCloudProvider(d.provider.Name)
apps = d.appLister.ListByPlatformProvider(d.provider.Name)
m = make(map[string][]*model.Application)
)
for _, app := range apps {
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/livestatereporter/cloudrun/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type apiClient interface {
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *reporter) ProviderName() string {
}

func (r *reporter) flushSnapshots(ctx context.Context) error {
apps := r.appLister.ListByCloudProvider(r.provider.Name)
apps := r.appLister.ListByPlatformProvider(r.provider.Name)
for _, app := range apps {
state, ok := r.stateGetter.GetState(app.Id)
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/livestatereporter/kubernetes/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type apiClient interface {
Expand Down Expand Up @@ -112,7 +112,7 @@ func (r *reporter) Run(ctx context.Context) error {
func (r *reporter) flushSnapshots(ctx context.Context) error {
// TODO: In the future, maybe we should apply worker model for this or
// send multiple application states in one request.
apps := r.appLister.ListByCloudProvider(r.provider.Name)
apps := r.appLister.ListByPlatformProvider(r.provider.Name)
for _, app := range apps {
state, ok := r.stateGetter.GetKubernetesAppLiveState(app.Id)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/piped/livestatereporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

type applicationLister interface {
ListByCloudProvider(name string) []*model.Application
ListByPlatformProvider(name string) []*model.Application
}

type apiClient interface {
Expand Down