@@ -34,7 +34,7 @@ const (
3434)
3535
3636// fromCAPIMachineToMAPIMachine translates a core CAPI Machine to its MAPI Machine correspondent.
37- func fromCAPIMachineToMAPIMachine (capiMachine * clusterv1.Machine ) (* mapiv1beta1.Machine , field.ErrorList ) {
37+ func fromCAPIMachineToMAPIMachine (capiMachine * clusterv1.Machine , additionalMachineAPILabels map [ string ] string ) (* mapiv1beta1.Machine , field.ErrorList ) {
3838 errs := field.ErrorList {}
3939
4040 lifecycleHooks , capiMachineNonHookAnnotations := convertCAPILifecycleHookAnnotationsToMAPILifecycleHooksAndAnnotations (capiMachine .Annotations )
@@ -44,11 +44,13 @@ func fromCAPIMachineToMAPIMachine(capiMachine *clusterv1.Machine) (*mapiv1beta1.
4444 errs = append (errs , machineStatusErrs ... )
4545 }
4646
47+ additionalMachineAPILabels ["machine.openshift.io/zone" ] = ptr .Deref (capiMachine .Spec .FailureDomain , "" )
48+
4749 mapiMachine := & mapiv1beta1.Machine {
4850 ObjectMeta : metav1.ObjectMeta {
4951 Name : capiMachine .Name ,
5052 Namespace : mapiNamespace ,
51- Labels : convertCAPILabelsToMAPILabels (capiMachine .Labels ),
53+ Labels : convertCAPILabelsToMAPILabels (capiMachine .Labels , additionalMachineAPILabels ),
5254 Annotations : convertCAPIAnnotationsToMAPIAnnotations (capiMachineNonHookAnnotations ),
5355 Finalizers : []string {mapiv1beta1 .MachineFinalizer },
5456 OwnerReferences : nil , // OwnerReferences not populated here. They are added later by the machineSync controller.
0 commit comments