Skip to content

Commit

Permalink
Merge pull request #2805 from lizardruss/wake-spaces-on-command
Browse files Browse the repository at this point in the history
fix: check / wake up kube context if defined when running commands
  • Loading branch information
lizardruss authored Feb 15, 2024
2 parents 0a32367 + ddbfa39 commit e6293eb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/kubectl"
"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
"mvdan.cc/sh/v3/expand"

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

// verify client connectivity / authn / authz
if client != nil {
_, err = client.KubeClient().Discovery().ServerVersion()
// If the current kube context or namespace is different than old,
// show warnings and reset kube client if necessary
client, err = kubectl.CheckKubeContext(client, localCache, false, false, false, log)
if err != nil {
log.Debugf("Unable to discover server version: %v", err)
log.Debugf("Unable to verify kube context %v", err)
client = nil
}
}
Expand Down

0 comments on commit e6293eb

Please sign in to comment.