Skip to content

Report errors in logs for sidecar interaction #660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions controllers/bounce_processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func (b BounceProcesses) Reconcile(r *FoundationDBClusterReconciler, context ctx
return false, MissingPodErrorByName(process, cluster)
}

synced, _ := r.updatePodDynamicConf(cluster, instances[0])
synced, err := r.updatePodDynamicConf(cluster, instances[0])
if !synced {
log.Info("Update dynamic Pod config", "namespace", cluster.Namespace, "cluster", cluster.Name, "processGroupID", instanceID, "synced", synced)
allSynced = false
log.Info("Update dynamic Pod config", "namespace", cluster.Namespace, "cluster", cluster.Name, "processGroupID", instanceID, "synced", synced, "error", err)
}
}

Expand Down
24 changes: 7 additions & 17 deletions controllers/update_pod_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package controllers

import (
ctx "context"
"fmt"
"time"

fdbtypes "github.com/FoundationDB/fdb-kubernetes-operator/api/v1beta1"
Expand All @@ -49,7 +48,7 @@ func (u UpdatePodConfig) Reconcile(r *FoundationDBClusterReconciler, context ctx
return false, err
}

var errs []error
allSynced := true
// We try to update all instances and if we observe an error we add it to the error list.
for index := range instances {
instance := instances[index]
Expand All @@ -59,31 +58,22 @@ func (u UpdatePodConfig) Reconcile(r *FoundationDBClusterReconciler, context ctx

synced, err := r.updatePodDynamicConf(cluster, instance)
if !synced {
log.Info("Update dynamic Pod config", "namespace", configMap.Namespace, "cluster", cluster.Name, "processGroupID", instance.GetInstanceID(), "synced", synced)
if err != nil {
errs = append(errs, err)
} else {
errs = append(errs, fmt.Errorf("processGroupID %s not synced", instance.GetInstanceID()))
}

allSynced = false
log.Info("Update dynamic Pod config", "namespace", cluster.Namespace, "cluster", cluster.Name, "processGroupID", instance.GetInstanceID(), "synced", synced, "error", err)
continue
}

instance.Metadata.Annotations[fdbtypes.LastConfigMapKey] = configMapHash
err = r.PodLifecycleManager.UpdateMetadata(r, context, cluster, instance)
if err != nil {
allSynced = false
log.Info("Update Pod metadata", "namespace", configMap.Namespace, "cluster", cluster.Name, "processGroupID", instance.GetInstanceID(), "error", err)
errs = append(errs, err)
}
}

if len(errs) > 0 {
// If we return an error we don't requeue
// So we just return that we can't continue but don't have an error
return false, nil
}

return true, nil
// If we return an error we don't requeue
// So we just return that we can't continue but don't have an error
return allSynced, nil
}

// RequeueAfter returns the delay before we should run the reconciliation
Expand Down