diff --git a/machineconfiguration/v1/tests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml b/machineconfiguration/v1/tests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml index c59e1c201b9..dbe7f302153 100644 --- a/machineconfiguration/v1/tests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml +++ b/machineconfiguration/v1/tests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml @@ -15,7 +15,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseImagePullSecret: name: foo @@ -36,7 +36,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseImagePullSecret: name: foo @@ -59,7 +59,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseImagePullSecret: name: foo @@ -80,7 +80,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseImagePullSecret: name: foo @@ -102,7 +102,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseImagePullSecret: name: foo @@ -125,7 +125,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: foo.bar baseImagePullSecret: name: foo @@ -148,7 +148,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseOSExtensionsImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 renderedImagePushSecret: @@ -167,7 +167,7 @@ tests: name: worker buildInputs: imageBuilder: - imageBuilderType: PodImageBuilder + imageBuilderType: JobImageBuilder baseOSImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 baseOSExtensionsImagePullspec: example.io/my-project/image-v1.0_23@sha256:2c3ea52ac3a41c6d58e85977c3149413e3fa4b70eb2397426456863adbf43306 renderedImagePushSecret: diff --git a/machineconfiguration/v1/types_machineosbuild.go b/machineconfiguration/v1/types_machineosbuild.go index 184a168ad59..ce1fe3602df 100644 --- a/machineconfiguration/v1/types_machineosbuild.go +++ b/machineconfiguration/v1/types_machineosbuild.go @@ -103,17 +103,13 @@ type MachineOSBuildStatus struct { } // MachineOSBuilderReference describes which ImageBuilder backend to use for this build -// +union -// +kubebuilder:validation:XValidation:rule="has(self.imageBuilderType) && self.imageBuilderType == 'PodImageBuilder' ? has(self.buildPod) : !has(self.buildPod)",message="buildPod is required when imageBuilderType is PodImageBuilder, and forbidden otherwise" type MachineOSBuilderReference struct { // ImageBuilderType describes the image builder set in the MachineOSConfig - // +unionDiscriminator ImageBuilderType MachineOSImageBuilderType `json:"imageBuilderType"` - // relatedObjects is a list of objects that are related to the build process. - // +unionMember + // ImageBuilderRef is a reference to the object that is managing the image build // +optional - PodImageBuilder *ObjectReference `json:"buildPod,omitempty"` + ImageBuilderRef *ObjectReference `json:"ImageBuilderRef,omitempty"` } // BuildProgess highlights some of the key phases of a build to be tracked in Conditions. diff --git a/machineconfiguration/v1/types_machineosconfig.go b/machineconfiguration/v1/types_machineosconfig.go index 7842e9344c0..cf701846da9 100644 --- a/machineconfiguration/v1/types_machineosconfig.go +++ b/machineconfiguration/v1/types_machineosconfig.go @@ -113,6 +113,7 @@ type BuildInputs struct { // +optional BaseImagePullSecret *ImageSecretObjectReference `json:"baseImagePullSecret,omitempty"` // machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig + // Currently supported type(s): JobImageBuilder // +kubebuilder:validation:Required ImageBuilder *MachineOSImageBuilder `json:"imageBuilder"` // renderedImagePushSecret is the secret used to connect to a user registry. @@ -169,8 +170,8 @@ type BuildOutputs struct { type MachineOSImageBuilder struct { // imageBuilderType specifies the backend to be used to build the image. - // +kubebuilder:validation:Enum:=PodImageBuilder - // Valid options are: PodImageBuilder + // +kubebuilder:validation:Enum:=JobImageBuilder + // Valid options are: JobImageBuilder ImageBuilderType MachineOSImageBuilderType `json:"imageBuilderType"` } @@ -234,6 +235,6 @@ type ImageSecretObjectReference struct { type MachineOSImageBuilderType string const ( - // describes that the machine-os-builder will use a custom pod builder that uses buildah - PodBuilder MachineOSImageBuilderType = "PodImageBuilder" + // describes that the machine-os-builder will use a Job to spin up a custom pod builder that uses buildah + JobBuilder MachineOSImageBuilderType = "JobImageBuilder" ) diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-CustomNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-CustomNoUpgrade.crd.yaml index e143d4055f4..6290429872b 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-CustomNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-CustomNoUpgrade.crd.yaml @@ -132,9 +132,9 @@ spec: description: BuilderReference describes which ImageBuilder backend to use for this build properties: - buildPod: - description: relatedObjects is a list of objects that are related - to the build process. + ImageBuilderRef: + description: ImageBuilderRef is a reference to the object that + is managing the image build properties: group: description: |- @@ -172,11 +172,6 @@ spec: in the MachineOSConfig type: string type: object - x-kubernetes-validations: - - message: buildPod is required when imageBuilderType is PodImageBuilder, - and forbidden otherwise - rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''PodImageBuilder'' - ? has(self.buildPod) : !has(self.buildPod)' conditions: description: |- conditions are state related conditions for the build. Valid types are: diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-DevPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-DevPreviewNoUpgrade.crd.yaml index aab2e8109ea..039a10e5982 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-DevPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-DevPreviewNoUpgrade.crd.yaml @@ -132,9 +132,9 @@ spec: description: BuilderReference describes which ImageBuilder backend to use for this build properties: - buildPod: - description: relatedObjects is a list of objects that are related - to the build process. + ImageBuilderRef: + description: ImageBuilderRef is a reference to the object that + is managing the image build properties: group: description: |- @@ -172,11 +172,6 @@ spec: in the MachineOSConfig type: string type: object - x-kubernetes-validations: - - message: buildPod is required when imageBuilderType is PodImageBuilder, - and forbidden otherwise - rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''PodImageBuilder'' - ? has(self.buildPod) : !has(self.buildPod)' conditions: description: |- conditions are state related conditions for the build. Valid types are: diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-TechPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-TechPreviewNoUpgrade.crd.yaml index 108302b5ddd..d045894e39b 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-TechPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds-TechPreviewNoUpgrade.crd.yaml @@ -132,9 +132,9 @@ spec: description: BuilderReference describes which ImageBuilder backend to use for this build properties: - buildPod: - description: relatedObjects is a list of objects that are related - to the build process. + ImageBuilderRef: + description: ImageBuilderRef is a reference to the object that + is managing the image build properties: group: description: |- @@ -172,11 +172,6 @@ spec: in the MachineOSConfig type: string type: object - x-kubernetes-validations: - - message: buildPod is required when imageBuilderType is PodImageBuilder, - and forbidden otherwise - rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''PodImageBuilder'' - ? has(self.buildPod) : !has(self.buildPod)' conditions: description: |- conditions are state related conditions for the build. Valid types are: diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-CustomNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-CustomNoUpgrade.crd.yaml index 0c963a5e7bc..14d34923593 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-CustomNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-CustomNoUpgrade.crd.yaml @@ -144,15 +144,16 @@ spec: - containerfileArch x-kubernetes-list-type: map imageBuilder: - description: machineOSImageBuilder describes which image builder - will be used in each build triggered by this MachineOSConfig + description: |- + machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig + Currently supported type(s): JobImageBuilder properties: imageBuilderType: description: |- imageBuilderType specifies the backend to be used to build the image. - Valid options are: PodImageBuilder + Valid options are: JobImageBuilder enum: - - PodImageBuilder + - JobImageBuilder type: string type: object releaseVersion: diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-DevPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-DevPreviewNoUpgrade.crd.yaml index 0b3e1acff7c..204f018089d 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-DevPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-DevPreviewNoUpgrade.crd.yaml @@ -144,15 +144,16 @@ spec: - containerfileArch x-kubernetes-list-type: map imageBuilder: - description: machineOSImageBuilder describes which image builder - will be used in each build triggered by this MachineOSConfig + description: |- + machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig + Currently supported type(s): JobImageBuilder properties: imageBuilderType: description: |- imageBuilderType specifies the backend to be used to build the image. - Valid options are: PodImageBuilder + Valid options are: JobImageBuilder enum: - - PodImageBuilder + - JobImageBuilder type: string type: object releaseVersion: diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-TechPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-TechPreviewNoUpgrade.crd.yaml index 16ad77411c0..44b33899788 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-TechPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs-TechPreviewNoUpgrade.crd.yaml @@ -144,15 +144,16 @@ spec: - containerfileArch x-kubernetes-list-type: map imageBuilder: - description: machineOSImageBuilder describes which image builder - will be used in each build triggered by this MachineOSConfig + description: |- + machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig + Currently supported type(s): JobImageBuilder properties: imageBuilderType: description: |- imageBuilderType specifies the backend to be used to build the image. - Valid options are: PodImageBuilder + Valid options are: JobImageBuilder enum: - - PodImageBuilder + - JobImageBuilder type: string type: object releaseVersion: diff --git a/machineconfiguration/v1/zz_generated.deepcopy.go b/machineconfiguration/v1/zz_generated.deepcopy.go index c505d55c081..c107e74098f 100644 --- a/machineconfiguration/v1/zz_generated.deepcopy.go +++ b/machineconfiguration/v1/zz_generated.deepcopy.go @@ -1034,8 +1034,8 @@ func (in *MachineOSBuildStatus) DeepCopy() *MachineOSBuildStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineOSBuilderReference) DeepCopyInto(out *MachineOSBuilderReference) { *out = *in - if in.PodImageBuilder != nil { - in, out := &in.PodImageBuilder, &out.PodImageBuilder + if in.ImageBuilderRef != nil { + in, out := &in.ImageBuilderRef, &out.ImageBuilderRef *out = new(ObjectReference) **out = **in } diff --git a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosbuilds.machineconfiguration.openshift.io/OnClusterBuild.yaml b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosbuilds.machineconfiguration.openshift.io/OnClusterBuild.yaml index 34d711a19a1..7659df2a150 100644 --- a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosbuilds.machineconfiguration.openshift.io/OnClusterBuild.yaml +++ b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosbuilds.machineconfiguration.openshift.io/OnClusterBuild.yaml @@ -132,9 +132,9 @@ spec: description: BuilderReference describes which ImageBuilder backend to use for this build properties: - buildPod: - description: relatedObjects is a list of objects that are related - to the build process. + ImageBuilderRef: + description: ImageBuilderRef is a reference to the object that + is managing the image build properties: group: description: |- @@ -172,11 +172,6 @@ spec: in the MachineOSConfig type: string type: object - x-kubernetes-validations: - - message: buildPod is required when imageBuilderType is PodImageBuilder, - and forbidden otherwise - rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''PodImageBuilder'' - ? has(self.buildPod) : !has(self.buildPod)' conditions: description: |- conditions are state related conditions for the build. Valid types are: diff --git a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml index 4f1b564cbca..531558d21fa 100644 --- a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml +++ b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml @@ -144,15 +144,16 @@ spec: - containerfileArch x-kubernetes-list-type: map imageBuilder: - description: machineOSImageBuilder describes which image builder - will be used in each build triggered by this MachineOSConfig + description: |- + machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig + Currently supported type(s): JobImageBuilder properties: imageBuilderType: description: |- imageBuilderType specifies the backend to be used to build the image. - Valid options are: PodImageBuilder + Valid options are: JobImageBuilder enum: - - PodImageBuilder + - JobImageBuilder type: string type: object releaseVersion: diff --git a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go index 8ea3e91e827..77c55509bc3 100644 --- a/machineconfiguration/v1/zz_generated.swagger_doc_generated.go +++ b/machineconfiguration/v1/zz_generated.swagger_doc_generated.go @@ -405,7 +405,7 @@ func (MachineOSBuildStatus) SwaggerDoc() map[string]string { var map_MachineOSBuilderReference = map[string]string{ "": "MachineOSBuilderReference describes which ImageBuilder backend to use for this build", "imageBuilderType": "ImageBuilderType describes the image builder set in the MachineOSConfig", - "buildPod": "relatedObjects is a list of objects that are related to the build process.", + "ImageBuilderRef": "ImageBuilderRef is a reference to the object that is managing the image build", } func (MachineOSBuilderReference) SwaggerDoc() map[string]string { @@ -447,7 +447,7 @@ var map_BuildInputs = map[string]string{ "baseOSExtensionsImagePullspec": "baseOSExtensionsImagePullspec is the base Extensions image used in the build process the MachineOSConfig object will use the in cluster image registry configuration. if you wish to use a mirror or any other settings specific to registries.conf, please specify those in the cluster wide registries.conf. The format of the image pullspec is: host[:port][/namespace]/name@sha256: The digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.", "baseOSImagePullspec": "baseOSImagePullspec is the base OSImage we use to build our custom image. the MachineOSConfig object will use the in cluster image registry configuration. if you wish to use a mirror or any other settings specific to registries.conf, please specify those in the cluster wide registries.conf. The format of the image pullspec is: host[:port][/namespace]/name@sha256: The digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.", "baseImagePullSecret": "baseImagePullSecret is the secret used to pull the base image. must live in the openshift-machine-config-operator namespace if provided. defaults to using the cluster-wide pull secret if not specified.", - "imageBuilder": "machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig", + "imageBuilder": "machineOSImageBuilder describes which image builder will be used in each build triggered by this MachineOSConfig Currently supported type(s): JobImageBuilder", "renderedImagePushSecret": "renderedImagePushSecret is the secret used to connect to a user registry. the final image push and pull secrets should be separate for security concerns. If the final image push secret is somehow exfiltrated, that gives someone the power to push images to the image repository. By comparison, if the final image pull secret gets exfiltrated, that only gives someone to pull images from the image repository. It's basically the principle of least permissions. this push secret will be used only by the MachineConfigController pod to push the image to the final destination. Not all nodes will need to push this image, most of them will only need to pull the image in order to use it.", "renderedImagePushspec": "renderedImagePushspec describes the location of the final image. the MachineOSConfig object will use the in cluster image registry configuration. if you wish to use a mirror or any other settings specific to registries.conf, please specify those in the cluster wide registries.conf. The format of the image pushspec is: host[:port][/namespace]/name: or svc_name.namespace.svc[:port]/repository/name:", "releaseVersion": "releaseVersion is an Openshift release version which the base OS image is associated with. This field is populated from the machine-config-osimageurl configmap in the openshift-machine-config-operator namespace. It will come in the format: 4.16.0-0.nightly-2024-04-03-065948 or any valid release. The MachineOSBuilder populates this field and validates that this is a valid stream. This is used as a label in the dockerfile that builds the OS image.", @@ -536,7 +536,7 @@ func (MachineOSContainerfile) SwaggerDoc() map[string]string { } var map_MachineOSImageBuilder = map[string]string{ - "imageBuilderType": "imageBuilderType specifies the backend to be used to build the image. Valid options are: PodImageBuilder", + "imageBuilderType": "imageBuilderType specifies the backend to be used to build the image. Valid options are: JobImageBuilder", } func (MachineOSImageBuilder) SwaggerDoc() map[string]string {