From d131c41943cd8d2560ad044ad75981d2a0501457 Mon Sep 17 00:00:00 2001 From: Daniel Bennett Date: Wed, 7 Aug 2024 12:13:11 -0500 Subject: [PATCH] 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" } ``` --- .changelog/23764.txt | 3 +++ scheduler/util.go | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 .changelog/23764.txt diff --git a/.changelog/23764.txt b/.changelog/23764.txt new file mode 100644 index 000000000..8b8c1f393 --- /dev/null +++ b/.changelog/23764.txt @@ -0,0 +1,3 @@ +```release-note:bug +cni: network.cni jobspec updates now replace allocs to apply the new network config +``` diff --git a/scheduler/util.go b/scheduler/util.go index 85a94addc..09d52b5a3 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -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)