Skip to content

Commit 578be79

Browse files
Merge pull request #46 from RadekManak/fix-cratefailed-metric
OCPBUGS-5235: Fix mapi_instance_create_failed metric with accelerated networking
2 parents 6c619f4 + 9512266 commit 578be79

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/cloud/azure/actuators/machine/reconciler.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,12 @@ func (s *Reconciler) createNetworkInterface(ctx context.Context, nicName string)
562562

563563
skuI, err := s.resourcesSkus.Get(ctx, skuSpec)
564564
if err != nil {
565+
metrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{
566+
Name: s.scope.Machine.Name,
567+
Namespace: s.scope.Machine.Namespace,
568+
Reason: err.Error(),
569+
})
570+
565571
if errors.Is(err, resourceskus.ErrResourceNotFound) {
566572
return machinecontroller.InvalidMachineConfiguration("failed to obtain instance type information for VMSize '%s' from Azure: %s", skuSpec.Name, err)
567573
} else {
@@ -572,6 +578,11 @@ func (s *Reconciler) createNetworkInterface(ctx context.Context, nicName string)
572578
sku := skuI.(resourceskus.SKU)
573579

574580
if !sku.HasCapability(resourceskus.AcceleratedNetworking) {
581+
metrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{
582+
Name: s.scope.Machine.Name,
583+
Namespace: s.scope.Machine.Namespace,
584+
Reason: fmt.Sprintf("accelerated networking not supported on instance type: %v", s.scope.MachineConfig.VMSize),
585+
})
575586
return machinecontroller.InvalidMachineConfiguration("accelerated networking not supported on instance type: %v", s.scope.MachineConfig.VMSize)
576587
}
577588
networkInterfaceSpec.AcceleratedNetworking = s.scope.MachineConfig.AcceleratedNetworking

0 commit comments

Comments
 (0)