From ea748700e28205800b78da03ef50d413459b9a10 Mon Sep 17 00:00:00 2001 From: Abhay Date: Mon, 5 Jan 2026 16:56:11 +0530 Subject: [PATCH] OCPBUGS-63028: filtering only PEs from cluster list --- pkg/asset/installconfig/nutanix/nutanix.go | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pkg/asset/installconfig/nutanix/nutanix.go b/pkg/asset/installconfig/nutanix/nutanix.go index b001b71cc32..cbfa2ad67e2 100644 --- a/pkg/asset/installconfig/nutanix/nutanix.go +++ b/pkg/asset/installconfig/nutanix/nutanix.go @@ -172,6 +172,32 @@ func getPrismElement(ctx context.Context, client *nutanixclientv3.Client) (*nuta return nil, errors.New("did not find any prism element clusters") } + // Filter out Prism Central clusters - we only want Prism Elements + filteredPes := make([]*nutanixclientv3.ClusterIntentResponse, 0, len(pes)) + for _, p := range pes { + // Skip Prism Central clusters by checking the service list + if p.Status != nil && p.Status.Resources != nil && p.Status.Resources.Config != nil && + p.Status.Resources.Config.ServiceList != nil { + isPrismCentral := false + for _, service := range p.Status.Resources.Config.ServiceList { + if service != nil && *service == "PRISM_CENTRAL" { + isPrismCentral = true + break + } + } + if isPrismCentral { + continue + } + } + filteredPes = append(filteredPes, p) + } + + pes = filteredPes + + if len(pes) == 0 { + return nil, errors.New("did not find any prism element clusters") + } + if len(pes) == 1 { pe.UUID = *pes[0].Metadata.UUID pe.Endpoint.Address = *pes[0].Spec.Resources.Network.ExternalIP