Skip to content

Commit 58cae3d

Browse files
Merge pull request #2396 from djoshy/add-cpms-boot-image-updates
MCO-1805: MCO-1806: Add ManagedBootImagesCPMS feature gate & CPMS type to ManagedBootImages API
2 parents c9bef43 + 75a1397 commit 58cae3d

24 files changed

+1565
-46
lines changed

features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
| 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> |
5353
| 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> |
5454
| ManagedBootImagesAzure| | | <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> |
55+
| ManagedBootImagesCPMS| | | <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> |
5556
| ManagedBootImagesvSphere| | | <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> |
5657
| 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> |
5758
| MinimumKubeletVersion| | | <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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ var (
354354
enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade).
355355
mustRegister()
356356

357+
FeatureGateManagedBootImagesCPMS = newFeatureGate("ManagedBootImagesCPMS").
358+
reportProblemsToJiraComponent("MachineConfigOperator").
359+
contactPerson("djoshy").
360+
productScope(ocpSpecific).
361+
enhancementPR("https://github.com/openshift/enhancements/pull/1818").
362+
enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade).
363+
mustRegister()
364+
357365
FeatureGateBootImageSkewEnforcement = newFeatureGate("BootImageSkewEnforcement").
358366
reportProblemsToJiraComponent("MachineConfigOperator").
359367
contactPerson("djoshy").

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31216,7 +31216,7 @@
3121631216
"default": ""
3121731217
},
3121831218
"resource": {
31219-
"description": "resource is the machine management resource's type. The only current valid value is machinesets. machinesets means that the machine manager will only register resources of the kind MachineSet.",
31219+
"description": "resource is the machine management resource's type. Valid values are machinesets and controlplanemachinesets. machinesets means that the machine manager will only register resources of the kind MachineSet. controlplanemachinesets means that the machine manager will only register resources of the kind ControlPlaneMachineSet.",
3122031220
"type": "string",
3122131221
"default": ""
3122231222
},
@@ -31234,7 +31234,7 @@
3123431234
],
3123531235
"properties": {
3123631236
"mode": {
31237-
"description": "mode determines how machine managers will be selected for updates. Valid values are All and Partial. All means that every resource matched by the machine manager will be updated. Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated. None means that every resource matched by the machine manager will not be updated.",
31237+
"description": "mode determines how machine managers will be selected for updates. Valid values are All, Partial and None. All means that every resource matched by the machine manager will be updated. Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated. Partial is not permitted for the controlplanemachinesets resource type as they are a singleton within the cluster. None means that every resource matched by the machine manager will not be updated.",
3123831238
"type": "string",
3123931239
"default": ""
3124031240
},
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "MachineConfiguration"
3+
crdName: machineconfigurations.operator.openshift.io
4+
featureGates:
5+
- ManagedBootImages
6+
- ManagedBootImagesCPMS
7+
tests:
8+
onCreate:
9+
- name: Should be able to create a minimal MachineConfiguration
10+
initial: |
11+
apiVersion: operator.openshift.io/v1
12+
kind: MachineConfiguration
13+
spec: {} # No spec is required for a MachineConfiguration
14+
expected: |
15+
apiVersion: operator.openshift.io/v1
16+
kind: MachineConfiguration
17+
spec:
18+
logLevel: Normal
19+
operatorLogLevel: Normal
20+
- name: Should be able to create an empty ManagedBootImages configuration knob
21+
initial: |
22+
apiVersion: operator.openshift.io/v1
23+
kind: MachineConfiguration
24+
spec:
25+
managedBootImages:
26+
machineManagers: []
27+
expected: |
28+
apiVersion: operator.openshift.io/v1
29+
kind: MachineConfiguration
30+
spec:
31+
logLevel: Normal
32+
operatorLogLevel: Normal
33+
managedBootImages:
34+
machineManagers: []
35+
- name: Should be able to create a ManagedBootImages configuration knob that opts in all ControlPlaneMachineSets
36+
initial: |
37+
apiVersion: operator.openshift.io/v1
38+
kind: MachineConfiguration
39+
spec:
40+
managedBootImages:
41+
machineManagers:
42+
- resource: controlplanemachinesets
43+
apiGroup: machine.openshift.io
44+
selection:
45+
mode: All
46+
expected: |
47+
apiVersion: operator.openshift.io/v1
48+
kind: MachineConfiguration
49+
spec:
50+
logLevel: Normal
51+
operatorLogLevel: Normal
52+
managedBootImages:
53+
machineManagers:
54+
- resource: controlplanemachinesets
55+
apiGroup: machine.openshift.io
56+
selection:
57+
mode: All
58+
- name: Should be able to create a ManagedBootImages configuration knob that opts in no ControlPlaneMachineSets
59+
initial: |
60+
apiVersion: operator.openshift.io/v1
61+
kind: MachineConfiguration
62+
spec:
63+
managedBootImages:
64+
machineManagers:
65+
- resource: controlplanemachinesets
66+
apiGroup: machine.openshift.io
67+
selection:
68+
mode: None
69+
expected: |
70+
apiVersion: operator.openshift.io/v1
71+
kind: MachineConfiguration
72+
spec:
73+
logLevel: Normal
74+
operatorLogLevel: Normal
75+
managedBootImages:
76+
machineManagers:
77+
- resource: controlplanemachinesets
78+
apiGroup: machine.openshift.io
79+
selection:
80+
mode: None
81+
- name: Should not be able to create a ManagedBootImages configuration knob that opts in ControlPlaneMachineSets in partial mode
82+
initial: |
83+
apiVersion: operator.openshift.io/v1
84+
kind: MachineConfiguration
85+
spec:
86+
managedBootImages:
87+
machineManagers:
88+
- resource: controlplanemachinesets
89+
apiGroup: machine.openshift.io
90+
selection:
91+
mode: Partial
92+
partial:
93+
machineResourceSelector:
94+
matchLabels: {}
95+
expectedError: "Only All or None selection mode is permitted for ControlPlaneMachineSets"
96+
- name: Only one unique pair of resource/apigroup is allowed in machineManagers
97+
initial: |
98+
apiVersion: operator.openshift.io/v1
99+
kind: MachineConfiguration
100+
spec:
101+
managedBootImages:
102+
machineManagers:
103+
- resource: controlplanemachinesets
104+
apiGroup: machine.openshift.io
105+
selection:
106+
mode: None
107+
- resource: controlplanemachinesets
108+
apiGroup: machine.openshift.io
109+
selection:
110+
mode: All
111+
expectedError: "spec.managedBootImages.machineManagers[1]: Duplicate value: map[string]interface {}{\"apiGroup\":\"machine.openshift.io\", \"resource\":\"controlplanemachinesets\"}"

operator/v1/types_machineconfiguration.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,12 @@ type ManagedBootImages struct {
366366

367367
// MachineManager describes a target machine resource that is registered for boot image updates. It stores identifying information
368368
// such as the resource type and the API Group of the resource. It also provides granular control via the selection field.
369+
// +openshift:validation:FeatureGateAwareXValidation:requiredFeatureGate=ManagedBootImages;ManagedBootImagesCPMS,rule="self.resource != 'controlplanemachinesets' || self.selection.mode == 'All' || self.selection.mode == 'None'", message="Only All or None selection mode is permitted for ControlPlaneMachineSets"
369370
type MachineManager struct {
370371
// resource is the machine management resource's type.
371-
// The only current valid value is machinesets.
372+
// Valid values are machinesets and controlplanemachinesets.
372373
// machinesets means that the machine manager will only register resources of the kind MachineSet.
374+
// controlplanemachinesets means that the machine manager will only register resources of the kind ControlPlaneMachineSet.
373375
// +required
374376
Resource MachineManagerMachineSetsResourceType `json:"resource"`
375377

@@ -388,9 +390,10 @@ type MachineManager struct {
388390
// +union
389391
type MachineManagerSelector struct {
390392
// mode determines how machine managers will be selected for updates.
391-
// Valid values are All and Partial.
393+
// Valid values are All, Partial and None.
392394
// All means that every resource matched by the machine manager will be updated.
393395
// Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
396+
// Partial is not permitted for the controlplanemachinesets resource type as they are a singleton within the cluster.
394397
// None means that every resource matched by the machine manager will not be updated.
395398
// +unionDiscriminator
396399
// +required
@@ -427,12 +430,15 @@ const (
427430

428431
// MachineManagerManagedResourceType is a string enum used in the MachineManager type to describe the resource
429432
// type to be registered.
430-
// +kubebuilder:validation:Enum:="machinesets"
433+
// +openshift:validation:FeatureGateAwareEnum:requiredFeatureGate=ManagedBootImages,enum=machinesets
434+
// +openshift:validation:FeatureGateAwareEnum:requiredFeatureGate=ManagedBootImages;ManagedBootImagesCPMS,enum=machinesets;controlplanemachinesets
431435
type MachineManagerMachineSetsResourceType string
432436

433437
const (
434438
// MachineSets represent the MachineSet resource type, which manage a group of machines and belong to the Openshift machine API group.
435439
MachineSets MachineManagerMachineSetsResourceType = "machinesets"
440+
// ControlPlaneMachineSets represent the ControlPlaneMachineSets resource type, which manage a group of control-plane machines and belong to the Openshift machine API group.
441+
ControlPlaneMachineSets MachineManagerMachineSetsResourceType = "controlplanemachinesets"
436442
)
437443

438444
// MachineManagerManagedAPIGroupType is a string enum used in in the MachineManager type to describe the APIGroup
@@ -442,7 +448,7 @@ type MachineManagerMachineSetsAPIGroupType string
442448

443449
const (
444450
// MachineAPI represent the traditional MAPI Group that a machineset may belong to.
445-
// This feature only supports MAPI machinesets at this time.
451+
// This feature only supports MAPI machinesets and controlplanemachinesets at this time.
446452
MachineAPI MachineManagerMachineSetsAPIGroupType = "machine.openshift.io"
447453
)
448454

operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations-CustomNoUpgrade.crd.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@ spec:
228228
resource:
229229
description: |-
230230
resource is the machine management resource's type.
231-
The only current valid value is machinesets.
231+
Valid values are machinesets and controlplanemachinesets.
232232
machinesets means that the machine manager will only register resources of the kind MachineSet.
233+
controlplanemachinesets means that the machine manager will only register resources of the kind ControlPlaneMachineSet.
233234
enum:
234235
- machinesets
236+
- controlplanemachinesets
235237
type: string
236238
selection:
237239
description: selection allows granular control of the machine
@@ -241,9 +243,10 @@ spec:
241243
mode:
242244
description: |-
243245
mode determines how machine managers will be selected for updates.
244-
Valid values are All and Partial.
246+
Valid values are All, Partial and None.
245247
All means that every resource matched by the machine manager will be updated.
246248
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
249+
Partial is not permitted for the controlplanemachinesets resource type as they are a singleton within the cluster.
247250
None means that every resource matched by the machine manager will not be updated.
248251
enum:
249252
- All
@@ -320,6 +323,11 @@ spec:
320323
- resource
321324
- selection
322325
type: object
326+
x-kubernetes-validations:
327+
- message: Only All or None selection mode is permitted for
328+
ControlPlaneMachineSets
329+
rule: self.resource != 'controlplanemachinesets' || self.selection.mode
330+
== 'All' || self.selection.mode == 'None'
323331
maxItems: 5
324332
type: array
325333
x-kubernetes-list-map-keys:
@@ -993,10 +1001,12 @@ spec:
9931001
resource:
9941002
description: |-
9951003
resource is the machine management resource's type.
996-
The only current valid value is machinesets.
1004+
Valid values are machinesets and controlplanemachinesets.
9971005
machinesets means that the machine manager will only register resources of the kind MachineSet.
1006+
controlplanemachinesets means that the machine manager will only register resources of the kind ControlPlaneMachineSet.
9981007
enum:
9991008
- machinesets
1009+
- controlplanemachinesets
10001010
type: string
10011011
selection:
10021012
description: selection allows granular control of the machine
@@ -1006,9 +1016,10 @@ spec:
10061016
mode:
10071017
description: |-
10081018
mode determines how machine managers will be selected for updates.
1009-
Valid values are All and Partial.
1019+
Valid values are All, Partial and None.
10101020
All means that every resource matched by the machine manager will be updated.
10111021
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
1022+
Partial is not permitted for the controlplanemachinesets resource type as they are a singleton within the cluster.
10121023
None means that every resource matched by the machine manager will not be updated.
10131024
enum:
10141025
- All
@@ -1085,6 +1096,11 @@ spec:
10851096
- resource
10861097
- selection
10871098
type: object
1099+
x-kubernetes-validations:
1100+
- message: Only All or None selection mode is permitted for
1101+
ControlPlaneMachineSets
1102+
rule: self.resource != 'controlplanemachinesets' || self.selection.mode
1103+
== 'All' || self.selection.mode == 'None'
10881104
maxItems: 5
10891105
type: array
10901106
x-kubernetes-list-map-keys:

0 commit comments

Comments
 (0)