Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eeceb0c

Browse files
committed
vendor: update containerd and swarmkit
Signed-off-by: Alexander Morozov <[email protected]>
1 parent afe23ce commit eeceb0c

57 files changed

Lines changed: 4024 additions & 2380 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ RUN set -x \
243243
&& rm -rf "$GOPATH"
244244

245245
# Install containerd
246-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
246+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
247247
RUN set -x \
248248
&& export GOPATH="$(mktemp -d)" \
249249
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

Dockerfile.aarch64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ RUN set -x \
186186
&& rm -rf "$GOPATH"
187187

188188
# Install containerd
189-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
189+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
190190
RUN set -x \
191191
&& export GOPATH="$(mktemp -d)" \
192192
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

Dockerfile.armhf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ RUN set -x \
184184
&& rm -rf "$GOPATH"
185185

186186
# Install containerd
187-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
187+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
188188
RUN set -x \
189189
&& export GOPATH="$(mktemp -d)" \
190190
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

Dockerfile.ppc64le

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ RUN set -x \
204204
&& rm -rf "$GOPATH"
205205

206206
# Install containerd
207-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
207+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
208208
RUN set -x \
209209
&& export GOPATH="$(mktemp -d)" \
210210
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

Dockerfile.s390x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ RUN set -x \
196196
&& rm -rf "$GOPATH"
197197

198198
# Install containerd
199-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
199+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
200200
RUN set -x \
201201
&& export GOPATH="$(mktemp -d)" \
202202
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

Dockerfile.simple

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ RUN set -x \
6868
&& rm -rf "$GOPATH"
6969

7070
# Install containerd
71-
ENV CONTAINERD_COMMIT 4c21ad662f71af56c0e6b29c0afef72df441d1ff
71+
ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
7272
RUN set -x \
7373
&& export GOPATH="$(mktemp -d)" \
7474
&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \

hack/vendor.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ clone git google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0 https
141141
clone git github.com/docker/docker-credential-helpers v0.3.0
142142

143143
# containerd
144-
clone git github.com/docker/containerd 4c21ad662f71af56c0e6b29c0afef72df441d1ff
144+
clone git github.com/docker/containerd 2545227b0357eb55e369fa0072baef9ad91cdb69
145145

146146
# cluster
147-
clone git github.com/docker/swarmkit 27fbaef4ceed648bb575969ccc9083a6e104a719
147+
clone git github.com/docker/swarmkit 191acc1bbdb13d8ea3b8059dda14a12f8c3903f2
148148
clone git github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
149149
clone git github.com/gogo/protobuf v0.3
150150
clone git github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a

vendor/src/github.com/docker/containerd/api/grpc/types/api.pb.go

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/src/github.com/docker/engine-api/types/reference/image_reference.go

Lines changed: 0 additions & 34 deletions
This file was deleted.

vendor/src/github.com/docker/swarmkit/agent/agent.go

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
const (
1616
initialSessionFailureBackoff = 100 * time.Millisecond
1717
maxSessionFailureBackoff = 8 * time.Second
18+
nodeUpdatePeriod = 20 * time.Second
1819
)
1920

