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 dd3b585
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 71 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
8 changes: 2 additions & 6 deletions machineconfiguration/v1/types_machineosbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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,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: |-
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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:
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,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: |-
Expand Down Expand Up @@ -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:
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
6 changes: 3 additions & 3 deletions machineconfiguration/v1/zz_generated.swagger_doc_generated.go

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

0 comments on commit dd3b585

Please sign in to comment.