Skip to content

Commit 3fc86e1

Browse files
committed
BUG/MINOR: runtime: avoid any risk of nil pointer panic with runtime
client
1 parent f566bcd commit 3fc86e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

configure_data_plane.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,10 @@ func configureRuntimeClient(ctx context.Context, confClient *configuration.Clien
892892
}
893893
}
894894
}
895-
// no process specific settings found, Issue a warning and return nil
895+
// no process specific settings found, Issue a warning and return empty runtime client
896896
if len(sockets) == 0 {
897897
log.Warning("Runtime API not configured, found multiple processes and no stats sockets bound to them.")
898-
return nil
898+
return runtimeClient
899899
// use only found process specific sockets issue a warning if not all processes have a socket configured
900900
}
901901
if len(sockets) < int(globalConf.Nbproc) {
@@ -912,10 +912,10 @@ func configureRuntimeClient(ctx context.Context, confClient *configuration.Clien
912912
} else {
913913
log.Warning("Runtime API not configured, not using it")
914914
}
915-
return nil
915+
return runtimeClient
916916
}
917917
log.Warning("Cannot read runtime API configuration, not using it")
918-
return nil
918+
return runtimeClient
919919
}
920920

921921
func handleSignals(ctx context.Context, cancel context.CancelFunc, sigs chan os.Signal, client *client_native.HAProxyClient, haproxyOptions dataplaneapi_config.HAProxyConfiguration, users *dataplaneapi_config.Users) {

0 commit comments

Comments
 (0)