Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions helper/util/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ import (
"context"
"io"
"net"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/resolver"
)

// NewClientConnection creates a new client connection for the given reader and writer
func NewClientConnection(reader io.Reader, writer io.Writer) (*grpc.ClientConn, error) {
pipe := NewStdStreamJoint(reader, writer, false)

resolver.SetDefaultScheme("passthrough")

// Set up a connection to the server.
return grpc.NewClient("",
return grpc.NewClient("passthrough:///",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
return pipe, nil
}),
grpc.WithLocalDNSResolution(),
grpc.WithDefaultCallOptions())
grpc.WithLocalDNSResolution())
}
13 changes: 6 additions & 7 deletions pkg/devspace/services/sync/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"bytes"
"context"
"fmt"
"github.com/loft-sh/devspace/pkg/util/tomb"
"github.com/mgutz/ansi"
"io"
"os"
"path"
Expand All @@ -15,6 +13,9 @@ import (
"strings"
"time"

"github.com/loft-sh/devspace/pkg/util/tomb"
"github.com/mgutz/ansi"

"github.com/loft-sh/devspace/pkg/devspace/kubectl/selector"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -267,9 +268,7 @@ func PrintPodError(ctx context.Context, kubeClient kubectl.Client, pod *v1.Pod,
}

func (c *controller) startSync(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error) (*sync.Sync, *selector.SelectedPodContainer, error) {
var (
syncConfig = options.SyncConfig
)
syncConfig := options.SyncConfig

container, err := options.Selector.SelectSingleContainer(ctx.Context(), ctx.KubeClient(), ctx.Log())
if err != nil {
Expand Down Expand Up @@ -501,7 +500,7 @@ func (c *controller) initClient(ctx devspacecontext.Context, pod *v1.Pod, arch,
go func() {
err := StartStream(ctx.Context(), ctx.KubeClient(), pod, container, upstreamArgs, upStdinReader, upStdoutWriter, true, options.Log)
if err != nil {
syncClient.Stop(errors.Errorf("Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
syncClient.Stop(errors.Errorf("Upstream Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
}
}()

Expand Down Expand Up @@ -529,7 +528,7 @@ func (c *controller) initClient(ctx devspacecontext.Context, pod *v1.Pod, arch,
go func() {
err := StartStream(ctx.Context(), ctx.KubeClient(), pod, container, downstreamArgs, downStdinReader, downStdoutWriter, true, options.Log)
if err != nil {
syncClient.Stop(errors.Errorf("Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
syncClient.Stop(errors.Errorf("Downstream Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
}
}()

Expand Down
Loading