diff --git a/pkg/controllers/cluster/cluster_control.go b/pkg/controllers/cluster/cluster_control.go index f943b037c..32fe4551a 100644 --- a/pkg/controllers/cluster/cluster_control.go +++ b/pkg/controllers/cluster/cluster_control.go @@ -72,9 +72,9 @@ func (csu *clusterUpdater) UpdateClusterLabels(cluster *v1alpha1.Cluster, lbls l key := fmt.Sprintf("%s/%s", cluster.GetNamespace(), cluster.GetName()) glog.V(4).Infof("Conflict updating Cluster labels. Getting updated Cluster %s from cache...", key) - updated, err := csu.lister.Clusters(cluster.GetNamespace()).Get(cluster.GetName()) + updated, err := csu.lister.Clusters(cluster.Namespace).Get(cluster.Name) if err != nil { - glog.Errorf("Error getting updated Cluster %s: %v", key, err) + glog.Errorf("Error getting updated Cluster %q: %v", key, err) return err } diff --git a/pkg/controllers/restore/agent_controller.go b/pkg/controllers/restore/agent_controller.go index bd94b3c69..166cf43e1 100644 --- a/pkg/controllers/restore/agent_controller.go +++ b/pkg/controllers/restore/agent_controller.go @@ -137,7 +137,20 @@ func NewAgentController( cache.ResourceEventHandlerFuncs{ UpdateFunc: func(oldObj, newObj interface{}) { new := newObj.(*v1alpha1.Restore) - _, cond := restoreutil.GetRestoreCondition(&new.Status, v1alpha1.RestoreScheduled) + + _, cond := restoreutil.GetRestoreCondition(&new.Status, v1alpha1.RestoreComplete) + if cond != nil && cond.Status == corev1.ConditionTrue { + glog.V(2).Infof("Restore %q is Complete, skipping.", kubeutil.NamespaceAndName(new)) + return + } + + _, cond = restoreutil.GetRestoreCondition(&new.Status, v1alpha1.RestoreRunning) + if cond != nil && cond.Status == corev1.ConditionTrue { + glog.V(2).Infof("Restore %q is Running, skipping.", kubeutil.NamespaceAndName(new)) + return + } + + _, cond = restoreutil.GetRestoreCondition(&new.Status, v1alpha1.RestoreScheduled) if cond != nil && cond.Status == corev1.ConditionTrue && new.Spec.ScheduledMember == c.podName { key, err := cache.MetaNamespaceKeyFunc(new) if err != nil { @@ -147,8 +160,8 @@ func NewAgentController( c.queue.Add(key) return } - glog.V(4).Infof("Restore %q is not Scheduled on this agent") + glog.V(4).Infof("Restore %q is not Scheduled on this agent") }, }, )