Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c3a55d2
protobuf: Port the code generators to protogen
claude Jul 31, 2026
9eb8b99
api: Drop the gogoproto options from the protobuf definitions
claude Jul 31, 2026
bc6dfd4
deps: Update etcd and raft to protoc-gen-go generated releases
claude Jul 31, 2026
f62a561
api: Regenerate with protoc-gen-go and friends
claude Jul 31, 2026
034cb2d
*: Adapt to the regenerated protobuf API
claude Jul 31, 2026
e54d6bf
api: Add a wire compatibility regression test
claude Jul 31, 2026
e2294e2
agent: Don't lose a task status whose send failed
claude Jul 31, 2026
cdb767c
*: Use new(x) instead of proto.Uint64(x)
claude Jul 31, 2026
8b71d28
make generate
vvoland Jul 31, 2026
a39a1a1
Test deepcopy and snapshotless raft decryption
vvoland Jul 31, 2026
2ddf482
ca, manager: Create nodes with non-nil annotations and status
claude Aug 3, 2026
6da76e5
manager: Keep cluster spec submessages always present
claude Aug 3, 2026
ae7fa19
manager/controlapi: UpdateNode: Keep node spec annotations non-nil
claude Aug 3, 2026
0665719
manager: Manager.Run: Tolerate a cluster spec without a raft config
claude Aug 3, 2026
2a6e4f1
manager: Create tasks with non-nil annotations
claude Aug 3, 2026
dd27e16
manager/resourceapi: AttachNetwork: Reject requests without a config
claude Aug 3, 2026
a8be5a8
manager/logbroker: Reject log messages without a context
claude Aug 3, 2026
e4b65f1
manager/dispatcher: Don't update volumes missing from the store
claude Aug 3, 2026
788d068
manager/scheduler: Compare node meta versions by value
claude Aug 3, 2026
99c6291
manager/csi: Skip controller capabilities without an RPC type
claude Aug 3, 2026
15e27c0
ca: GetUnlockKey: Fail until the cluster object exists
claude Aug 3, 2026
5d3863b
cmd/swarmctl: Guard against specs with absent submessages
claude Aug 3, 2026
31e6273
cmd/swarm-rafttool: Tolerate partial snapshots and WAL entries
claude Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ build:
🐳 bin/swarmd
🐳 bin/swarmctl
🐳 bin/swarm-bench
🐳 bin/protoc-gen-gogoswarm
🐳 bin/protoc-gen-swarm
🐳 binaries
🐳 vet
🐳 lint
🐳 build
github.com/moby/swarmkit
github.com/moby/swarmkit/vendor/github.com/davecgh/go-spew/spew
github.com/moby/swarmkit/vendor/github.com/pmezard/go-difflib/difflib
github.com/moby/swarmkit/cmd/protoc-gen-gogoswarm
github.com/moby/swarmkit/cmd/protoc-gen-swarm
github.com/moby/swarmkit/cmd/swarm-bench
github.com/moby/swarmkit/cmd/swarmctl
github.com/moby/swarmkit/vendor/github.com/stretchr/testify/assert
Expand Down
21 changes: 5 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION=1.25
ARG GO_VERSION=1.26
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"

Expand Down Expand Up @@ -45,16 +45,6 @@ RUN --mount=type=bind,target=.,rw \
fi
EOT

FROM gobase AS protoc-gen-gogoswarm
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/root/.cache \
make bin/protoc-gen-gogoswarm && mv bin/protoc-gen-gogoswarm /usr/local/bin/

FROM gobase AS protobuild
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
go install tool github.com/containerd/protobuild

FROM gobase AS generate-base
RUN apt-get --no-install-recommends install -y unzip
ARG PROTOC_VERSION
Expand All @@ -69,14 +59,13 @@ EOT

FROM generate-base AS generate-build
RUN --mount=type=bind,target=.,rw \
--mount=from=packages,source=/tmp/packages,target=/tmp/packages \
--mount=from=protobuild,source=/go/bin/protobuild,target=/usr/bin/protobuild \
--mount=from=protoc-gen-gogoswarm,source=/usr/local/bin/protoc-gen-gogoswarm,target=/usr/bin/protoc-gen-gogoswarm <<EOT
--mount=type=cache,target=/root/.cache \
--mount=from=packages,source=/tmp/packages,target=/tmp/packages <<EOT
set -ex
protobuild $(cat /tmp/packages/packages)
./hack/generate-protos.sh
go generate -mod=vendor -x $(cat /tmp/packages/packages)
mkdir /out
git ls-files -m --others -- ':!vendor' '**/*.pb.go' | tar -cf - --files-from - | tar -C /out -xf -
git ls-files -m --others -- ':!vendor' '**/*.pb.go' 'api/api.pb.txt' | tar -cf - --files-from - | tar -C /out -xf -
EOT

FROM scratch AS generate-update
Expand Down
38 changes: 0 additions & 38 deletions Protobuild.toml

This file was deleted.

37 changes: 19 additions & 18 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"sync"
"time"

