Add periodic ingress reconciliations.

This commit is contained in:
Quinton Hoole 2016-09-25 19:06:12 -07:00
parent 31d8f1128c
commit 99aac62a5a
2 changed files with 6 additions and 1 deletions

View File

@ -711,10 +711,13 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
objMeta, err := conversion.NewCloner().DeepCopy(clusterIngress.ObjectMeta) objMeta, err := conversion.NewCloner().DeepCopy(clusterIngress.ObjectMeta)
if err != nil { if err != nil {
glog.Errorf("Error deep copying ObjectMeta: %v", err) glog.Errorf("Error deep copying ObjectMeta: %v", err)
ic.deliverIngress(ingress, ic.ingressReviewDelay, true)
} }
desiredIngress.ObjectMeta, ok = objMeta.(v1.ObjectMeta) desiredIngress.ObjectMeta, ok = objMeta.(v1.ObjectMeta)
if !ok { if !ok {
glog.Errorf("Internal error: Failed to cast to v1.ObjectMeta: %v", objMeta) 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, // Merge any annotations and labels on the federated ingress onto the underlying cluster ingress,
// overwriting duplicates. // overwriting duplicates.
@ -747,6 +750,7 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
if len(operations) == 0 { if len(operations) == 0 {
// Everything is in order // Everything is in order
glog.V(4).Infof("Ingress %q is up-to-date in all clusters - no propagation to clusters required.", ingress) 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 return
} }
glog.V(4).Infof("Calling federatedUpdater.Update() - operations: %v", operations) 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) ic.deliverIngress(ingress, ic.ingressReviewDelay, true)
return return
} }
// Schedule another periodic reconciliation, only to account for possible bugs in watch processing.
ic.deliverIngress(ingress, ic.ingressReviewDelay, false)
} }

View File

@ -99,7 +99,6 @@ func TestIngressController(t *testing.T) {
Name: "test-ingress", Name: "test-ingress",
Namespace: "mynamespace", Namespace: "mynamespace",
SelfLink: "/api/v1/namespaces/mynamespace/ingress/test-ingress", SelfLink: "/api/v1/namespaces/mynamespace/ingress/test-ingress",
// TODO: Remove: Annotations: map[string]string{},
}, },
Status: extensions_v1beta1.IngressStatus{ Status: extensions_v1beta1.IngressStatus{
LoadBalancer: api_v1.LoadBalancerStatus{ LoadBalancer: api_v1.LoadBalancerStatus{