Skip to content

Commit 3907697

Browse files
committed
feat(azure): skip metrics collection for ARO HCP clusters
Add detection logic to identify ARO HCP (Hypershift) clusters and skip Azure metrics collection for them as they are not supported.
1 parent 6c93dfa commit 3907697

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pkg/monitortests/cloud/azure/metrics/monitortest.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,30 @@ func (w *azureMetricsCollector) StartCollection(ctx context.Context, adminRESTCo
184184
}
185185
return w.notSupportedReason
186186
}
187+
188+
var isAROHCPcluster bool
189+
isHypershift, _ := exutil.IsHypershift(ctx, oc.AdminConfigClient())
190+
if isHypershift {
191+
_, hcpNamespace, err := exutil.GetHypershiftManagementClusterConfigAndNamespace()
192+
if err != nil {
193+
logrus.WithError(err).Error("failed to get hypershift management cluster config and namespace")
194+
return err
195+
}
196+
197+
// For Hypershift, only skip if it's specifically ARO HCP
198+
// Use management cluster client to check the control-plane-operator deployment
199+
managementOC := exutil.NewHypershiftManagementCLI(hcpNamespace)
200+
if isAROHCPcluster, err = exutil.IsAroHCP(ctx, hcpNamespace, managementOC.AdminKubeClient()); err != nil {
201+
logrus.WithError(err).Warning("Failed to check if ARO HCP, assuming it's not")
202+
} else if isAROHCPcluster {
203+
reason := fmt.Sprintf("\"platform Hypershift - ARO HCP not supported")
204+
w.notSupportedReason = &monitortestframework.NotSupportedError{
205+
Reason: reason,
206+
}
207+
return nil
208+
}
209+
}
210+
187211
// get resource group
188212
w.resourceGroup = infra.Status.PlatformStatus.Azure.ResourceGroupName
189213

0 commit comments

Comments
 (0)