Skip to content

Commit ddcc425

Browse files
committed
feat(manager): ✨ add region to openStackMachineSpec.ProviderID field from annotation
To made CAPO compatible with OCCM multi-cloud deployment we need to manage providerID format with region code as introduced [here](kubernetes/cloud-provider-openstack#1900) (`openstack://region/instance_uuid`). Use annotation from OpenstackMachine to define region in providerID field. An empty or undefined annotation permit to be fully backward compatible. Moreover use annotation permit to manage some cluster with new OCCM provider-id string and other cluster with old format by same CAPO instance. Signed-off-by: MatthieuFin <[email protected]>
1 parent 94ba718 commit ddcc425

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

controllers/openstackmachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ func (r *OpenStackMachineReconciler) reconcileMachineState(scope *scope.WithLogg
422422
conditions.MarkTrue(openStackMachine, infrav1.InstanceReadyCondition)
423423

424424
// Set properties required by CAPI machine controller
425-
openStackMachine.Spec.ProviderID = ptr.To(fmt.Sprintf("openstack:///%s", *openStackServer.Status.InstanceID))
425+
openStackMachine.Spec.ProviderID = ptr.To(fmt.Sprintf("openstack://%s/%s", openStackMachine.ObjectMeta.Annotations["cluster.x-k8s.io/openstack.cloud"], *openStackServer.Status.InstanceID))
426426
openStackMachine.Status.InstanceID = openStackServer.Status.InstanceID
427427
openStackMachine.Status.Ready = true
428428
case infrav1.InstanceStateError:

0 commit comments

Comments
 (0)