Skip to content

Commit

Permalink
Update from PodImageBuilder to JobImageBuilder
Browse files Browse the repository at this point in the history
Matching MCO changes, and add more description around the fields.
  • Loading branch information
yuqi-zhang committed Nov 19, 2024
1 parent c6619bf commit ddb8b4e
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -125,7 +125,7 @@ tests:
name: worker
buildInputs:
imageBuilder:
imageBuilderType: PodImageBuilder
imageBuilderType: JobImageBuilder
baseOSImagePullspec: foo.bar
baseImagePullSecret:
name: foo
Expand All @@ -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:
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions machineconfiguration/v1/types_machineosbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ 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"
// +kubebuilder:validation:XValidation:rule="has(self.imageBuilderType) && self.imageBuilderType == 'JobImageBuilder' ? has(self.jobImageBuilderRef) : !has(self.jobImageBuilderRef)",message="jobImageBuilderRef is required when imageBuilderType is JobImageBuilder, 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.
// JobImageBuilderRef is a reference to the Job that is managing the image build
// +unionMember
// +optional
PodImageBuilder *ObjectReference `json:"buildPod,omitempty"`
JobImageBuilderRef *ObjectReference `json:"jobImageBuilderRef,omitempty"`
}

// BuildProgess highlights some of the key phases of a build to be tracked in Conditions.
Expand Down
9 changes: 5 additions & 4 deletions machineconfiguration/v1/types_machineosconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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"
)
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ 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.
imageBuilderType:
description: ImageBuilderType describes the image builder set
in the MachineOSConfig
type: string
jobImageBuilderRef:
description: JobImageBuilderRef is a reference to the Job that
is managing the image build
properties:
group:
description: |-
Expand Down Expand Up @@ -167,16 +171,12 @@ spec:
- name
- resource
type: object
imageBuilderType:
description: ImageBuilderType describes the image builder set
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)'
- message: jobImageBuilderRef is required when imageBuilderType is
JobImageBuilder, and forbidden otherwise
rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''JobImageBuilder''
? has(self.jobImageBuilderRef) : !has(self.jobImageBuilderRef)'
conditions:
description: |-
conditions are state related conditions for the build. Valid types are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ 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.
imageBuilderType:
description: ImageBuilderType describes the image builder set
in the MachineOSConfig
type: string
jobImageBuilderRef:
description: JobImageBuilderRef is a reference to the Job that
is managing the image build
properties:
group:
description: |-
Expand Down Expand Up @@ -167,16 +171,12 @@ spec:
- name
- resource
type: object
imageBuilderType:
description: ImageBuilderType describes the image builder set
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)'
- message: jobImageBuilderRef is required when imageBuilderType is
JobImageBuilder, and forbidden otherwise
rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''JobImageBuilder''
? has(self.jobImageBuilderRef) : !has(self.jobImageBuilderRef)'
conditions:
description: |-
conditions are state related conditions for the build. Valid types are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ 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.
imageBuilderType:
description: ImageBuilderType describes the image builder set
in the MachineOSConfig
type: string
jobImageBuilderRef:
description: JobImageBuilderRef is a reference to the Job that
is managing the image build
properties:
group:
description: |-
Expand Down Expand Up @@ -167,16 +171,12 @@ spec:
- name
- resource
type: object
imageBuilderType:
description: ImageBuilderType describes the image builder set
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)'
- message: jobImageBuilderRef is required when imageBuilderType is
JobImageBuilder, and forbidden otherwise
rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''JobImageBuilder''
? has(self.jobImageBuilderRef) : !has(self.jobImageBuilderRef)'
conditions:
description: |-
conditions are state related conditions for the build. Valid types are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions machineconfiguration/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ 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.
imageBuilderType:
description: ImageBuilderType describes the image builder set
in the MachineOSConfig
type: string
jobImageBuilderRef:
description: JobImageBuilderRef is a reference to the Job that
is managing the image build
properties:
group:
description: |-
Expand Down Expand Up @@ -167,16 +171,12 @@ spec:
- name
- resource
type: object
imageBuilderType:
description: ImageBuilderType describes the image builder set
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)'
- message: jobImageBuilderRef is required when imageBuilderType is
JobImageBuilder, and forbidden otherwise
rule: 'has(self.imageBuilderType) && self.imageBuilderType == ''JobImageBuilder''
? has(self.jobImageBuilderRef) : !has(self.jobImageBuilderRef)'
conditions:
description: |-
conditions are state related conditions for the build. Valid types are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit ddb8b4e

Please sign in to comment.