Fixing error with host network mode on upgrade from pre 17.06 versions#2244
Conversation
|
Thanks @abhinandanpb . LGTM This PR prevents worker panic running older versions (17.05 and lower) when the user executes |
deae917 to
49819a2
Compare
| log.G(ctx).WithError(err).Error("failed to create predefined network " + p.Name) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Rather than duplicate this code, let's move the creation of predefined networks outside the if/else.
Codecov Report
@@ Coverage Diff @@
## master #2244 +/- ##
==========================================
- Coverage 60.41% 60.29% -0.12%
==========================================
Files 124 124
Lines 20248 20221 -27
==========================================
- Hits 12233 12193 -40
- Misses 6642 6657 +15
+ Partials 1373 1371 -2 |
| n.DriverState = &api.Driver{ | ||
| Name: d.name, | ||
| } | ||
| n.IPAM = &api.IPAMOptions{Driver: &api.Driver{}} |
There was a problem hiding this comment.
Can you add a comment about why this is necessary?
Also, I'm not sure this should be done at allocation time. That leaves a window where it could crash an earlier version. Shouldn't it be done at the time the network is created?
There was a problem hiding this comment.
Actually, maybe it's okay if n.IPAM is nil before allocation. I guess previous versions would not attempt to use it on an unallocated network. Can you confirm?
0863ead to
0066e4f
Compare
31ed250 to
59624ab
Compare
This commit contains the following fixes: 1) On upgrade from pre 17.06 version services created with net=host were failing because the swarm was not aware of host network being created. The fix added takes care of this by creating network if the store does not contain predefined networks 2) On a cluster with upgraded 17.06 version of docker swarm manager the daemon panics while trying to access IPAM driver in the createNetworkRequest on the nodes with pre 17.06 versions. In order to avoid panics empty struct is passed with network attachment. This does not have any function impact. Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
|
LGTM |
This commit contains the following fixes:
On upgrade from pre 17.06 version services created with net=host
were failing because the swarm was not aware of host network being
created. The fix added takes care of this by creating network if
the store does not contain predefined networks
On a cluster with upgraded 17.06 version of docker swarm manager
the daemon panics while trying to access IPAM driver in the createNetworkRequest on
the nodes with pre 17.06 versions. In order to avoid panics empty struct is passed
with network attachment. This does not have any function impact.
Signed-off-by: Abhinandan Prativadi abhi@docker.com