@@ -325,7 +325,8 @@ func getHbmmWithConstantHostname(ctx context.Context, csrUsername string, cluste
325325 log := ctrl .LoggerFrom (ctx )
326326
327327 clusterFromCSR , serverID := getServerIDFromConstantHostname (ctx , csrUsername , clusterName )
328- providerID := "hcloud://bm-" + serverID
328+ legacyProviderID := "hcloud://bm-" + serverID
329+ providerID := "hrobot://" + serverID
329330 hList := & infrav1.HetznerBareMetalMachineList {}
330331 selector := labels .NewSelector ()
331332 req , err := labels .NewRequirement (clusterv1 .ClusterNameLabel , selection .Equals , []string {clusterFromCSR })
@@ -348,13 +349,15 @@ func getHbmmWithConstantHostname(ctx context.Context, csrUsername string, cluste
348349 if hList .Items [i ].Spec .ProviderID == nil {
349350 continue
350351 }
351- if * hList .Items [i ].Spec .ProviderID == providerID {
352+ if * hList .Items [i ].Spec .ProviderID == providerID ||
353+ * hList .Items [i ].Spec .ProviderID == legacyProviderID {
352354 hbmm = & hList .Items [i ]
353355 break
354356 }
355357 }
358+
356359 if hbmm == nil {
357- return nil , fmt .Errorf ("ProviderID: %q % w" , providerID , errNoHetznerBareMetalMachineByProviderIDFound )
360+ return nil , fmt .Errorf ("ProviderID: %q (or %q): % w" , providerID , legacyProviderID , errNoHetznerBareMetalMachineByProviderIDFound )
358361 }
359362
360363 log .Info ("Found HetznerBareMetalMachine with constant hostname" , "csr-username" , csrUsername , "hetznerBareMetalMachine" , hbmm .Name )
0 commit comments