Skip to content

Commit a2bb6bb

Browse files
djoshyumohnani8
authored andcommitted
change OCL CRD deployment to v1
Squashed commit messages: - MachineOSConfig: set ImageSecretObjectReference to optional - Add v1 versions of OnClusterBuild APIs - First step to GA'ing the currently v1alpha1 APIs. Don't add to payload manifests yet, and the featuregate is retained. - Temporarily exclude v1 MOSC/MOSB from payload - Update godoc and validation for MOSC/MOSB Mostly fixups, with some minor changes to the v1alpha1 API: - Removed Version and ConfigGeneration from MOSB as they were unused - Updated relatedobjects list - Changed all optional,omitempty structs to pointers - Removed default for ImageBuilderType, but keeping default build arch to noarch as we don’t foresee changing that. - Fixed RenderedImagePushspec validators to match description Additional fixes for MOSC/MOSB - Update from PodImageBuilder to JobImageBuilder, and add a MachineOSBuild reference to MachineOSConfig - Failed and Interrupted will now cause MOSBuild conditions to be immutable - Updated Arch enum to be PascalCase - Updated relatedObject go doc based on suggestion - Add validation for buildEnd > buildStart - Removed conditions field from MOSConfig. The build object is supposed to reflect conditions instead, so this is not needed at this time - Use dns1123 format check for all strings that match, and otherwise switch pattern checks to validation rules where appropriate - Updated godocs a bit more for formatting Additional MOSC/MOSB updates Mostly fixes around validation and godocs. Added some additional test cases. Further MOSC/MOSB updates - Removed BuildOutputs and the CurrentImagePullSecret field (not really needed at this time, we’d prefer if the user would put any additional pull secrets into the cluster-wide object) - Removed BuildInputs and lifted all fields to spec, removing: - ReleaseVersion - BaseOSImagePullSpec - BaseOSExtensionsImagePullSpec Which will be populated directly from the MCO instead. We will consider re-adding those if there is a need for on cluster pre-builds off new release images in the future. - Renamed finalImagePushSpec to digestedImagePushSpec - Switched MachineOSBuilderReference back to an union, and renamed the job object unionmember to just “job” - Changed “desiredConfig” to “MachineConfig” for clarity - Kept ObservedGeneration, but updated the validation, and will fix on the MCO side - Removed duplicate arch types, and updated containerfiles to allow at most 1 per arch (minus noarch) Read removed NodeDisruptionPolicy tests These were added for the alpha API originally, but they seem to have been removed during a refactor of the tests. The current tests are a duplicate of bootimage tests. MachineOSBuild: relax CEL for conditions The builder defaults these conditions to false to start, and the current CEL prevents that changing. Use CEL validations Since the new format library is not avaiable in 4.18, use similar validations to what we were doing for v1alpha1. Signed-off-by: Urvashi <[email protected]>
1 parent d21e7b9 commit a2bb6bb

File tree

25 files changed

+5465
-888
lines changed

25 files changed

+5465
-888
lines changed

hack/update-payload-crds.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
44

