|
1 | 1 | package variablesources
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "context" |
5 | 4 | "errors"
|
6 | 5 | "fmt"
|
7 | 6 | "sort"
|
8 | 7 |
|
9 | 8 | "k8s.io/apimachinery/pkg/util/sets"
|
10 | 9 |
|
11 | 10 | "github.com/operator-framework/deppy/pkg/deppy"
|
12 |
| - "github.com/operator-framework/deppy/pkg/deppy/input" |
13 | 11 |
|
14 | 12 | "github.com/operator-framework/operator-controller/internal/catalogmetadata"
|
15 | 13 | catalogfilter "github.com/operator-framework/operator-controller/internal/catalogmetadata/filter"
|
@@ -93,53 +91,3 @@ func filterBundleDependencies(allBundles []*catalogmetadata.Bundle, bundle *cata
|
93 | 91 |
|
94 | 92 | return dependencies, nil
|
95 | 93 | }
|
96 |
| - |
97 |
| -type BundlesAndDepsVariableSource struct { |
98 |
| - catalogClient BundleProvider |
99 |
| - variableSources []input.VariableSource |
100 |
| -} |
101 |
| - |
102 |
| -func NewBundlesAndDepsVariableSource(catalogClient BundleProvider, inputVariableSources ...input.VariableSource) *BundlesAndDepsVariableSource { |
103 |
| - return &BundlesAndDepsVariableSource{ |
104 |
| - catalogClient: catalogClient, |
105 |
| - variableSources: inputVariableSources, |
106 |
| - } |
107 |
| -} |
108 |
| - |
109 |
| -func (b *BundlesAndDepsVariableSource) GetVariables(ctx context.Context) ([]deppy.Variable, error) { |
110 |
| - variables := []deppy.Variable{} |
111 |
| - |
112 |
| - for _, variableSource := range b.variableSources { |
113 |
| - inputVariables, err := variableSource.GetVariables(ctx) |
114 |
| - if err != nil { |
115 |
| - return nil, err |
116 |
| - } |
117 |
| - variables = append(variables, inputVariables...) |
118 |
| - } |
119 |
| - |
120 |
| - allBundles, err := b.catalogClient.Bundles(ctx) |
121 |
| - if err != nil { |
122 |
| - return nil, err |
123 |
| - } |
124 |
| - |
125 |
| - requiredPackages := []*olmvariables.RequiredPackageVariable{} |
126 |
| - installedPackages := []*olmvariables.InstalledPackageVariable{} |
127 |
| - for _, variable := range variables { |
128 |
| - switch v := variable.(type) { |
129 |
| - case *olmvariables.RequiredPackageVariable: |
130 |
| - requiredPackages = append(requiredPackages, v) |
131 |
| - case *olmvariables.InstalledPackageVariable: |
132 |
| - installedPackages = append(installedPackages, v) |
133 |
| - } |
134 |
| - } |
135 |
| - |
136 |
| - bundles, err := MakeBundleVariables(allBundles, requiredPackages, installedPackages) |
137 |
| - if err != nil { |
138 |
| - return nil, err |
139 |
| - } |
140 |
| - |
141 |
| - for _, v := range bundles { |
142 |
| - variables = append(variables, v) |
143 |
| - } |
144 |
| - return variables, nil |
145 |
| -} |
0 commit comments