Skip to content

Commit

Permalink
cni: network.cni job updates should replace allocs (#23764)
Browse files Browse the repository at this point in the history
a change to the network{cni{}} block means that
the user wants the network config to change,
and that only happens during initial alloc setup,
so we need to replace the alloc(s) to get
fresh network(s) to reconfigure from scratch.

e.g. a job plan diff like this

```
+/- Task Group: "g" (1 in-place update)
  + Network {
    + CNIConfig {
      + a: "ayy"
      }
```

should instead be

```
+/- Task Group: "g" (1 create/destroy update)
  + Network {
    + CNIConfig {
      + a: "ayy"
      }
```
  • Loading branch information
gulducat authored Aug 7, 2024
1 parent 20511fa commit d131c41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/23764.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cni: network.cni jobspec updates now replace allocs to apply the new network config
```
4 changes: 4 additions & 0 deletions scheduler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ func networkUpdated(netA, netB []*structs.NetworkResource) comparison {
return difference("network dns", an.DNS, bn.DNS)
}

if !an.CNI.Equal(bn.CNI) {
return difference("network cni", an.CNI, bn.CNI)
}

aPorts, bPorts := networkPortMap(an), networkPortMap(bn)
if !aPorts.Equal(bPorts) {
return difference("network port map", aPorts, bPorts)
Expand Down

0 comments on commit d131c41

Please sign in to comment.