Skip to content

[release-4.18] change OCL CRD deployment to v1 #2316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-4.18
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hack/update-payload-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#TODO(jerzhang): once MOSC/MOSB graduates, update the v1 crds to include them
crd_globs="\
authorization/v1/zz_generated.crd-manifests/*_config-operator_*.crd*yaml\
config/v1/zz_generated.crd-manifests/*_config-operator_*.crd*yaml\
Expand All @@ -22,7 +23,8 @@ crd_globs="\
config/v1/zz_generated.crd-manifests/0000_10_openshift-controller-manager_01_builds*.crd.yaml
operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers*.crd.yaml
machineconfiguration/v1/zz_generated.crd-manifests/*.crd.yaml
machineconfiguration/v1alpha1/zz_generated.crd-manifests/*.crd.yaml
machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes*.crd.yaml
machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_pinnedimagesets*.crd.yaml
operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations*.crd.yaml
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clusterimagepolicies*.crd.yaml
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_imagepolicies*.crd.yaml
Expand Down
4 changes: 4 additions & 0 deletions machineconfiguration/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&MachineConfigList{},
&MachineConfigPool{},
&MachineConfigPoolList{},
&MachineOSConfig{},
&MachineOSConfigList{},
&MachineOSBuild{},
&MachineOSBuildList{},
)

metav1.AddToGroupVersion(scheme, GroupVersion)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,351 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "MachineOSBuild"
crdName: machineosbuilds.machineconfiguration.openshift.io
featureGate: OnClusterBuild
tests:
onCreate:
- name: Should be able to create a minimal MachineOSBuild
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
onUpdate:
- name: Job imagebuilder type must have job reference
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
expectedStatusError: "status.builder: Invalid value: \"object\": job is required when imageBuilderType is Job, and forbidden otherwise"
- name: Successfully set buildEnd
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
buildStart: 2024-11-28T10:00:00Z
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
buildStart: 2024-11-28T10:00:00Z
buildEnd: 2024-11-28T11:00:00Z
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
buildStart: 2024-11-28T10:00:00Z
buildEnd: 2024-11-28T11:00:00Z
- name: Fail on invalid buildEnd time
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
buildStart: 2024-11-28T10:00:00Z
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
buildStart: 2024-11-28T10:00:00Z
buildEnd: 2024-11-28T09:00:00Z
expectedStatusError: "status: Invalid value: \"object\": buildEnd must be after buildStart"
- name: Should be able to set a condition
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Succeeded
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T10:00:00Z"
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Succeeded
status: "True"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T11:00:00Z"
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Succeeded
status: "True"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T11:00:00Z"
- name: Failed builds cannot change status
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Failed
status: "True"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T10:00:00Z"
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Failed
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T10:00:00Z"
expectedStatusError: "status.conditions: Invalid value: \"array\": once a Failed condition is set, conditions are immutable"
- name: Interrupted builds cannot change status
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Interrupted
status: "True"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T10:00:00Z"
updated: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSBuild
metadata:
name: foobar
spec:
machineConfig:
name: rendered-worker-abcd
machineOSConfig:
name: worker
renderedImagePushSpec: quay.io/mco/renderedImage:latest
status:
builder:
imageBuilderType: Job
job:
group: batch
resource: jobs
namespace: openshift-machine-config-operator
name: buildjob
conditions:
- type: Succeeded
status: "True"
reason: "Reason"
message: "Message"
lastTransitionTime: "2024-11-28T10:00:00Z"
expectedStatusError: "status.conditions: Invalid value: \"array\": once an Interrupted condition is set, conditions are immutable"
Loading