diff --git a/internal/db/gitopsCatalog.go b/internal/db/gitopsCatalog.go index e51b87a7..5f6d0b62 100644 --- a/internal/db/gitopsCatalog.go +++ b/internal/db/gitopsCatalog.go @@ -28,6 +28,17 @@ func (mdbcl *MongoDBClient) GetGitopsCatalogApps() (types.GitopsCatalogApps, err return result, nil } +func k3dCatalogApps(apps []types.GitopsCatalogApp) []types.GitopsCatalogApp { + var k3dApps []types.GitopsCatalogApp + for _, app := range apps { + worksOnK3D := app.K3D == nil + if worksOnK3D { + k3dApps = append(k3dApps, app) + } + } + return k3dApps +} + // UpdateGitopsCatalogApps func (mdbcl *MongoDBClient) UpdateGitopsCatalogApps() error { mpapps, err := gitopsCatalog.ReadActiveApplications() @@ -36,7 +47,7 @@ func (mdbcl *MongoDBClient) UpdateGitopsCatalogApps() error { } filter := bson.D{{Key: "name", Value: "gitops_catalog_application_list"}} - update := bson.D{{Key: "$set", Value: bson.D{{Key: "apps", Value: mpapps.Apps}}}} + update := bson.D{{Key: "$set", Value: bson.D{{Key: "apps", Value: k3dCatalogApps(mpapps.Apps)}}}} opts := options.Update().SetUpsert(true) _, err = mdbcl.GitopsCatalogCollection.UpdateOne(mdbcl.Context, filter, update, opts) diff --git a/internal/types/gitopsCatalog.go b/internal/types/gitopsCatalog.go index 5a372250..e852dd68 100644 --- a/internal/types/gitopsCatalog.go +++ b/internal/types/gitopsCatalog.go @@ -20,6 +20,7 @@ type GitopsCatalogApp struct { ImageURL string `bson:"image_url" json:"image_url" yaml:"imageUrl"` Description string `bson:"description" json:"description" yaml:"description"` Categories []string `bson:"categories" json:"categories" yaml:"categories"` + K3D *bool `bson:"k3d" json:"k3d" yaml:"k3d"` } // GitopsCatalogAppSecretKey describes a required secret value when creating a