Skip to content
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

worker/containerd: NewWorkerOpt: remove workaround for named pipes #5399

Merged
merged 1 commit into from
Oct 8, 2024
Merged
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
24 changes: 4 additions & 20 deletions worker/containerd/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"os"
"path/filepath"
goRuntime "runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -48,28 +47,13 @@ type WorkerOptions struct {
}

// NewWorkerOpt creates a WorkerOpt.
func NewWorkerOpt(
workerOpts WorkerOptions,
opts ...containerd.ClientOpt,
) (base.WorkerOpt, error) {
func NewWorkerOpt(workerOpts WorkerOptions, opts ...containerd.ClientOpt) (base.WorkerOpt, error) {
opts = append(opts, containerd.WithDefaultNamespace(workerOpts.Namespace))

address := workerOpts.Address

if goRuntime.GOOS == "windows" {
// TODO(profnandaa): once the upstream PR[1] is merged and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for helping with this TODO!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YW! I stumbled on it while working on some things in moby/moby, and it was low-hanging fruit 🥹😅

// vendored in buildkit, we will remove this block.
// [1] https://github.com/containerd/containerd/pull/9412
address = strings.TrimPrefix(address, "npipe://")
}
client, err := containerd.New(address, opts...)
client, err := containerd.New(workerOpts.Address, opts...)
if err != nil {
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", address)
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", workerOpts.Address)
}
return newContainerd(
client,
workerOpts,
)
return newContainerd(client, workerOpts)
}

func newContainerd(client *containerd.Client, workerOpts WorkerOptions) (base.WorkerOpt, error) {
Expand Down
Loading