@@ -77,7 +77,10 @@ func (a *Operator) syncOperatorGroups(obj interface{}) error {
7777 return nil
7878 }
7979
80- a .annotateCSVs (op , targetNamespaces , logger )
80+ err = a .annotateCSVs (op , targetNamespaces , logger )
81+ if err != nil {
82+ logger .WithError (err ).Warn ("failed to annotate CSVs in operatorgroup after group change" )
83+ }
8184 logger .Debug ("OperatorGroup CSV annotation completed" )
8285
8386 if err := a .ensureOpGroupClusterRoles (op ); err != nil {
@@ -112,16 +115,17 @@ func (a *Operator) syncOperatorGroups(obj interface{}) error {
112115 return nil
113116}
114117
115- func (a * Operator ) annotateCSVs (group * v1alpha2.OperatorGroup , targetNamespaces []string , logger * logrus.Entry ) {
118+ func (a * Operator ) annotateCSVs (group * v1alpha2.OperatorGroup , targetNamespaces []string , logger * logrus.Entry ) error {
119+ updateErrs := []error {}
116120 for _ , csv := range a .csvSet (group .GetNamespace (), v1alpha1 .CSVPhaseAny ) {
117121 logger := logger .WithField ("csv" , csv .GetName ())
118122
119123 if a .operatorGroupAnnotationsDiffer (& csv .ObjectMeta , group ) {
120124 a .setOperatorGroupAnnotations (& csv .ObjectMeta , group , true )
121125 // CRDs don't support strategic merge patching, but in the future if they do this should be updated to patch
122126 if _ , err := a .client .OperatorsV1alpha1 ().ClusterServiceVersions (csv .GetNamespace ()).Update (csv ); err != nil && ! k8serrors .IsNotFound (err ) {
123- // TODO: return an error and requeue the OperatorGroup here? Can this cause an update to never happen if there's resource contention?
124127 logger .WithError (err ).Warnf ("error adding operatorgroup annotations" )
128+ updateErrs = append (updateErrs , err )
125129 continue
126130 }
127131 }
@@ -135,6 +139,7 @@ func (a *Operator) annotateCSVs(group *v1alpha2.OperatorGroup, targetNamespaces
135139 }
136140 }
137141 }
142+ return errors .NewAggregate (updateErrs )
138143}
139144
140145func (a * Operator ) providedAPIsFromCSVs (group * v1alpha2.OperatorGroup , logger * logrus.Entry ) resolver.APISet {
0 commit comments