Skip to content

Commit

Permalink
fix(operator): operator panics when controller runtime logger is not …
Browse files Browse the repository at this point in the history
…initialised

Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Nov 23, 2023
1 parent 99499f0 commit 11970e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"flag"
"fmt"
"os"
env "runtime"
"time"

Expand All @@ -35,6 +36,8 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -68,6 +71,9 @@ func main() {

duration := 30 * time.Second

// Controller Runtime Logger Init
logf.SetLogger(zap.New(zap.WriteTo(os.Stdout), zap.UseDevMode(true)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Expand Down

0 comments on commit 11970e0

Please sign in to comment.