Skip to content

Commit 4793190

Browse files
committed
Switch context once on init, but not during up
1 parent fc40a51 commit 4793190

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

cmd/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func (cmd *InitCmd) useDevSpaceCloud() bool {
369369
cmd.config.Cluster.DevSpaceCloud = &useDevSpaceCloud
370370
cmd.config.Cluster.UseKubeConfig = &addToContext
371371

372-
err := login.Update(cmd.config)
372+
err := login.Update(cmd.config, true)
373373
if err != nil {
374374
log.Fatalf("Couldn't authenticate to devspace cloud: %v", err)
375375
}

cmd/up.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (cmd *UpCmd) Run(cobraCmd *cobra.Command, args []string) {
140140
// Load config
141141
config := configutil.GetConfig(false)
142142
if config.Cluster.DevSpaceCloud != nil && *config.Cluster.DevSpaceCloud {
143-
err = login.Update(config)
143+
err = login.Update(config, false)
144144
if err != nil {
145145
log.Warnf("Couldn't update devspace cloud cluster information: %v", err)
146146
}

pkg/devspace/login/login.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func Login() (string, *api.Cluster, *api.AuthInfo, error) {
157157
}
158158

159159
// Update updates the devspace cloud information if necessary
160-
func Update(config *v1.Config) error {
160+
func Update(config *v1.Config, switchContext bool) error {
161161
// Don't update anything if we don't use the devspace cloud
162162
if *config.Cluster.DevSpaceCloud == false {
163163
return nil
@@ -172,7 +172,7 @@ func Update(config *v1.Config) error {
172172
config.Services.Tiller.Release.Namespace = &namespace
173173

174174
if *config.Cluster.UseKubeConfig {
175-
err = UpdateKubeConfig(cluster, authInfo, true)
175+
err = UpdateKubeConfig(cluster, authInfo, switchContext)
176176
if err != nil {
177177
return err
178178
}

0 commit comments

Comments
 (0)