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