5+
#TODO(jerzhang): once MOSC/MOSB graduates, update the v1 crds to include them
56
crd_globs="\
67
authorization/v1/zz_generated.crd-manifests/*_config-operator_*.crd*yaml\
78
config/v1/zz_generated.crd-manifests/*_config-operator_*.crd*yaml\
@@ -22,7 +23,8 @@ crd_globs="\
2223
config/v1/zz_generated.crd-manifests/0000_10_openshift-controller-manager_01_builds*.crd.yaml
2324
operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers*.crd.yaml
2425
machineconfiguration/v1/zz_generated.crd-manifests/*.crd.yaml
25-
machineconfiguration/v1alpha1/zz_generated.crd-manifests/*.crd.yaml
26+
machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes*.crd.yaml
27+
machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_pinnedimagesets*.crd.yaml
2628
operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations*.crd.yaml
2729
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clusterimagepolicies*.crd.yaml
2830
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_imagepolicies*.crd.yaml

machineconfiguration/v1/register.go

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
3434
&MachineConfigList{},
3535
&MachineConfigPool{},
3636
&MachineConfigPoolList{},
37+
&MachineOSConfig{},
38+
&MachineOSConfigList{},
39+
&MachineOSBuild{},
40+
&MachineOSBuildList{},
3741
)
3842

3943
metav1.AddToGroupVersion(scheme, GroupVersion)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "MachineOSBuild"
3+
crdName: machineosbuilds.machineconfiguration.openshift.io
4+
featureGate: OnClusterBuild
5+
tests:
6+
onCreate:
7+
- name: Should be able to create a minimal MachineOSBuild
8+
initial: |
9+
apiVersion: machineconfiguration.openshift.io/v1
10+
kind: MachineOSBuild
11+
metadata:
12+
name: foobar
13+
spec:
14+
machineConfig:
15+
name: rendered-worker-abcd
16+
machineOSConfig:
17+
name: worker
18+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
19+
expected: |
20+
apiVersion: machineconfiguration.openshift.io/v1
21+
kind: MachineOSBuild
22+
metadata:
23+
name: foobar
24+
spec:
25+
machineConfig:
26+
name: rendered-worker-abcd
27+
machineOSConfig:
28+
name: worker
29+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
30+
onUpdate:
31+
- name: Job imagebuilder type must have job reference
32+
initial: |
33+
apiVersion: machineconfiguration.openshift.io/v1
34+
kind: MachineOSBuild
35+
metadata:
36+
name: foobar
37+
spec:
38+
machineConfig:
39+
name: rendered-worker-abcd
40+
machineOSConfig:
41+
name: worker
42+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
43+
status:
44+
builder:
45+
imageBuilderType: Job
46+
job:
47+
group: batch
48+
resource: jobs
49+
namespace: openshift-machine-config-operator
50+
name: buildjob
51+
updated: |
52+
apiVersion: machineconfiguration.openshift.io/v1
53+
kind: MachineOSBuild
54+
metadata:
55+
name: foobar
56+
spec:
57+
machineConfig:
58+
name: rendered-worker-abcd
59+
machineOSConfig:
60+
name: worker
61+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
62+
status:
63+
builder:
64+
imageBuilderType: Job
65+
expectedStatusError: "status.builder: Invalid value: \"object\": job is required when imageBuilderType is Job, and forbidden otherwise"
66+
- name: Successfully set buildEnd
67+
initial: |
68+
apiVersion: machineconfiguration.openshift.io/v1
69+
kind: MachineOSBuild
70+
metadata:
71+
name: foobar
72+
spec:
73+
machineConfig:
74+
name: rendered-worker-abcd
75+
machineOSConfig:
76+
name: worker
77+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
78+
status:
79+
builder:
80+
imageBuilderType: Job
81+
job:
82+
group: batch
83+
resource: jobs
84+
namespace: openshift-machine-config-operator
85+
name: buildjob
86+
buildStart: 2024-11-28T10:00:00Z
87+
updated: |
88+
apiVersion: machineconfiguration.openshift.io/v1
89+
kind: MachineOSBuild
90+
metadata:
91+
name: foobar
92+
spec:
93+
machineConfig:
94+
name: rendered-worker-abcd
95+
machineOSConfig:
96+
name: worker
97+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
98+
status:
99+
builder:
100+
imageBuilderType: Job
101+
job:
102+
group: batch
103+
resource: jobs
104+
namespace: openshift-machine-config-operator
105+
name: buildjob
106+
buildStart: 2024-11-28T10:00:00Z
107+
buildEnd: 2024-11-28T11:00:00Z
108+
expected: |
109+
apiVersion: machineconfiguration.openshift.io/v1
110+
kind: MachineOSBuild
111+
metadata:
112+
name: foobar
113+
spec:
114+
machineConfig:
115+
name: rendered-worker-abcd
116+
machineOSConfig:
117+
name: worker
118+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
119+
status:
120+
builder:
121+
imageBuilderType: Job
122+
job:
123+
group: batch
124+
resource: jobs
125+
namespace: openshift-machine-config-operator
126+
name: buildjob
127+
buildStart: 2024-11-28T10:00:00Z
128+
buildEnd: 2024-11-28T11:00:00Z
129+
- name: Fail on invalid buildEnd time
130+
initial: |
131+
apiVersion: machineconfiguration.openshift.io/v1
132+
kind: MachineOSBuild
133+
metadata:
134+
name: foobar
135+
spec:
136+
machineConfig:
137+
name: rendered-worker-abcd
138+
machineOSConfig:
139+
name: worker
140+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
141+
status:
142+
builder:
143+
imageBuilderType: Job
144+
job:
145+
group: batch
146+
resource: jobs
147+
namespace: openshift-machine-config-operator
148+
name: buildjob
149+
buildStart: 2024-11-28T10:00:00Z
150+
updated: |
151+
apiVersion: machineconfiguration.openshift.io/v1
152+
kind: MachineOSBuild
153+
metadata:
154+
name: foobar
155+
spec:
156+
machineConfig:
157+
name: rendered-worker-abcd
158+
machineOSConfig:
159+
name: worker
160+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
161+
status:
162+
builder:
163+
imageBuilderType: Job
164+
job:
165+
group: batch
166+
resource: jobs
167+
namespace: openshift-machine-config-operator
168+
name: buildjob
169+
buildStart: 2024-11-28T10:00:00Z
170+
buildEnd: 2024-11-28T09:00:00Z
171+
expectedStatusError: "status: Invalid value: \"object\": buildEnd must be after buildStart"
172+
- name: Should be able to set a condition
173+
initial: |
174+
apiVersion: machineconfiguration.openshift.io/v1
175+
kind: MachineOSBuild
176+
metadata:
177+
name: foobar
178+
spec:
179+
machineConfig:
180+
name: rendered-worker-abcd
181+
machineOSConfig:
182+
name: worker
183+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
184+
status:
185+
builder:
186+
imageBuilderType: Job
187+
job:
188+
group: batch
189+
resource: jobs
190+
namespace: openshift-machine-config-operator
191+
name: buildjob
192+
conditions:
193+
- type: Succeeded
194+
status: "False"
195+
reason: "Reason"
196+
message: "Message"
197+
lastTransitionTime: "2024-11-28T10:00:00Z"
198+
updated: |
199+
apiVersion: machineconfiguration.openshift.io/v1
200+
kind: MachineOSBuild
201+
metadata:
202+
name: foobar
203+
spec:
204+
machineConfig:
205+
name: rendered-worker-abcd
206+
machineOSConfig:
207+
name: worker
208+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
209+
status:
210+
builder:
211+
imageBuilderType: Job
212+
job:
213+
group: batch
214+
resource: jobs
215+
namespace: openshift-machine-config-operator
216+
name: buildjob
217+
conditions:
218+
- type: Succeeded
219+
status: "True"
220+
reason: "Reason"
221+
message: "Message"
222+
lastTransitionTime: "2024-11-28T11:00:00Z"
223+
expected: |
224+
apiVersion: machineconfiguration.openshift.io/v1
225+
kind: MachineOSBuild
226+
metadata:
227+
name: foobar
228+
spec:
229+
machineConfig:
230+
name: rendered-worker-abcd
231+
machineOSConfig:
232+
name: worker
233+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
234+
status:
235+
builder:
236+
imageBuilderType: Job
237+
job:
238+
group: batch
239+
resource: jobs
240+
namespace: openshift-machine-config-operator
241+
name: buildjob
242+
conditions:
243+
- type: Succeeded
244+
status: "True"
245+
reason: "Reason"
246+
message: "Message"
247+
lastTransitionTime: "2024-11-28T11:00:00Z"
248+
- name: Failed builds cannot change status
249+
initial: |
250+
apiVersion: machineconfiguration.openshift.io/v1
251+
kind: MachineOSBuild
252+
metadata:
253+
name: foobar
254+
spec:
255+
machineConfig:
256+
name: rendered-worker-abcd
257+
machineOSConfig:
258+
name: worker
259+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
260+
status:
261+
builder:
262+
imageBuilderType: Job
263+
job:
264+
group: batch
265+
resource: jobs
266+
namespace: openshift-machine-config-operator
267+
name: buildjob
268+
conditions:
269+
- type: Failed
270+
status: "True"
271+
reason: "Reason"
272+
message: "Message"
273+
lastTransitionTime: "2024-11-28T10:00:00Z"
274+
updated: |
275+
apiVersion: machineconfiguration.openshift.io/v1
276+
kind: MachineOSBuild
277+
metadata:
278+
name: foobar
279+
spec:
280+
machineConfig:
281+
name: rendered-worker-abcd
282+
machineOSConfig:
283+
name: worker
284+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
285+
status:
286+
builder:
287+
imageBuilderType: Job
288+
job:
289+
group: batch
290+
resource: jobs
291+
namespace: openshift-machine-config-operator
292+
name: buildjob
293+
conditions:
294+
- type: Failed
295+
status: "False"
296+
reason: "Reason"
297+
message: "Message"
298+
lastTransitionTime: "2024-11-28T10:00:00Z"
299+
expectedStatusError: "status.conditions: Invalid value: \"array\": once a Failed condition is set, conditions are immutable"
300+
- name: Interrupted builds cannot change status
301+
initial: |
302+
apiVersion: machineconfiguration.openshift.io/v1
303+
kind: MachineOSBuild
304+
metadata:
305+
name: foobar
306+
spec:
307+
machineConfig:
308+
name: rendered-worker-abcd
309+
machineOSConfig:
310+
name: worker
311+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
312+
status:
313+
builder:
314+
imageBuilderType: Job
315+
job:
316+
group: batch
317+
resource: jobs
318+
namespace: openshift-machine-config-operator
319+
name: buildjob
320+
conditions:
321+
- type: Interrupted
322+
status: "True"
323+
reason: "Reason"
324+
message: "Message"
325+
lastTransitionTime: "2024-11-28T10:00:00Z"
326+
updated: |
327+
apiVersion: machineconfiguration.openshift.io/v1
328+
kind: MachineOSBuild
329+
metadata:
330+
name: foobar
331+
spec:
332+
machineConfig:
333+
name: rendered-worker-abcd
334+
machineOSConfig:
335+
name: worker
336+
renderedImagePushSpec: quay.io/mco/renderedImage:latest
337+
status:
338+
builder:
339+
imageBuilderType: Job
340+
job:
341+
group: batch
342+
resource: jobs
343+
namespace: openshift-machine-config-operator
344+
name: buildjob
345+
conditions:
346+
- type: Succeeded
347+
status: "True"
348+
reason: "Reason"
349+
message: "Message"
350+
lastTransitionTime: "2024-11-28T10:00:00Z"
351+
expectedStatusError: "status.conditions: Invalid value: \"array\": once an Interrupted condition is set, conditions are immutable"

0 commit comments

Comments
 (0)