cni: network.cni job updates should replace allocs (#23764)

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"
      }
```
This commit is contained in:
Daniel Bennett
2024-08-07 12:13:11 -05:00
committed by GitHub
parent 20511fa64d
commit d131c41943
2 changed files with 7 additions and 0 deletions

3
.changelog/23764.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
cni: network.cni jobspec updates now replace allocs to apply the new network config
```

View File

@@ -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)