Skip to content

Commit 53b575b

Browse files
committed
Throttle resourcesynccontroller on pairs with dual writers.
Writes from the instance of resourcesynccontroller in the operator can contend with writes from the recovery sidecar's instance of the same controller. This is a preexisting issue, and the controller doesn't have an effective way to limit resync frequency. Adding some fixed latency to each sync in this way sets an upper bound on the churn rate when the two instances get into a feedback cycle. The separate issues that can create a feedback cycle (e.g. the resourcesynccontroller degraded operator status condition is shared by both instances) should be separately addressed "soon".
1 parent 90dc670 commit 53b575b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/operator/resourcesynccontroller/resourcesynccontroller.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package resourcesynccontroller
22

33
import (
4+
"time"
5+
46
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
57

68
"github.com/openshift/library-go/pkg/operator/events"
@@ -11,16 +13,24 @@ import (
1113
)
1214

1315
func AddSyncCSRControllerCA(resourceSyncController *resourcesynccontroller.ResourceSyncController) error {
14-
return resourceSyncController.SyncConfigMap(
16+
return resourceSyncController.SyncConfigMapConditionally(
1517
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.GlobalMachineSpecifiedConfigNamespace, Name: "csr-controller-ca"},
1618
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.OperatorNamespace, Name: "csr-controller-ca"},
19+
func() (bool, error) {
20+
time.Sleep(6 * time.Second)
21+
return true, nil
22+
},
1723
)
1824
}
1925

2026
func AddSyncClientCertKeySecret(resourceSyncController *resourcesynccontroller.ResourceSyncController) error {
21-
return resourceSyncController.SyncSecret(
27+
return resourceSyncController.SyncSecretConditionally(
2228
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.TargetNamespace, Name: "kube-controller-manager-client-cert-key"},
2329
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.GlobalMachineSpecifiedConfigNamespace, Name: "kube-controller-manager-client-cert-key"},
30+
func() (bool, error) {
31+
time.Sleep(6 * time.Second)
32+
return true, nil
33+
},
2434
)
2535
}
2636

0 commit comments

Comments
 (0)