@@ -2,10 +2,10 @@ package render
2
2
3
3
import (
4
4
"context"
5
- goerrs "errors"
6
5
"fmt"
7
6
"reflect"
8
7
"sort"
8
+ "strings"
9
9
"time"
10
10
11
11
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
@@ -667,8 +667,33 @@ func generateAndValidateRenderedMachineConfig(currentMC *mcfgv1.MachineConfig, p
667
667
668
668
klog .V (4 ).Infof ("Considering generated MachineConfig %q" , generated .Name )
669
669
670
- if err := ctrlcommon .IsRenderedConfigReconcilable (currentMC , generated ); err != nil {
671
- return nil , goerrs .Join (err , ctrlcommon .IsComponentConfigsReconcilable (currentMC , configs ))
670
+ if fullErr := ctrlcommon .IsRenderedConfigReconcilable (currentMC , generated ); fullErr != nil {
671
+ fullMsg := fullErr .Error ()
672
+
673
+ // trying to match error reason suffix
674
+ for _ , cfg := range configs {
675
+ singleErr := ctrlcommon .IsComponentConfigsReconcilable (
676
+ currentMC , []* mcfgv1.MachineConfig {cfg },
677
+ )
678
+ if singleErr == nil {
679
+ continue
680
+ }
681
+ singleMsg := singleErr .Error ()
682
+
683
+ // split off prefix
684
+ parts := strings .SplitN (singleMsg , ": " , 2 )
685
+ if len (parts ) == 2 {
686
+ reason := parts [1 ]
687
+ if strings .Contains (fullMsg , reason ) {
688
+ klog .V (4 ).Infof ("match found for base %q on reason %q" , cfg .Name , reason )
689
+ return nil , fmt .Errorf ("reconciliation failed between current config %q and base config %q: %s" , currentMC .Name , cfg .Name , reason )
690
+ }
691
+ }
692
+ }
693
+
694
+ // fallback
695
+ compErr := ctrlcommon .IsComponentConfigsReconcilable (currentMC , configs )
696
+ return nil , fmt .Errorf ("render reconciliation error: %v; component errors: %v" , fullErr , compErr )
672
697
}
673
698
674
699
klog .V (4 ).Infof ("Rendered MachineConfig %q is reconcilable against %q" , generated .Name , currentMC .Name )
0 commit comments