"github.com/gogo/protobuf/proto"
"github.com/moby/swarmkit/v2/agent/exec"
"github.com/moby/swarmkit/v2/api"
"github.com/moby/swarmkit/v2/log"
"github.com/moby/swarmkit/v2/remotes"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)

const (
Expand Down Expand Up @@ -301,20 +302,20 @@ func (a *Agent) run(ctx context.Context) {
}
case sub := <-session.subscriptions:
if sub.Close {
if cancel, ok := subscriptions[sub.ID]; ok {
if cancel, ok := subscriptions[sub.Id]; ok {
cancel()
}
delete(subscriptions, sub.ID)
delete(subscriptions, sub.Id)
continue
}

if _, ok := subscriptions[sub.ID]; ok {
if _, ok := subscriptions[sub.Id]; ok {
// Duplicate subscription
continue
}

subCtx, subCancel := context.WithCancel(ctx)
subscriptions[sub.ID] = subCancel
subscriptions[sub.Id] = subCancel
// NOTE(dperny): for like 3 years, there has been a to do saying
// "we're tossing the error here, that seems wrong". this is not a
// to do anymore. 9/10 of these errors are going to be "context
Expand All @@ -326,7 +327,7 @@ func (a *Agent) run(ctx context.Context) {
// ourselves that this has occurred. We cannot rely on getting
// a Close message from the manager, as any number of things
// could go wrong (see github.com/moby/moby/issues/39916).
subscriptionDone <- sub.ID
subscriptionDone <- sub.Id
}()
case subID := <-subscriptionDone:
// subscription may already have been removed. If so, no need to
Expand Down Expand Up @@ -411,14 +412,14 @@ func (a *Agent) run(ctx context.Context) {
}

func (a *Agent) handleSessionMessage(ctx context.Context, message *api.SessionMessage, nti *api.NodeTLSInfo) error {
seen := map[api.Peer]struct{}{}
seen := map[remotes.PeerKey]struct{}{}
for _, manager := range message.Managers {
if manager.Peer.Addr == "" {
continue
}

a.config.ConnBroker.Remotes().Observe(*manager.Peer, int(manager.Weight))
seen[*manager.Peer] = struct{}{}
a.config.ConnBroker.Remotes().Observe(manager.Peer, int(manager.Weight))
seen[remotes.NewPeerKey(manager.Peer)] = struct{}{}
}

var changes *NodeChanges
Expand Down Expand Up @@ -446,7 +447,7 @@ func (a *Agent) handleSessionMessage(ctx context.Context, message *api.SessionMe
// prune managers not in list.
for peer := range a.config.ConnBroker.Remotes().Weights() {
if _, ok := seen[peer]; !ok {
a.config.ConnBroker.Remotes().Remove(peer)
a.config.ConnBroker.Remotes().Remove(peer.Peer())
}
}

Expand Down Expand Up @@ -599,15 +600,15 @@ func (a *Agent) Publisher(ctx context.Context, subscriptionID string) (exec.LogP
sendCloseMsg := func() {
// send a close message, to tell the manager our logs are done
publisher.Send(&api.PublishLogsMessage{
SubscriptionID: subscriptionID,
SubscriptionId: subscriptionID,
Close: true,
})
// close the stream forreal. ignore the return value and the error,
// because we don't care.
publisher.CloseAndRecv()
}

return exec.LogPublisherFunc(func(ctx context.Context, message api.LogMessage) error {
return exec.LogPublisherFunc(func(ctx context.Context, message *api.LogMessage) error {
select {
case <-ctx.Done():
sendCloseMsg()
Expand All @@ -616,8 +617,8 @@ func (a *Agent) Publisher(ctx context.Context, subscriptionID string) (exec.LogP
}

return publisher.Send(&api.PublishLogsMessage{
SubscriptionID: subscriptionID,
Messages: []api.LogMessage{message},
SubscriptionId: subscriptionID,
Messages: []*api.LogMessage{message},
})
}), func() {
sendCloseMsg()
Expand All @@ -633,8 +634,8 @@ func (a *Agent) nodeDescriptionWithHostname(ctx context.Context, tlsInfo *api.No
if a.config.Hostname != "" {
desc.Hostname = a.config.Hostname
}
desc.TLSInfo = tlsInfo
desc.FIPS = a.config.FIPS
desc.TlsInfo = tlsInfo
desc.Fips = a.config.FIPS
}
return desc, err
}
Expand All @@ -646,8 +647,8 @@ func (a *Agent) nodeDescriptionWithHostname(ctx context.Context, tlsInfo *api.No
func nodesEqual(a, b *api.Node) bool {
a, b = a.Copy(), b.Copy()

a.Status, b.Status = api.NodeStatus{}, api.NodeStatus{}
a.Meta, b.Meta = api.Meta{}, api.Meta{}
a.Status, b.Status = nil, nil
a.Meta, b.Meta = nil, nil

return proto.Equal(a, b)
}
Expand Down
Loading