Skip to content

Commit ab6919b

Browse files
committed
fix: prevent panic when checking server version without a kube context configured
Fixes #2711 Fixed ENG-2019 Signed-off-by: Russell Centanni <russell.centanni@gmail.com>
1 parent c477eaf commit ab6919b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

cmd/run.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,12 @@ func (cmd *RunCmd) LoadCommandsConfig(f factory.Factory, configLoader loader.Con
250250
}
251251

252252
// verify client connectivity / authn / authz
253-
_, err = client.KubeClient().Discovery().ServerVersion()
254-
if err != nil {
255-
log.Debugf("Unable to discover server version: %v", err)
256-
client = nil
253+
if client != nil {
254+
_, err = client.KubeClient().Discovery().ServerVersion()
255+
if err != nil {
256+
log.Debugf("Unable to discover server version: %v", err)
257+
client = nil
258+
}
257259
}
258260

259261
// Parse commands

0 commit comments

Comments
 (0)