Skip to content

Commit dbd6182

Browse files
fix: Ensure logger is initialized before logging errors
Fixes a silent error in operator-controller where logs were not printed because the logger was not initialized before usage.
1 parent 00251d6 commit dbd6182

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/operator-controller/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ func main() {
136136
os.Exit(0)
137137
}
138138

139+
ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig()))
140+
139141
if (certFile != "" && keyFile == "") || (certFile == "" && keyFile != "") {
140142
setupLog.Error(errors.New("missing TLS configuration"),
141143
"tls-cert and tls-key flags must be used together",
@@ -154,8 +156,6 @@ func main() {
154156
metricsAddr = ":8443"
155157
}
156158

157-
ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig()))
158-
159159
setupLog.Info("starting up the controller", "version info", version.String())
160160

161161
authFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%s-%s.json", authFilePrefix, apimachineryrand.String(8)))

0 commit comments

Comments
 (0)