Skip to content

Commit eb41266

Browse files
Merge pull request #2279 from nrb/OCPCLOUD-2914
OCPCLOUD-2914: Add MAPI to CAPI migration to TechPreview
2 parents 6bababe + 153be5c commit eb41266

15 files changed

+293
-14
lines changed

features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
| ------ | --- | --- | --- | --- | --- | --- |
33
| ClusterAPIInstall| | | | | | |
44
| EventedPLEG| | | | | | |
5-
| MachineAPIMigration| | | | | | |
65
| MachineAPIOperatorDisableMachineHealthCheckController| | | | | | |
76
| MultiArchInstallAzure| | | | | | |
87
| ClusterVersionOperatorConfiguration| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | | |
@@ -38,6 +37,7 @@
3837
| InsightsOnDemandDataGather| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
3938
| InsightsRuntimeExtractor| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
4039
| KMSEncryptionProvider| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
40+
| MachineAPIMigration| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
4141
| MachineAPIProviderOpenStack| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
4242
| MachineConfigNodes| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |
4343
| MaxUnavailableStatefulSet| | | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> | <span style="background-color: #519450">Enabled</span> |

features/features.go

+1
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ var (
608608
contactPerson("jspeed").
609609
productScope(ocpSpecific).
610610
enhancementPR(legacyFeatureGateWithoutEnhancement).
611+
enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade).
611612
mustRegister()
612613

613614
FeatureGatePersistentIPsForVirtualization = newFeatureGate("PersistentIPsForVirtualization").

machine/v1/tests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: "ControlPlaneMachineSet (+CPMSMachineNamePrefix)"
33
crdName: controlplanemachinesets.machine.openshift.io
44
featureGates:
55
- CPMSMachineNamePrefix
6-
- -MachineAPIMigration
76
tests:
87
onCreate:
98
- name: Should be able to create a minimal ControlPlaneMachineSet
@@ -24,6 +23,7 @@ tests:
2423
machine.openshift.io/cluster-api-machine-type: master
2524
machine.openshift.io/cluster-api-cluster: cluster
2625
spec:
26+
authoritativeAPI: MachineAPI
2727
providerSpec: {}
2828
expected: |
2929
apiVersion: machine.openshift.io/v1
@@ -46,6 +46,7 @@ tests:
4646
machine.openshift.io/cluster-api-machine-type: master
4747
machine.openshift.io/cluster-api-cluster: cluster
4848
spec:
49+
authoritativeAPI: MachineAPI
4950
providerSpec: {}
5051
- name: Should be able to create ControlPlaneMachineSet with machineNamePrefix
5152
initial: |
@@ -66,6 +67,7 @@ tests:
6667
machine.openshift.io/cluster-api-machine-type: master
6768
machine.openshift.io/cluster-api-cluster: cluster
6869
spec:
70+
authoritativeAPI: MachineAPI
6971
providerSpec: {}
7072
expected: |
7173
apiVersion: machine.openshift.io/v1
@@ -89,6 +91,7 @@ tests:
8991
machine.openshift.io/cluster-api-machine-type: master
9092
machine.openshift.io/cluster-api-cluster: cluster
9193
spec:
94+
authoritativeAPI: MachineAPI
9295
providerSpec: {}
9396
- name: Should reject to create ControlPlaneMachineSet with empty machineNamePrefix
9497
initial: |
@@ -109,6 +112,7 @@ tests:
109112
machine.openshift.io/cluster-api-machine-type: master
110113
machine.openshift.io/cluster-api-cluster: cluster
111114
spec:
115+
authoritativeAPI: MachineAPI
112116
providerSpec: {}
113117
expectedError: 'Invalid value: "": spec.machineNamePrefix in body should be at least 1 chars long'
114118
- name: Should reject to create ControlPlaneMachineSet with invalid machineNamePrefix
@@ -130,6 +134,7 @@ tests:
130134
machine.openshift.io/cluster-api-machine-type: master
131135
machine.openshift.io/cluster-api-cluster: cluster
132136
spec:
137+
authoritativeAPI: MachineAPI
133138
providerSpec: {}
134139
expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lowercase alphanumeric characters, hyphens (''-''), and periods (''.''). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted.'
135140
- name: Should reject to create ControlPlaneMachineSet with invalid machineNamePrefix - Consecutive periods are not permitted
@@ -151,5 +156,6 @@ tests:
151156
machine.openshift.io/cluster-api-machine-type: master
152157
machine.openshift.io/cluster-api-cluster: cluster
153158
spec:
159+
authoritativeAPI: MachineAPI
154160
providerSpec: {}
155161
expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lowercase alphanumeric characters, hyphens (''-''), and periods (''.''). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted.'

machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,20 @@ spec:
553553
failure domain field. This will be overriden when the Machines
554554
are created based on the FailureDomains field.
555555
properties:
556+
authoritativeAPI:
557+
default: MachineAPI
558+
description: |-
559+
authoritativeAPI is the API that is authoritative for this resource.
560+
Valid values are MachineAPI and ClusterAPI.
561+
When set to MachineAPI, writes to the spec of the machine.openshift.io copy of this resource will be reflected into the cluster.x-k8s.io copy.
562+
When set to ClusterAPI, writes to the spec of the cluster.x-k8s.io copy of this resource will be reflected into the machine.openshift.io copy.
563+
Updates to the status will be reflected in both copies of the resource, based on the controller implementing the functionality of the API.
564+
Currently the authoritative API determines which controller will manage the resource, this will change in a future release.
565+
To ensure the change has been accepted, please verify that the `status.authoritativeAPI` field has been updated to the desired value and that the `Synchronized` condition is present and set to `True`.
566+
enum:
567+
- MachineAPI
568+
- ClusterAPI
569+
type: string
556570
lifecycleHooks:
557571
description: |-
558572
lifecycleHooks allow users to pause operations on the machine at

machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,20 @@ spec:
553553
failure domain field. This will be overriden when the Machines
554554
are created based on the FailureDomains field.
555555
properties:
556+
authoritativeAPI:
557+
default: MachineAPI
558+
description: |-
559+
authoritativeAPI is the API that is authoritative for this resource.
560+
Valid values are MachineAPI and ClusterAPI.
561+
When set to MachineAPI, writes to the spec of the machine.openshift.io copy of this resource will be reflected into the cluster.x-k8s.io copy.
562+
When set to ClusterAPI, writes to the spec of the cluster.x-k8s.io copy of this resource will be reflected into the machine.openshift.io copy.
563+
Updates to the status will be reflected in both copies of the resource, based on the controller implementing the functionality of the API.
564+
Currently the authoritative API determines which controller will manage the resource, this will change in a future release.
565+
To ensure the change has been accepted, please verify that the `status.authoritativeAPI` field has been updated to the desired value and that the `Synchronized` condition is present and set to `True`.
566+
enum:
567+
- MachineAPI
568+
- ClusterAPI
569+
type: string
556570
lifecycleHooks:
557571
description: |-
558572
lifecycleHooks allow users to pause operations on the machine at

machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machines-DevPreviewNoUpgrade.crd.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ spec:
8181
spec:
8282
description: MachineSpec defines the desired state of Machine
8383
properties:
84+
authoritativeAPI:
85+
default: MachineAPI
86+
description: |-
87+
authoritativeAPI is the API that is authoritative for this resource.
88+
Valid values are MachineAPI and ClusterAPI.
89+
When set to MachineAPI, writes to the spec of the machine.openshift.io copy of this resource will be reflected into the cluster.x-k8s.io copy.
90+
When set to ClusterAPI, writes to the spec of the cluster.x-k8s.io copy of this resource will be reflected into the machine.openshift.io copy.
91+
Updates to the status will be reflected in both copies of the resource, based on the controller implementing the functionality of the API.
92+
Currently the authoritative API determines which controller will manage the resource, this will change in a future release.
93+
To ensure the change has been accepted, please verify that the `status.authoritativeAPI` field has been updated to the desired value and that the `Synchronized` condition is present and set to `True`.
94+
enum:
95+
- MachineAPI
96+
- ClusterAPI
97+
type: string
8498
lifecycleHooks:
8599
description: |-
86100
lifecycleHooks allow users to pause operations on the machine at
@@ -364,6 +378,23 @@ spec:
364378
type: object
365379
type: array
366380
x-kubernetes-list-type: atomic
381+
authoritativeAPI:
382+
description: |-
383+
authoritativeAPI is the API that is authoritative for this resource.
384+
Valid values are MachineAPI, ClusterAPI and Migrating.
385+
This value is updated by the migration controller to reflect the authoritative API.
386+
Machine API and Cluster API controllers use this value to determine whether or not to reconcile the resource.
387+
When set to Migrating, the migration controller is currently performing the handover of authority from one API to the other.
388+
enum:
389+
- MachineAPI
390+
- ClusterAPI
391+
- Migrating
392+
type: string
393+
x-kubernetes-validations:
394+
- message: The authoritativeAPI field must not transition directly
395+
from MachineAPI to ClusterAPI or vice versa. It must transition
396+
through Migrating.
397+
rule: self == 'Migrating' || self == oldSelf || oldSelf == 'Migrating'
367398
conditions:
368399
description: conditions defines the current state of the Machine
369400
items:
@@ -537,7 +568,23 @@ spec:
537568
serialized/deserialized from this field.
538569
type: object
539570
x-kubernetes-preserve-unknown-fields: true
571+
synchronizedGeneration:
572+
description: |-
573+
synchronizedGeneration is the generation of the authoritative resource that the non-authoritative resource is synchronised with.
574+
This field is set when the authoritative resource is updated and the sync controller has updated the non-authoritative resource to match.
575+
format: int64
576+
minimum: 0
577+
type: integer
540578
type: object
579+
x-kubernetes-validations:
580+
- fieldPath: .synchronizedGeneration
581+
message: synchronizedGeneration must not decrease unless authoritativeAPI
582+
is transitioning from Migrating to another value
583+
reason: FieldValueInvalid
584+
rule: '!has(oldSelf.synchronizedGeneration) || (has(self.synchronizedGeneration)
585+
&& self.synchronizedGeneration >= oldSelf.synchronizedGeneration)
586+
|| (oldSelf.authoritativeAPI == ''Migrating'' && self.authoritativeAPI
587+
!= ''Migrating'')'
541588
type: object
542589
served: true
543590
storage: true

machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machines-TechPreviewNoUpgrade.crd.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ spec:
8181
spec:
8282
description: MachineSpec defines the desired state of Machine
8383
properties:
84+
authoritativeAPI:
85+
default: MachineAPI
86+
description: |-
87+
authoritativeAPI is the API that is authoritative for this resource.
88+
Valid values are MachineAPI and ClusterAPI.
89+
When set to MachineAPI, writes to the spec of the machine.openshift.io copy of this resource will be reflected into the cluster.x-k8s.io copy.
90+
When set to ClusterAPI, writes to the spec of the cluster.x-k8s.io copy of this resource will be reflected into the machine.openshift.io copy.
91+
Updates to the status will be reflected in both copies of the resource, based on the controller implementing the functionality of the API.
92+
Currently the authoritative API determines which controller will manage the resource, this will change in a future release.
93+
To ensure the change has been accepted, please verify that the `status.authoritativeAPI` field has been updated to the desired value and that the `Synchronized` condition is present and set to `True`.
94+
enum:
95+
- MachineAPI
96+
- ClusterAPI
97+
type: string
8498
lifecycleHooks:
8599
description: |-
86100
lifecycleHooks allow users to pause operations on the machine at
@@ -364,6 +378,23 @@ spec:
364378
type: object
365379
type: array
366380
x-kubernetes-list-type: atomic
381+
authoritativeAPI:
382+
description: |-
383+
authoritativeAPI is the API that is authoritative for this resource.
384+
Valid values are MachineAPI, ClusterAPI and Migrating.
385+
This value is updated by the migration controller to reflect the authoritative API.
386+
Machine API and Cluster API controllers use this value to determine whether or not to reconcile the resource.
387+
When set to Migrating, the migration controller is currently performing the handover of authority from one API to the other.
388+
enum:
389+
- MachineAPI
390+
- ClusterAPI
391+
- Migrating
392+
type: string
393+
x-kubernetes-validations:
394+
- message: The authoritativeAPI field must not transition directly
395+
from MachineAPI to ClusterAPI or vice versa. It must transition
396+
through Migrating.
397+
rule: self == 'Migrating' || self == oldSelf || oldSelf == 'Migrating'
367398
conditions:
368399
description: conditions defines the current state of the Machine
369400
items:
@@ -537,7 +568,23 @@ spec:
537568
serialized/deserialized from this field.
538569
type: object
539570
x-kubernetes-preserve-unknown-fields: true
571+
synchronizedGeneration:
572+
description: |-
573+
synchronizedGeneration is the generation of the authoritative resource that the non-authoritative resource is synchronised with.
574+
This field is set when the authoritative resource is updated and the sync controller has updated the non-authoritative resource to match.
575+
format: int64
576+
minimum: 0
577+
type: integer
540578
type: object
579+
x-kubernetes-validations:
580+
- fieldPath: .synchronizedGeneration
581+
message: synchronizedGeneration must not decrease unless authoritativeAPI
582+
is transitioning from Migrating to another value
583+
reason: FieldValueInvalid
584+
rule: '!has(oldSelf.synchronizedGeneration) || (has(self.synchronizedGeneration)
585+
&& self.synchronizedGeneration >= oldSelf.synchronizedGeneration)
586+
|| (oldSelf.authoritativeAPI == ''Migrating'' && self.authoritativeAPI
587+
!= ''Migrating'')'
541588
type: object
542589
served: true
543590
storage: true

0 commit comments

Comments
 (0)