Skip to content

Commit

Permalink
Make operator more resiliant to etcd defrag activity (open-telemetry#742
Browse files Browse the repository at this point in the history
)

* Make operator more resiliant to etcd defrag activity

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay authored Feb 28, 2022
1 parent 39e8754 commit 76bfb25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os"
"runtime"
"strings"
"time"

"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -135,6 +136,10 @@ func main() {
setupLog.Info("the env var WATCH_NAMESPACE isn't set, watching all namespaces")
}

// see https://github.com/openshift/library-go/blob/4362aa519714a4b62b00ab8318197ba2bba51cb7/pkg/config/leaderelection/leaderelection.go#L104
leaseDuration := time.Second * 137
renewDeadline := time.Second * 107
retryPeriod := time.Second * 26
mgrOptions := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Expand All @@ -143,6 +148,9 @@ func main() {
LeaderElection: enableLeaderElection,
LeaderElectionID: "9f7554c3.opentelemetry.io",
Namespace: watchNamespace,
LeaseDuration: &leaseDuration,
RenewDeadline: &renewDeadline,
RetryPeriod: &retryPeriod,
}

if strings.Contains(watchNamespace, ",") {
Expand Down

0 comments on commit 76bfb25

Please sign in to comment.