@@ -375,6 +375,9 @@ func (r unstructuredScalableResource) InstanceDRADriver() string {
375
375
}
376
376
377
377
func (r unstructuredScalableResource ) readInfrastructureReferenceResource () (* unstructured.Unstructured , error ) {
378
+ obKind := r .unstructured .GetKind ()
379
+ obName := r .unstructured .GetName ()
380
+
378
381
infraref , found , err := unstructured .NestedStringMap (r .unstructured .Object , "spec" , "template" , "spec" , "infrastructureRef" )
379
382
if ! found || err != nil {
380
383
return nil , nil
@@ -393,20 +396,23 @@ func (r unstructuredScalableResource) readInfrastructureReferenceResource() (*un
393
396
// Fall back to ObjectReference in capi v1beta1
394
397
apiversion , ok = infraref ["apiVersion" ]
395
398
if ! ok {
396
- klog .V (4 ).Info ("Missing apiVersion" )
397
- return nil , errors .New ("Missing apiVersion" )
399
+ info := fmt .Sprintf ("Missing apiVersion from %s %s's InfrastructureReference" , obKind , obName )
400
+ klog .V (4 ).Info (info )
401
+ return nil , errors .New (info )
398
402
}
399
403
}
400
404
401
405
kind , ok := infraref ["kind" ]
402
406
if ! ok {
403
- klog .V (4 ).Info ("Missing kind" )
404
- return nil , errors .New ("Missing kind" )
407
+ info := fmt .Sprintf ("Missing kind from %s %s's InfrastructureReference" , obKind , obName )
408
+ klog .V (4 ).Info (info )
409
+ return nil , errors .New (info )
405
410
}
406
411
name , ok := infraref ["name" ]
407
412
if ! ok {
408
- klog .V (4 ).Info ("Missing name" )
409
- return nil , errors .New ("Missing name" )
413
+ info := fmt .Sprintf ("Missing name from %s %s's InfrastructureReference" , obKind , obName )
414
+ klog .V (4 ).Info (info )
415
+ return nil , errors .New (info )
410
416
}
411
417
// kind needs to be lower case and plural
412
418
kind = fmt .Sprintf ("%ss" , strings .ToLower (kind ))
0 commit comments