Skip to content

Commit

Permalink
Clean up the variable source code
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Oct 31, 2023
1 parent 3267301 commit 8a23cd9
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 1,496 deletions.
52 changes: 0 additions & 52 deletions internal/resolution/variablesources/bundle.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package variablesources

import (
"context"
"fmt"
"sort"

"k8s.io/apimachinery/pkg/util/sets"

"github.com/operator-framework/deppy/pkg/deppy"
"github.com/operator-framework/deppy/pkg/deppy/input"

"github.com/operator-framework/operator-controller/internal/catalogmetadata"
catalogfilter "github.com/operator-framework/operator-controller/internal/catalogmetadata/filter"
Expand Down Expand Up @@ -92,53 +90,3 @@ func filterBundleDependencies(allBundles []*catalogmetadata.Bundle, bundle *cata

return dependencies, nil
}

type BundlesAndDepsVariableSource struct {
catalogClient BundleProvider
variableSources []input.VariableSource
}

func NewBundlesAndDepsVariableSource(catalogClient BundleProvider, inputVariableSources ...input.VariableSource) *BundlesAndDepsVariableSource {
return &BundlesAndDepsVariableSource{
catalogClient: catalogClient,
variableSources: inputVariableSources,
}
}

func (b *BundlesAndDepsVariableSource) GetVariables(ctx context.Context) ([]deppy.Variable, error) {
var variables []deppy.Variable

for _, variableSource := range b.variableSources {
inputVariables, err := variableSource.GetVariables(ctx)
if err != nil {
return nil, err
}
variables = append(variables, inputVariables...)
}

allBundles, err := b.catalogClient.Bundles(ctx)
if err != nil {
return nil, err
}

requiredPackages := []*olmvariables.RequiredPackageVariable{}
installedPackages := []*olmvariables.InstalledPackageVariable{}
for _, variable := range variables {
switch v := variable.(type) {
case *olmvariables.RequiredPackageVariable:
requiredPackages = append(requiredPackages, v)
case *olmvariables.InstalledPackageVariable:
installedPackages = append(installedPackages, v)
}
}

bundles, err := MakeBundleVariables(allBundles, requiredPackages, installedPackages)
if err != nil {
return nil, err
}

for _, v := range bundles {
variables = append(variables, v)
}
return variables, nil
}
58 changes: 0 additions & 58 deletions internal/resolution/variablesources/bundle_deployment.go

This file was deleted.

146 changes: 0 additions & 146 deletions internal/resolution/variablesources/bundle_deployment_test.go

This file was deleted.

14 changes: 0 additions & 14 deletions internal/resolution/variablesources/bundle_provider.go

This file was deleted.

Loading

0 comments on commit 8a23cd9

Please sign in to comment.