@@ -23,6 +23,7 @@ import (
2323
2424 mapiv1alpha1 "github.com/openshift/api/machine/v1alpha1"
2525 mapiv1beta1 "github.com/openshift/api/machine/v1beta1"
26+ "github.com/openshift/cluster-capi-operator/pkg/conversion/consts"
2627 corev1 "k8s.io/api/core/v1"
2728 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829 "k8s.io/apimachinery/pkg/runtime"
@@ -204,22 +205,22 @@ func (m machineAndOpenStackMachineAndOpenStackCluster) ToMachine() (*mapiv1beta1
204205
205206 warnings = append (warnings , warns ... )
206207
207- var additionalMachineAPILabels , additionalMachineAPIAnnotations map [string ]string
208+ var additionalMachineAPIMetadataLabels , additionalMachineAPIMetadataAnnotations map [string ]string
208209 if ! m .excludeMachineAPILabelsAndAnnotations {
209- additionalMachineAPILabels = map [string ]string {
210+ additionalMachineAPIMetadataLabels = map [string ]string {
210211 // Unable to determine the region without fetching the identity resources as done at:
211212 // https://github.com/openshift/machine-api-provider-openstack/blob/2defb131bd0836beba0a9790de7c9a63137a5cec/pkg/machine/actuator.go#L85-L89
212- // "machine.openshift.io/region":
213- "machine.openshift.io/instance-type" : ptr .Deref (m .openstackMachine .Spec .Flavor , "" ),
214- "machine.openshift.io/zone" : ptr .Deref (m .machine .Spec .FailureDomain , "" ),
213+ // consts.MAPIMachineMetadataLabelRegion
214+ consts . MAPIMachineMetadataLabelInstanceType : ptr .Deref (m .openstackMachine .Spec .Flavor , "" ),
215+ consts . MAPIMachineMetadataLabelZone : ptr .Deref (m .machine .Spec .FailureDomain , "" ),
215216 }
216217
217- additionalMachineAPIAnnotations = map [string ]string {
218- "machine.openshift.io/instance-state" : string (ptr .Deref (m .openstackMachine .Status .InstanceState , "" )),
218+ additionalMachineAPIMetadataAnnotations = map [string ]string {
219+ consts . MAPIMachineMetadataAnnotationInstanceState : string (ptr .Deref (m .openstackMachine .Status .InstanceState , "" )),
219220 }
220221 }
221222
222- mapiMachine , errs := fromCAPIMachineToMAPIMachine (m .machine , additionalMachineAPILabels , additionalMachineAPIAnnotations )
223+ mapiMachine , errs := fromCAPIMachineToMAPIMachine (m .machine , additionalMachineAPIMetadataLabels , additionalMachineAPIMetadataAnnotations )
223224 if errs != nil {
224225 errors = append (errors , errs ... )
225226 }
0 commit comments