Skip to content

Commit

Permalink
fix(storage-network): annotated pod in creation loop
Browse files Browse the repository at this point in the history
longhorn-7640

Co-authored-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Signed-off-by: Eric Weber <eric.weber@suse.com>
(cherry picked from commit 43e997c)
  • Loading branch information
ejweber authored and PhanLe1010 committed Apr 4, 2024
1 parent 142c851 commit fb17970
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion controller/setting_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ func (sc *SettingController) updateCNI() error {
}

nadAnnot := string(types.CNIAnnotationNetworks)
nadAnnotValue := types.CreateCniAnnotationFromSetting(storageNetwork)

imPodList, err := sc.ds.ListInstanceManagerPods()
if err != nil {
return errors.Wrapf(err, "failed to list instance manager Pods for %v setting update", types.SettingNameStorageNetwork)
Expand All @@ -775,10 +777,16 @@ func (sc *SettingController) updateCNI() error {

pods := append(imPodList, bimPodList...)
for _, pod := range pods {
if pod.Annotations[nadAnnot] == storageNetwork.Value {
if pod.Annotations[nadAnnot] == nadAnnotValue {
continue
}

logrus.WithFields(logrus.Fields{
"pod": pod.Name,
"oldValue": pod.Annotations[nadAnnot],
"newValue": nadAnnotValue,
}).Infof("Deleting pod to update the %v annotation", nadAnnot)

if err := sc.ds.DeletePod(pod.Name); err != nil {
return err
}
Expand Down

0 comments on commit fb17970

Please sign in to comment.