diff --git a/controllers/add_pods.go b/controllers/add_pods.go index 2267db9aa..6840ed055 100644 --- a/controllers/add_pods.go +++ b/controllers/add_pods.go @@ -61,10 +61,8 @@ func (a addPods) reconcile(ctx context.Context, r *FoundationDBClusterReconciler } // Ignore the is not found error, as we are checking here if we should create Pods. - if err != nil { - if !k8serrors.IsNotFound(err) { - return &requeue{curError: err} - } + if err != nil && !k8serrors.IsNotFound(err) { + return &requeue{curError: err} } // If this process group is marked for removal, we normally don't want to spin it back up diff --git a/controllers/cluster_controller.go b/controllers/cluster_controller.go index 58d830988..ed6cabe7d 100644 --- a/controllers/cluster_controller.go +++ b/controllers/cluster_controller.go @@ -185,7 +185,7 @@ func (r *FoundationDBClusterReconciler) Reconcile(ctx context.Context, request c if requeue.delayedRequeue { clusterLog.Info("Delaying requeue for sub-reconciler", - "subReconciler", fmt.Sprintf("%T", subReconciler), + "reconciler", fmt.Sprintf("%T", subReconciler), "message", requeue.message, "error", requeue.curError) delayedRequeue = true diff --git a/controllers/controllers.go b/controllers/controllers.go index e4d4eb105..e0eadd631 100644 --- a/controllers/controllers.go +++ b/controllers/controllers.go @@ -96,7 +96,7 @@ type requeue struct { // processRequeue interprets a requeue result from a subreconciler. func processRequeue(requeue *requeue, subReconciler interface{}, object runtime.Object, recorder record.EventRecorder, logger logr.Logger) (ctrl.Result, error) { - curLog := logger.WithValues("subReconciler", fmt.Sprintf("%T", subReconciler), "requeueAfter", requeue.delay) + curLog := logger.WithValues("reconciler", fmt.Sprintf("%T", subReconciler), "requeueAfter", requeue.delay) if requeue.message == "" && requeue.curError != nil { requeue.message = requeue.curError.Error() } diff --git a/docs/manual/debugging.md b/docs/manual/debugging.md index bbc367656..306c30b7a 100644 --- a/docs/manual/debugging.md +++ b/docs/manual/debugging.md @@ -1,5 +1,17 @@ # Debugging +## Logging + +The operator supports json-structured logging and will emit those logs to stdout and if configured to a file. +The operator sets different log keys for easier log filtering in different contexts. +All cluster related logs will contain the following fields: + +- `namespace`: Namespace of the `FoundationDBCluster` resource that is currently processed. +- `cluster`: The name of the `FoundationDBCluster` resource that is currently processed. + +In addition the operator will set the `reconciler` field to the current sub-reconciler. +If the operator iterates over all or a subset of `ProcessGroups`, the operator will set `processGroupID` to the current process group ID. + ## Kubectl FDB Plugin You can use the [kubectl-fdb](/kubectl-fdb) plugin when investigating issues and running imperative commands.