-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip local registry use for vclusters on local kubernetes clusters #2390
Skip local registry use for vclusters on local kubernetes clusters #2390
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabianKramm added some additional context to these changes. Let me know if you'd like anything changed.
@@ -106,10 +101,7 @@ func (c *controller) Build(ctx devspacecontext.Context, images []string, options | |||
|
|||
// Determine whether the local registry is required / enabled | |||
isLocalReqistryRequired := !registry.HasPushPermission(imageConf) | |||
useMinikubeDocker := registry.UseMinikubeDocker(ctx, imageConf) | |||
if useMinikubeDocker { | |||
ctx.Log().Warnf("Using Minikube for image %s, skipping local registry", imageConf.Image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can bring back this edge case if desired, but it was somewhat unexpected to have localRegistry.enabled = true
and it still not be used because of minikube.
This did require using a docker client configured for the minikube environment to work, see later comments.
ref, err := name.ParseReference(imageName) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
image, err := daemon.Image(ref, daemon.WithContext(ctx)) | ||
image, err := daemon.Image(ref, daemon.WithContext(ctx), daemon.WithClient(client.DockerAPIClient())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update allows the local registry push to work with either the local docker daemon, or the Minikube docker daemon.
@@ -107,7 +109,7 @@ func newDockerClientFromEnvironment() (Client, error) { | |||
} | |||
|
|||
func newDockerClientFromMinikube(ctx context.Context, currentKubeContext string) (Client, error) { | |||
if currentKubeContext != "minikube" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also miss vcluster + Minikube contexts
What issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
Please provide a short message that should be published in the DevSpace release notes
Fixed an issue where DevSpace local registry was incorrectly used for virtual clusters on local Kubernetes clusters
What else do we need to know?
Previously the local registry could never be used with minikube. These changes allow the user to opt in to the local registry with Minikube, and makes it consistent with the other local kubernetes options (KinD & Docker Desktop). There isn't a practical reason to do this, but using
localRegistry.enabled=true
in the config, and not having the local registry used was unexpected to some during testing.There is also a KinD issue where
--force-build
creates a new tag, butkind load docker-image
fails to re-tag the image in the KinD cluster, leading to anImagePullBackoff
. I've verified this issue exists in DevSpace version before the local registry feature was added. Using the local registry works as a workaround for this issue.