Skip to content

Commit 724d8d4

Browse files
committed
fix: log a warning when the local registry is skipped due to Minikube
1 parent 35682f1 commit 724d8d4

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

pkg/devspace/build/build.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,21 @@ func (c *controller) Build(ctx devspacecontext.Context, images []string, options
9595
if !options.SkipPush &&
9696
!useKindLoad &&
9797
(registry.IsLocalRegistryEnabled(conf) || registry.IsLocalRegistryFallback(conf)) {
98+
ctx := ctx.WithLogger(ctx.Log().WithPrefix("local-registry: "))
9899
for key, imageConf := range conf.Images {
99100
imageName := imageConf.Image
100101
imageConfigName := key
101-
useMinikubeDocker := registry.UseMinikubeDocker(ctx, imageConf)
102-
isLocalReqistryRequired := !useMinikubeDocker && !registry.HasPushPermission(imageConf)
103102

103+
// Update cache for non-local registry use by default
104104
imageCache, _ := ctx.Config().LocalCache().GetImageCache(imageConfigName)
105-
if isLocalReqistryRequired {
105+
imageCache.LocalRegistryImageName = ""
106+
107+
// Determine whether the local registry is required / enabled
108+
isLocalReqistryRequired := !registry.HasPushPermission(imageConf)
109+
useMinikubeDocker := registry.UseMinikubeDocker(ctx, imageConf)
110+
if useMinikubeDocker {
111+
ctx.Log().Warnf("Using Minikube for image %s, skipping local registry", imageConf.Image)
112+
} else if isLocalReqistryRequired {
106113
// Not able to deploy a local registry
107114
if kubeClient == nil {
108115
return fmt.Errorf("unable to push image %s and a valid kube context is not available", imageConf.Image)
@@ -115,7 +122,6 @@ func (c *controller) Build(ctx devspacecontext.Context, images []string, options
115122
WithLocalRegistryConfig(conf.LocalRegistry),
116123
)
117124

118-
ctx := ctx.WithLogger(ctx.Log().WithPrefix("local-registry: "))
119125
err := localRegistry.Start(ctx)
120126
if err != nil {
121127
return errors.Wrap(err, "start registry")
@@ -130,9 +136,6 @@ func (c *controller) Build(ctx devspacecontext.Context, images []string, options
130136

131137
// Update cache for local registry use
132138
imageCache.LocalRegistryImageName = builtImageName
133-
} else {
134-
// Update if not using local registry
135-
imageCache.LocalRegistryImageName = ""
136139
}
137140
ctx.Config().LocalCache().SetImageCache(imageConfigName, imageCache)
138141
}

0 commit comments

Comments
 (0)