@@ -24,7 +24,7 @@ func (a *Operator) syncOperatorGroups(obj interface{}) error {
24
24
}
25
25
log .Infof ("syncing operator group %v" , op )
26
26
27
- err , targetedNamespaces := a .updateNamespaceList (op )
27
+ targetedNamespaces , err := a .updateNamespaceList (op )
28
28
log .Debugf ("Got targetedNamespaces: '%v'" , targetedNamespaces )
29
29
if err != nil {
30
30
log .Errorf ("updateNamespaceList error: %v" , err )
@@ -142,30 +142,30 @@ func namespacesChanged(clusterNamespaces []*corev1.Namespace, statusNamespaces [
142
142
return false
143
143
}
144
144
145
- func (a * Operator ) updateNamespaceList (op * v1alpha2.OperatorGroup ) (error , []* corev1.Namespace ) {
145
+ func (a * Operator ) updateNamespaceList (op * v1alpha2.OperatorGroup ) ([]* corev1.Namespace , error ) {
146
146
selector , err := metav1 .LabelSelectorAsSelector (& op .Spec .Selector )
147
147
if err != nil {
148
- return err , nil
148
+ return nil , err
149
149
}
150
150
151
151
namespaceList , err := a .lister .CoreV1 ().NamespaceLister ().List (selector )
152
152
if err != nil {
153
- return err , nil
153
+ return nil , err
154
154
}
155
155
156
156
if ! namespacesChanged (namespaceList , op .Status .Namespaces ) {
157
157
// status is current with correct namespaces, so no further updates required
158
- return nil , namespaceList
158
+ return namespaceList , nil
159
159
}
160
160
log .Debugf ("Namespace change detected, found: %v" , namespaceList )
161
161
op .Status .Namespaces = make ([]* corev1.Namespace , len (namespaceList ))
162
162
copy (op .Status .Namespaces , namespaceList )
163
163
op .Status .LastUpdated = timeNow ()
164
164
_ , err = a .client .OperatorsV1alpha2 ().OperatorGroups (op .Namespace ).UpdateStatus (op )
165
165
if err != nil {
166
- return err , namespaceList
166
+ return namespaceList , err
167
167
}
168
- return nil , namespaceList
168
+ return namespaceList , nil
169
169
}
170
170
171
171
func (a * Operator ) ensureClusterRoles (op * v1alpha2.OperatorGroup ) error {
0 commit comments