Skip to content

Commit

Permalink
Merge pull request #152 from cschwede/fix-return-values
Browse files Browse the repository at this point in the history
Fix return values
  • Loading branch information
openshift-merge-bot[bot] authored Mar 1, 2024
2 parents 9c6f839 + 0976a97 commit aa382e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions controllers/swift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ func (r *SwiftReconciler) reconcileNormal(ctx context.Context, instance *swiftv1
condition.RequestedReason,
condition.SeverityInfo,
condition.MemcachedReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, fmt.Errorf("memcached %s not found", instance.Spec.MemcachedInstance)
r.Log.Error(err, "memcached not found")
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.MemcachedReadyCondition,
Expand All @@ -255,7 +256,8 @@ func (r *SwiftReconciler) reconcileNormal(ctx context.Context, instance *swiftv1
condition.RequestedReason,
condition.SeverityInfo,
condition.MemcachedReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, fmt.Errorf("memcached %s is not ready", memcached.Name)
r.Log.Error(err, "memcached is not ready")
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}
// Mark the Memcached Service as Ready if we get to this point with no errors
instance.Status.Conditions.MarkTrue(
Expand Down
12 changes: 7 additions & 5 deletions controllers/swiftproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,15 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
// Get the Keystone endpoint URLs
keystoneAPI, err := keystonev1.GetKeystoneAPI(ctx, helper, instance.Namespace, map[string]string{})
if err != nil {
return ctrlResult, err
return ctrl.Result{}, err
}
keystonePublicURL, err := keystoneAPI.GetEndpoint(endpoint.EndpointPublic)
if err != nil {
return ctrlResult, err
return ctrl.Result{}, err
}
keystoneInternalURL, err := keystoneAPI.GetEndpoint(endpoint.EndpointInternal)
if err != nil {
return ctrlResult, err
return ctrl.Result{}, err
}

// Create OpenStack roles for Swift RBAC
Expand All @@ -417,7 +417,8 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, fmt.Errorf("Secret %s not found", instance.Spec.Secret)
r.Log.Error(err, "Secret not found")
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
Expand Down Expand Up @@ -499,7 +500,8 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
condition.SeverityInfo,
condition.NetworkAttachmentsReadyWaitingMessage,
netAtt))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("network-attachment-definition %s not found", netAtt)
r.Log.Error(err, "network-attachment-definition not found")
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
Expand Down
5 changes: 3 additions & 2 deletions controllers/swiftstorage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ func (r *SwiftStorageReconciler) Reconcile(ctx context.Context, req ctrl.Request
condition.SeverityInfo,
condition.NetworkAttachmentsReadyWaitingMessage,
netAtt))
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("network-attachment-definition %s not found", netAtt)
r.Log.Error(err, "network-attachment-definition not found")
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.NetworkAttachmentsReadyCondition,
Expand All @@ -186,7 +187,7 @@ func (r *SwiftStorageReconciler) Reconcile(ctx context.Context, req ctrl.Request
// NetworkPolicy for the storage pods
config := Netconfig{}
if err = json.Unmarshal([]byte(nad.Spec.Config), &config); err != nil {
return ctrlResult, err
return ctrl.Result{}, err
}
if config.Name == "storage" {
storageNetworkRange = config.Ipam.Range
Expand Down

0 comments on commit aa382e7

Please sign in to comment.