-
Notifications
You must be signed in to change notification settings - Fork 586
MCO-1675: [API 2/6] Update API for Status Reporting needs #2383
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
Changes from all commits
36982cd
b10cf04
6aec27b
9d44d1a
9439983
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "[FeatureGate] ImageModeStatusReporting" | ||
| crdName: machineconfignodes.machineconfiguration.openshift.io | ||
| featureGates: | ||
| - ImageModeStatusReporting | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to create MachineConfigNode when spec.configImage ImageModeStatusReporting is enabled | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| expected: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| - name: spec.configImage.desiredImage should enforce MaxLength. | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: registry.example.com/a/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very//very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/j | ||
| expectedError: "the OCI Image reference must end with a valid '@sha256:<digest>' suffix, where '<digest>' is 64 characters long" | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Should not be able to create a MachineConfigNode with desiredImage set to a tag-based image reference | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images:latest | ||
| expectedError: "the OCI Image reference must end with a valid '@sha256:<digest>' suffix, where '<digest>' is 64 characters long" | ||
| - name: spec.configImage.desiredImage should enforce 256 image digest format. | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images@sha512:a2c24b2903ad327e06bf57ac1d34e4e99e284309ccc69a5ffcc640121c0f82a05a841e915edb1b633ca52692bd019e1fcdd09d3f0730ace8f49c96b3bd020216 | ||
| expectedError: "the OCI Image reference must end with a valid '@sha256:<digest>' suffix, where '<digest>' is 64 characters long" | ||
| onUpdate: | ||
| - name: Should be able to create MachineConfigNode with status.configImage when ImageModeStatusReporting is enabled when the current and desired images are the same | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| updated: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| status: | ||
| configImage: | ||
| currentImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| expected: | | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| status: | ||
| configImage: | ||
| currentImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| - name: Should be able to create MachineConfigNode with status.configImage when ImageModeStatusReporting is enabled when the current and desired images are the different. | ||
| initial: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| updated: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| status: | ||
| configImage: | ||
| currentImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| expected: | | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfigNode | ||
| metadata: | ||
| name: test-imagemodestatusreporting | ||
| spec: | ||
| node: | ||
| name: test-imagemodestatusreporting | ||
| pool: | ||
| name: worker | ||
| configVersion: | ||
| desired: rendered-worker-abc | ||
| configImage: | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
| status: | ||
| configImage: | ||
| currentImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
| desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,13 @@ type MachineConfigNodeSpec struct { | |
| // the new machine config against the current machine config. | ||
| // +required | ||
| ConfigVersion MachineConfigNodeSpecMachineConfigVersion `json:"configVersion"` | ||
|
|
||
| // configImage is an optional field for configuring the OS image to be used for this node. This field will only exist if the node belongs to a pool opted into on-cluster image builds, and will override any MachineConfig referenced OSImageURL fields | ||
| // When omitted, Image Mode is not be enabled and the node will follow the standard update process of creating a rendered MachineConfig and updating to its specifications. | ||
| // When specified, Image Mode is enabled and will attempt to update the node to use the desired image. Following this, the node will follow the standard update process of creating a rendered MachineConfig and updating to its specifications. | ||
| // +openshift:enable:FeatureGate=ImageModeStatusReporting | ||
| // +optional | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ConfigImage MachineConfigNodeSpecConfigImage `json:"configImage,omitempty,omitzero"` | ||
| } | ||
|
|
||
| // MachineConfigNodeStatus holds the reported information on a particular machine config node. | ||
|
|
@@ -106,6 +113,8 @@ type MachineConfigNodeStatus struct { | |
| // UpdatePrepared, UpdateExecuted, UpdatePostActionComplete, UpdateComplete, Updated, Resumed, | ||
| // Drained, AppliedFilesAndOS, Cordoned, Uncordoned, RebootedNode, NodeDegraded, PinnedImageSetsProgressing, | ||
| // and PinnedImageSetsDegraded. | ||
| // The following types are only available when the ImageModeStatusReporting feature gate is enabled: ImagePulledFromRegistry, | ||
| // AppliedOSImage, AppliedFiles | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+116
to
+117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do the presence/states of these condition types mean to me as an end-user? How do I know whether this condition is in a healthy/non-healthy state? I would love to see the GoDoc get updated to better reflect this information for end users that may be reading the documentation generated from this. That being said, I won't block this PR from merging on this. |
||
| // +listType=map | ||
| // +listMapKey=type | ||
| // +kubebuilder:validation:MaxItems=20 | ||
|
|
@@ -120,6 +129,15 @@ type MachineConfigNodeStatus struct { | |
| // configVersion describes the current and desired machine config version for this node. | ||
| // +optional | ||
| ConfigVersion *MachineConfigNodeStatusMachineConfigVersion `json:"configVersion,omitempty"` | ||
| // configImage is an optional field for configuring the OS image to be used for this node. This field will only exist if the node belongs to a pool opted into on-cluster image builds, and will override any MachineConfig referenced OSImageURL fields. | ||
| // When omitted, this means that the Image Mode feature is not being used and the node will be up to date with the specific current rendered config version for the nodes MachinePool. | ||
| // When specified, the Image Mode feature is enabled and the contents of this field show the observed state of the node image. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And what happens to the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat encapsulated in the other comments as well:
There is a bit of an overlap in this case. Right now how it's configured is that image-build pools build in the base OS (from MC), extensions (from MC), kerneltype (from MC, being worked on) and Containerfile content. Everything else (files/units/keys/partition info) is still in the MachineConfig application path
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good to have something in here that captures that the configuration image provides a base and the that config in configVersion extends it |
||
| // When Image Mode is enabled and a new MachineConfig is applied such that a new OS image build is not created, only the configVersion field will change. | ||
| // When Image Mode is enabled and a new MachineConfig is applied such that a new OS image build is created, then only the configImage field will change. It is also possible that both the configImage | ||
| // and configVersion change during the same update. | ||
| // +openshift:enable:FeatureGate=ImageModeStatusReporting | ||
| // +optional | ||
| ConfigImage MachineConfigNodeStatusConfigImage `json:"configImage,omitempty,omitzero"` | ||
| // pinnedImageSets describes the current and desired pinned image sets for this node. | ||
| // +listType=map | ||
| // +listMapKey=name | ||
|
|
@@ -209,6 +227,41 @@ type MachineConfigNodeSpecMachineConfigVersion struct { | |
| Desired string `json:"desired"` | ||
| } | ||
|
|
||
| // MachineConfigNodeSpecConfigImage holds the desired image for the node. | ||
| // This structure is populated from the `machineconfiguration.openshift.io/desiredImage` | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // annotation on the target node, which is set by the Machine Config Pool controller | ||
| // to signal the desired image pullspec for the node to update to. | ||
| type MachineConfigNodeSpecConfigImage struct { | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // desiredImage is a required field that configures the image that the node should be updated to use. | ||
| // It must be a fully qualified OCI image pull spec of the format host[:port][/namespace]/name@sha256:, where the digest must be exactly 64 characters in length and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
| // desiredImage must not be an empty string and must not exceed 447 characters in length. | ||
| // +required | ||
| DesiredImage ImageDigestFormat `json:"desiredImage"` | ||
| } | ||
|
|
||
| // MachineConfigNodeStatusConfigImage holds the observed state of the image | ||
| // on the node, including both the image targeted for an update and the image | ||
| // currently applied. This allows for monitoring the progress of the layering | ||
| // rollout. If Image Mode is enabled, desiredImage must be defined. | ||
| // +kubebuilder:validation:MinProperties:=1 | ||
| type MachineConfigNodeStatusConfigImage struct { | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // currentImage is an optional field that represents the current image that is applied to the node. | ||
| // When omitted, this means that no image updates have been applied to the node and it will be up to date with the specific current rendered config version. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we apply my suggestion above, apply here too
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still outstanding?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume the same answer to #2383 (comment) applies here as well? |
||
| // When specified, this means that the node is currently using this image. | ||
| // currentImage must be a fully qualified OCI image pull spec of the format host[:port][/namespace]/name@sha256:, where the digest must be exactly 64 characters in length and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
| // currentImage must not be an empty string and must not exceed 447 characters in length. | ||
| // +optional | ||
| CurrentImage ImageDigestFormat `json:"currentImage,omitzero,omitempty"` | ||
| // desiredImage is an optional field that represents the currently observed state of image that the node should be updated to use. | ||
| // When not specified, this means that Image Mode has been disabled and the node will up to date with the specific current rendered config version. | ||
| // When specified, this means that Image Mode has been enabled and the node is actively progressing to update the node to this image. | ||
| // If currentImage and desiredImage match, the node has been successfully updated to use the desired image. | ||
| // desiredImage must be a fully qualified OCI image pull spec of the format host[:port][/namespace]/name@sha256:, where the digest must be exactly 64 characters in length and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
| // desiredImage must not be an empty string and must not exceed 447 characters in length. | ||
| // +optional | ||
| DesiredImage ImageDigestFormat `json:"desiredImage,omitzero,omitempty"` | ||
| } | ||
|
|
||
| // StateProgress is each possible state for each possible MachineConfigNodeType | ||
| // +enum | ||
| type StateProgress string | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -228,8 +281,14 @@ const ( | |
| MachineConfigNodeResumed StateProgress = "Resumed" | ||
| // MachineConfigNodeUpdateDrained describes the part of the in progress phase where the node drains | ||
| MachineConfigNodeUpdateDrained StateProgress = "Drained" | ||
| // MachineConfigNodeUpdateFiles describes the part of the in progress phase where the nodes files changes | ||
| MachineConfigNodeUpdateFiles StateProgress = "AppliedFiles" | ||
| // MachineConfigNodeUpdateOS describes the part of the in progress phase where the OS config changes | ||
| MachineConfigNodeUpdateOS StateProgress = "AppliedOSImage" | ||
| // MachineConfigNodeUpdateFilesAndOS describes the part of the in progress phase where the nodes files and OS config change | ||
| MachineConfigNodeUpdateFilesAndOS StateProgress = "AppliedFilesAndOS" | ||
| // MachineConfigNodeImagePulledFromRegistry describes the part of the in progress phase where the update image is pulled from the registry | ||
| MachineConfigNodeImagePulledFromRegistry StateProgress = "ImagePulledFromRegistry" | ||
| // MachineConfigNodeUpdateCordoned describes the part of the in progress phase where the node cordons | ||
| MachineConfigNodeUpdateCordoned StateProgress = "Cordoned" | ||
| // MachineConfigNodeUpdateUncordoned describes the part of the completing phase where the node uncordons | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.