@@ -22,6 +22,7 @@ import (
22
22
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
23
23
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/decorators"
24
24
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver"
25
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/cache"
25
26
hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
26
27
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
27
28
opregistry "github.com/operator-framework/operator-registry/pkg/registry"
46
47
)
47
48
48
49
func aggregationLabelFromAPIKey (k opregistry.APIKey , suffix string ) (string , error ) {
49
- hash , err := resolver .APIKeyToGVKHash (k )
50
+ hash , err := cache .APIKeyToGVKHash (k )
50
51
if err != nil {
51
52
return "" , err
52
53
}
@@ -188,7 +189,7 @@ func (a *Operator) syncOperatorGroups(obj interface{}) error {
188
189
groupSurface := resolver .NewOperatorGroup (op )
189
190
groupProvidedAPIs := groupSurface .ProvidedAPIs ()
190
191
providedAPIsForCSVs := a .providedAPIsFromCSVs (op , logger )
191
- providedAPIsForGroup := make (resolver .APISet )
192
+ providedAPIsForGroup := make (cache .APISet )
192
193
for api := range providedAPIsForCSVs {
193
194
providedAPIsForGroup [api ] = struct {}{}
194
195
}
@@ -309,26 +310,26 @@ func (a *Operator) providedAPIsFromCSVs(group *v1.OperatorGroup, logger *logrus.
309
310
// TODO: Throw out CSVs that aren't members of the group due to group related failures?
310
311
311
312
// Union the providedAPIsFromCSVs from existing members of the group
312
- operatorSurface , err := resolver .NewOperatorFromV1Alpha1CSV (csv )
313
+ operatorSurface , err := cache .NewOperatorFromV1Alpha1CSV (csv )
313
314
if err != nil {
314
315
logger .WithError (err ).Warn ("could not create OperatorSurface from csv" )
315
316
continue
316
317
}
317
- for providedAPI := range operatorSurface .ProvidedAPIs ().StripPlural () {
318
+ for providedAPI := range operatorSurface .GetProvidedAPIs ().StripPlural () {
318
319
providedAPIsFromCSVs [providedAPI ] = csv
319
320
}
320
321
}
321
322
return providedAPIsFromCSVs
322
323
}
323
324
324
- func (a * Operator ) pruneProvidedAPIs (group * v1.OperatorGroup , groupProvidedAPIs resolver .APISet , providedAPIsFromCSVs map [opregistry.APIKey ]* v1alpha1.ClusterServiceVersion , logger * logrus.Entry ) {
325
+ func (a * Operator ) pruneProvidedAPIs (group * v1.OperatorGroup , groupProvidedAPIs cache .APISet , providedAPIsFromCSVs map [opregistry.APIKey ]* v1alpha1.ClusterServiceVersion , logger * logrus.Entry ) {
325
326
// Don't prune providedAPIsFromCSVs if static
326
327
if group .Spec .StaticProvidedAPIs {
327
328
a .logger .Debug ("group has static provided apis. skipping provided api pruning" )
328
329
return
329
330
}
330
331
331
- intersection := make (resolver .APISet )
332
+ intersection := make (cache .APISet )
332
333
for api := range providedAPIsFromCSVs {
333
334
if _ , ok := groupProvidedAPIs [api ]; ok {
334
335
intersection [api ] = struct {}{}
@@ -978,7 +979,7 @@ func (a *Operator) updateNamespaceList(op *v1.OperatorGroup) ([]string, error) {
978
979
return namespaceList , nil
979
980
}
980
981
981
- func (a * Operator ) ensureOpGroupClusterRole (op * v1.OperatorGroup , suffix string , apis resolver .APISet ) error {
982
+ func (a * Operator ) ensureOpGroupClusterRole (op * v1.OperatorGroup , suffix string , apis cache .APISet ) error {
982
983
clusterRole := & rbacv1.ClusterRole {
983
984
ObjectMeta : metav1.ObjectMeta {
984
985
Name : strings .Join ([]string {op .GetName (), suffix }, "-" ),
@@ -1029,7 +1030,7 @@ func (a *Operator) ensureOpGroupClusterRole(op *v1.OperatorGroup, suffix string,
1029
1030
return nil
1030
1031
}
1031
1032
1032
- func (a * Operator ) ensureOpGroupClusterRoles (op * v1.OperatorGroup , apis resolver .APISet ) error {
1033
+ func (a * Operator ) ensureOpGroupClusterRoles (op * v1.OperatorGroup , apis cache .APISet ) error {
1033
1034
for _ , suffix := range Suffices {
1034
1035
if err := a .ensureOpGroupClusterRole (op , suffix , apis ); err != nil {
1035
1036
return err
@@ -1038,7 +1039,7 @@ func (a *Operator) ensureOpGroupClusterRoles(op *v1.OperatorGroup, apis resolver
1038
1039
return nil
1039
1040
}
1040
1041
1041
- func (a * Operator ) findCSVsThatProvideAnyOf (provide resolver .APISet ) ([]* v1alpha1.ClusterServiceVersion , error ) {
1042
+ func (a * Operator ) findCSVsThatProvideAnyOf (provide cache .APISet ) ([]* v1alpha1.ClusterServiceVersion , error ) {
1042
1043
csvs , err := a .lister .OperatorsV1alpha1 ().ClusterServiceVersionLister ().ClusterServiceVersions (metav1 .NamespaceAll ).List (labels .Everything ())
1043
1044
if err != nil {
1044
1045
return nil , err
@@ -1051,12 +1052,12 @@ func (a *Operator) findCSVsThatProvideAnyOf(provide resolver.APISet) ([]*v1alpha
1051
1052
continue
1052
1053
}
1053
1054
1054
- operatorSurface , err := resolver .NewOperatorFromV1Alpha1CSV (csv )
1055
+ operatorSurface , err := cache .NewOperatorFromV1Alpha1CSV (csv )
1055
1056
if err != nil {
1056
1057
continue
1057
1058
}
1058
1059
1059
- if len (operatorSurface .ProvidedAPIs ().StripPlural ().Intersection (provide )) > 0 {
1060
+ if len (operatorSurface .GetProvidedAPIs ().StripPlural ().Intersection (provide )) > 0 {
1060
1061
providers = append (providers , csv )
1061
1062
}
1062
1063
}
0 commit comments