Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nightly-int-test-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Nightly Integration Test WorkFlow
on:
schedule:
- cron: "0 06 * * *"
- cron: "0 06 * * 0"
jobs:
build-operator-image:
runs-on: ubuntu-latest
Expand Down
27 changes: 25 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"flag"
"os"
"time"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
Expand Down Expand Up @@ -66,14 +67,34 @@ func main() {
var logEncoder string
var logLevel int

flag.StringVar(&logEncoder, "logEncoder", "json", "log encoding ('json' or 'console')")
var leaseDuration time.Duration
var renewDeadline time.Duration
var leaseDurationSecond int
var renewDeadlineSecond int

flag.StringVar(&logEncoder, "log-encoder", "json", "log encoding ('json' or 'console')")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&pprofActive, "pprof", true, "Enable pprof endpoint")
flag.IntVar(&logLevel, "loglevel", int(zapcore.InfoLevel), "set log level")
flag.IntVar(&logLevel, "log-level", int(zapcore.InfoLevel), "set log level")
flag.IntVar(&leaseDurationSecond, "lease-duration", int(leaseDurationSecond), "manager lease duration in seconds")
flag.IntVar(&renewDeadlineSecond, "renew-duration", int(renewDeadlineSecond), "manager renew duration in seconds")

// see https://github.com/operator-framework/operator-sdk/issues/1813
if leaseDurationSecond < 30 {
leaseDuration = 30 * time.Second
} else {
leaseDuration = time.Duration(leaseDurationSecond) * time.Second
}

if renewDeadlineSecond < 20 {
renewDeadline = 20 * time.Second
} else {
renewDeadline = time.Duration(renewDeadlineSecond) * time.Second
}

opts := zap.Options{
Development: true,
Expand All @@ -92,6 +113,8 @@ func main() {
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "270bec8c.splunk.com",
LeaseDuration: &leaseDuration,
RenewDeadline: &renewDeadline,
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), config.ManagerOptionsWithNamespaces(setupLog, options))
Expand Down