2021
// Agent implements the primary node functionality for a member of a swarm
@@ -134,9 +135,18 @@ func (a *Agent) run(ctx context.Context) {
134135
log.G(ctx).Debugf("(*Agent).run")
135136
defer log.G(ctx).Debugf("(*Agent).run exited")
136137

138+
// get the node description
139+
nodeDescription, err := a.nodeDescriptionWithHostname(ctx)
140+
if err != nil {
141+
log.G(ctx).WithError(err).WithField("agent", a.config.Executor).Errorf("agent: node description unavailable")
142+
}
143+
// nodeUpdateTicker is used to periodically check for updates to node description
144+
nodeUpdateTicker := time.NewTicker(nodeUpdatePeriod)
145+
defer nodeUpdateTicker.Stop()
146+
137147
var (
138148
backoff time.Duration
139-
session = newSession(ctx, a, backoff, "") // start the initial session
149+
session = newSession(ctx, a, backoff, "", nodeDescription) // start the initial session
140150
registered = session.registered
141151
ready = a.ready // first session ready
142152
sessionq chan sessionOperation
@@ -158,9 +168,16 @@ func (a *Agent) run(ctx context.Context) {
158168
select {
159169
case operation := <-sessionq:
160170
operation.response <- operation.fn(session)
161-
case msg := <-session.tasks:
162-
if err := a.worker.Assign(ctx, msg.Tasks); err != nil {
163-
log.G(ctx).WithError(err).Error("task assignment failed")
171+
case msg := <-session.assignments:
172+
switch msg.Type {
173+
case api.AssignmentsMessage_COMPLETE:
174+
if err := a.worker.AssignTasks(ctx, msg.UpdateTasks); err != nil {
175+
log.G(ctx).WithError(err).Error("failed to synchronize worker assignments")
176+
}
177+
case api.AssignmentsMessage_INCREMENTAL:
178+
if err := a.worker.UpdateTasks(ctx, msg.UpdateTasks, msg.RemoveTasks); err != nil {
179+
log.G(ctx).WithError(err).Error("failed to update worker assignments")
180+
}
164181
}
165182
case msg := <-session.messages:
166183
if err := a.handleSessionMessage(ctx, msg); err != nil {
@@ -197,10 +214,42 @@ func (a *Agent) run(ctx context.Context) {
197214
log.G(ctx).Debugf("agent: rebuild session")
198215

199216
// select a session registration delay from backoff range.
200-
delay := time.Duration(rand.Int63n(int64(backoff)))
201-
session = newSession(ctx, a, delay, session.sessionID)
217+
delay := time.Duration(0)
218+
if backoff > 0 {
219+
delay = time.Duration(rand.Int63n(int64(backoff)))
220+
}
221+
session = newSession(ctx, a, delay, session.sessionID, nodeDescription)
202222
registered = session.registered
203223
sessionq = a.sessionq
224+
case <-nodeUpdateTicker.C:
225+
// skip this case if the registration isn't finished
226+
if registered != nil {
227+
continue
228+
}
229+
// get the current node description
230+
newNodeDescription, err := a.nodeDescriptionWithHostname(ctx)
231+
if err != nil {
232+
log.G(ctx).WithError(err).WithField("agent", a.config.Executor).Errorf("agent: updated node description unavailable")
233+
}
234+
235+
// if newNodeDescription is nil, it will cause a panic when
236+
// trying to create a session. Typically this can happen
237+
// if the engine goes down
238+
if newNodeDescription == nil {
239+
continue
240+
}
241+
242+
// if the node description has changed, update it to the new one
243+
// and close the session. The old session will be stopped and a
244+
// new one will be created with the updated description
245+
if !reflect.DeepEqual(nodeDescription, newNodeDescription) {
246+
nodeDescription = newNodeDescription
247+
// close the session
248+
log.G(ctx).Info("agent: found node update")
249+
if err := session.close(); err != nil {
250+
log.G(ctx).WithError(err).Error("agent: closing session for node update failed")
251+
}
252+
}
204253
case <-a.stopped:
205254
// TODO(stevvooe): Wait on shutdown and cleanup. May need to pump
206255
// this loop a few times.
@@ -315,7 +364,8 @@ func (a *Agent) UpdateTaskStatus(ctx context.Context, taskID string, status *api
315364
if err == errTaskUnknown {
316365
err = nil // dispatcher no longer cares about this task.
317366
} else {
318-
log.G(ctx).WithError(err).Error("sending task status update failed")
367+
log.G(ctx).WithError(err).Error("closing session after fatal error")
368+
session.close()
319369
}
320370
} else {
321371
log.G(ctx).Debug("task status reported")
@@ -337,6 +387,17 @@ func (a *Agent) UpdateTaskStatus(ctx context.Context, taskID string, status *api
337387
}
338388
}
339389

390+
// nodeDescriptionWithHostname retrieves node description, and overrides hostname if available
391+
func (a *Agent) nodeDescriptionWithHostname(ctx context.Context) (*api.NodeDescription, error) {
392+
desc, err := a.config.Executor.Describe(ctx)
393+
394+
// Override hostname
395+
if a.config.Hostname != "" && desc != nil {
396+
desc.Hostname = a.config.Hostname
397+
}
398+
return desc, err
399+
}
400+
340401
// nodesEqual returns true if the node states are functionaly equal, ignoring status,
341402
// version and other superfluous fields.
342403
//

0 commit comments

Comments
 (0)