@@ -375,6 +375,9 @@ func (r unstructuredScalableResource) InstanceDRADriver() string {
375375}
376376
377377func (r unstructuredScalableResource ) readInfrastructureReferenceResource () (* unstructured.Unstructured , error ) {
378+ obKind := r .unstructured .GetKind ()
379+ obName := r .unstructured .GetName ()
380+
378381 infraref , found , err := unstructured .NestedStringMap (r .unstructured .Object , "spec" , "template" , "spec" , "infrastructureRef" )
379382 if ! found || err != nil {
380383 return nil , nil
@@ -393,20 +396,23 @@ func (r unstructuredScalableResource) readInfrastructureReferenceResource() (*un
393396 // Fall back to ObjectReference in capi v1beta1
394397 apiversion , ok = infraref ["apiVersion" ]
395398 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 )
398402 }
399403 }
400404
401405 kind , ok := infraref ["kind" ]
402406 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 )
405410 }
406411 name , ok := infraref ["name" ]
407412 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 )
410416 }
411417 // kind needs to be lower case and plural
412418 kind = fmt .Sprintf ("%ss" , strings .ToLower (kind ))
0 commit comments