From 99aac62a5a9a5c5d883d90b10d20efff52c47e6e Mon Sep 17 00:00:00 2001 From: Quinton Hoole Date: Sun, 25 Sep 2016 19:06:12 -0700 Subject: [PATCH] Add periodic ingress reconciliations. --- .../pkg/federation-controller/ingress/ingress_controller.go | 6 ++++++ .../ingress/ingress_controller_test.go | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/federation/pkg/federation-controller/ingress/ingress_controller.go b/federation/pkg/federation-controller/ingress/ingress_controller.go index 131d9d3a808..d901196113e 100644 --- a/federation/pkg/federation-controller/ingress/ingress_controller.go +++ b/federation/pkg/federation-controller/ingress/ingress_controller.go @@ -711,10 +711,13 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) { objMeta, err := conversion.NewCloner().DeepCopy(clusterIngress.ObjectMeta) if err != nil { glog.Errorf("Error deep copying ObjectMeta: %v", err) + ic.deliverIngress(ingress, ic.ingressReviewDelay, true) + } desiredIngress.ObjectMeta, ok = objMeta.(v1.ObjectMeta) if !ok { glog.Errorf("Internal error: Failed to cast to v1.ObjectMeta: %v", objMeta) + ic.deliverIngress(ingress, ic.ingressReviewDelay, true) } // Merge any annotations and labels on the federated ingress onto the underlying cluster ingress, // overwriting duplicates. @@ -747,6 +750,7 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) { if len(operations) == 0 { // Everything is in order glog.V(4).Infof("Ingress %q is up-to-date in all clusters - no propagation to clusters required.", ingress) + ic.deliverIngress(ingress, ic.ingressReviewDelay, false) return } glog.V(4).Infof("Calling federatedUpdater.Update() - operations: %v", operations) @@ -759,4 +763,6 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) { ic.deliverIngress(ingress, ic.ingressReviewDelay, true) return } + // Schedule another periodic reconciliation, only to account for possible bugs in watch processing. + ic.deliverIngress(ingress, ic.ingressReviewDelay, false) } diff --git a/federation/pkg/federation-controller/ingress/ingress_controller_test.go b/federation/pkg/federation-controller/ingress/ingress_controller_test.go index bbaa90067e4..91f887f156c 100644 --- a/federation/pkg/federation-controller/ingress/ingress_controller_test.go +++ b/federation/pkg/federation-controller/ingress/ingress_controller_test.go @@ -99,7 +99,6 @@ func TestIngressController(t *testing.T) { Name: "test-ingress", Namespace: "mynamespace", SelfLink: "/api/v1/namespaces/mynamespace/ingress/test-ingress", - // TODO: Remove: Annotations: map[string]string{}, }, Status: extensions_v1beta1.IngressStatus{ LoadBalancer: api_v1.LoadBalancerStatus{