Skip to content

Commit e6293eb

Browse files
authored
Merge pull request #2805 from lizardruss/wake-spaces-on-command
fix: check / wake up kube context if defined when running commands
2 parents 0a32367 + ddbfa39 commit e6293eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd/run.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"strings"
99

10+
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
1011
"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
1112
"mvdan.cc/sh/v3/expand"
1213

@@ -251,9 +252,11 @@ func (cmd *RunCmd) LoadCommandsConfig(f factory.Factory, configLoader loader.Con
251252

252253
// verify client connectivity / authn / authz
253254
if client != nil {
254-
_, err = client.KubeClient().Discovery().ServerVersion()
255+
// If the current kube context or namespace is different than old,
256+
// show warnings and reset kube client if necessary
257+
client, err = kubectl.CheckKubeContext(client, localCache, false, false, false, log)
255258
if err != nil {
256-
log.Debugf("Unable to discover server version: %v", err)
259+
log.Debugf("Unable to verify kube context %v", err)
257260
client = nil
258261
}
259262
}

0 commit comments

Comments
 (0)