Skip to content

Commit

Permalink
Merge pull request #2753 from lizardruss/ENG-2185
Browse files Browse the repository at this point in the history
Devspace defaults to uploading credentials to cluster
  • Loading branch information
lizardruss authored Nov 15, 2023
2 parents bc3af8d + 5b2f7ea commit 6c1e41e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/devspace/build/build.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package build

import (
"strings"

dockerclient "github.com/loft-sh/devspace/pkg/devspace/docker"
"github.com/loft-sh/devspace/pkg/devspace/pullsecrets"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/build/builder"
"github.com/loft-sh/devspace/pkg/devspace/build/types"
Expand Down Expand Up @@ -98,17 +99,17 @@ func (c *controller) Build(ctx devspacecontext.Context, images []string, options

dockerClient, err := dockerclient.NewClient(ctx.Context(), ctx.Log())
if err == nil {
if imageConf.Kaniko != nil && imageConf.Kaniko.Namespace != "" && ctx.KubeClient().Namespace() != imageConf.Kaniko.Namespace {
err = pullsecrets.NewClient().EnsurePullSecret(ctx, dockerClient, imageConf.Kaniko.Namespace, registryURL)
if imageConf.Kaniko != nil {
pullSecretNamespace := imageConf.Kaniko.Namespace
if pullSecretNamespace == "" {
pullSecretNamespace = ctx.KubeClient().Namespace()
}

err = pullsecrets.NewClient().EnsurePullSecret(ctx, dockerClient, pullSecretNamespace, registryURL)
if err != nil {
ctx.Log().Errorf("error ensuring pull secret for registry %s: %v", registryURL, err)
}
}

err = pullsecrets.NewClient().EnsurePullSecret(ctx, dockerClient, ctx.KubeClient().Namespace(), registryURL)
if err != nil {
ctx.Log().Errorf("error ensuring pull secret for registry %s: %v", registryURL, err)
}
}
}

Expand Down

0 comments on commit 6c1e41e

Please sign in to comment.