From 676291474ac2472038f62114405539719b6b1f8f Mon Sep 17 00:00:00 2001 From: Christian Bell Date: Tue, 21 Feb 2017 14:39:49 -0800 Subject: [PATCH] Revert conditional updates to configmap that breaks ingress --- .../ingress/ingress_controller.go | 13 ++++++------- .../ingress/ingress_controller_test.go | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/federation/pkg/federation-controller/ingress/ingress_controller.go b/federation/pkg/federation-controller/ingress/ingress_controller.go index 2dc762a349..ab1d0d1e6f 100644 --- a/federation/pkg/federation-controller/ingress/ingress_controller.go +++ b/federation/pkg/federation-controller/ingress/ingress_controller.go @@ -501,12 +501,6 @@ func (ic *IngressController) reconcileConfigMapForCluster(clusterName string) { return } - ingressList := ic.ingressInformerStore.List() - if len(ingressList) <= 0 { - glog.V(4).Infof("No federated ingresses, ignore reconcile config map.") - return - } - if clusterName == allClustersKey { clusters, err := ic.configMapFederatedInformer.GetReadyClusters() if err != nil { @@ -529,7 +523,12 @@ func (ic *IngressController) reconcileConfigMapForCluster(clusterName string) { uidConfigMapNamespacedName := types.NamespacedName{Name: uidConfigMapName, Namespace: uidConfigMapNamespace} configMapObj, found, err := ic.configMapFederatedInformer.GetTargetStore().GetByKey(cluster.Name, uidConfigMapNamespacedName.String()) if !found || err != nil { - glog.Errorf("Failed to get ConfigMap %q for cluster %q. Will try again later: %v", uidConfigMapNamespacedName, cluster.Name, err) + logmsg := fmt.Sprintf("Failed to get ConfigMap %q for cluster %q. Will try again later: %v", uidConfigMapNamespacedName, cluster.Name, err) + if len(ic.ingressInformerStore.List()) > 0 { // Error-level if ingresses are active, Info-level otherwise. + glog.Errorf(logmsg) + } else { + glog.V(4).Infof(logmsg) + } ic.configMapDeliverer.DeliverAfter(clusterName, nil, ic.configMapReviewDelay) return } diff --git a/federation/pkg/federation-controller/ingress/ingress_controller_test.go b/federation/pkg/federation-controller/ingress/ingress_controller_test.go index 132532a447..a90cacbfcf 100644 --- a/federation/pkg/federation-controller/ingress/ingress_controller_test.go +++ b/federation/pkg/federation-controller/ingress/ingress_controller_test.go @@ -130,15 +130,15 @@ func TestIngressController(t *testing.T) { t.Log("Adding Ingress UID ConfigMap to cluster 1") cluster1ConfigMapWatch.Add(cfg1) - // Test add federated ingress. - t.Log("Adding Federated Ingress") - fedIngressWatch.Add(&fedIngress) - - t.Log("Checking that UID annotation on Cluster 1 annotation was correctly updated after adding Federated Ingress") + t.Log("Checking that UID annotation on Cluster 1 annotation was correctly updated prior to adding Federated Ingress") cluster := GetClusterFromChan(fedClusterUpdateChan) assert.NotNil(t, cluster) assert.Equal(t, cluster.ObjectMeta.Annotations[uidAnnotationKey], cfg1.Data[uidKey]) + // Test add federated ingress. + t.Log("Adding Federated Ingress") + fedIngressWatch.Add(&fedIngress) + t.Logf("Checking that appropriate finalizers are added") // There should be an update to add both the finalizers. updatedIngress := GetIngressFromChan(t, fedIngressUpdateChan)