-
Notifications
You must be signed in to change notification settings - Fork 552
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
base: master
Are you sure you want to change the base?
Changes from all commits
c82e51f
af02296
6327735
3a396ae
b5369d1
1277c4f
9f1224a
5cb7c5d
584477d
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,151 @@ | ||
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: Should be able to create MachineConfigNode with status.configImage when ImageModeStatusReporting is enabled when the current and desired images are 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/os-images@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
status: | ||
configImage: | ||
desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
currentImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
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/os-images@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
- 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 | ||
status: | ||
configImage: | ||
desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/ocb-image@sha256:7a539f562d8d5d3b6bd7338ac014e34dabc9626cf344d30e412ef98a55cc1bf6 | ||
currentImage: 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: Should be able to create MachineConfigNode with status.configImage when ImageModeStatusReporting is enabled without the current image provided | ||
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 | ||
status: | ||
configImage: | ||
desiredImage: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images@sha256:c47856f56e1fdb7c9d10a1658e4ea85fbea44d71fb0e82898d152b47e0f894c6 | ||
currentImage: | ||
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" |
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 holds the desired image for the node targeted by this machine config node resource. | ||
// The desired image represents the image the node will attempt to update to and gets set before the machine config operator validates | ||
// the new image against the current image. This field will be used only when OCL is enabled. This will be empty/omitted otherwise. | ||
// +openshift:enable:FeatureGate=ImageModeStatusReporting | ||
// +optional | ||
ConfigImage MachineConfigNodeSpecConfigImage `json:"configImage"` | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
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. Based on the description above, should this also be |
||
} | ||
|
||
// 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
|
||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=20 | ||
|
@@ -120,6 +129,10 @@ type MachineConfigNodeStatus struct { | |
// configVersion describes the current and desired machine config version for this node. | ||
// +optional | ||
ConfigVersion *MachineConfigNodeStatusMachineConfigVersion `json:"configVersion,omitempty"` | ||
// configImage describes the current and desired image for this node. OCL must be enabled for this to be populated. It will be omitted/empty otherwise. | ||
// +openshift:enable:FeatureGate=ImageModeStatusReporting | ||
// +optional | ||
ConfigImage *MachineConfigNodeStatusConfigImage `json:"configImage,omitempty"` | ||
naseerahkani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// pinnedImageSets describes the current and desired pinned image sets for this node. | ||
// +listType=map | ||
// +listMapKey=name | ||
|
@@ -209,6 +222,47 @@ 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 the fully qualified image pull spec of the image that the Machine | ||
// Config Operator (MCO) intends to apply to the node. This field is optional. When | ||
// OCL is not enabled, this field will be omitted/empty. | ||
// The format of the push spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
// The length of the whole spec must be between 1 to 447 characters. | ||
// +optional | ||
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. Should this field be required? Making this field optional means the parent field that is already optional has no required members. That leads to being able to configure the field to do the same thing by:
configImage:
desiredImage: "" We generally try to only have a single way to "say" something for users so there isn't confusion on which approach should be used. We generally try to avoid allowing fields to be set to To narrow it down further as to which approach is preferred, what does it mean for the parent field 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. This validation rule should take care of this issue. When the desiredImage is empty, the idea is that OCL is not enabled. If it is enabled, either the currentImage or the desiredImage needs to be set. I can get an OCL expert to confirm if this would be the optimal approach or if there should be a default message printed as a means to provide clarity to users. 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. The linked validation doesn't apply to the question I'm asking here. This additional context I think helps me understand the goal here. So, I think Mark This approach ensures the following behavior is the only valid behavior:
Now I'm moving to a separate thing - trying to understand what is and is not a valid value to supply here.
Can we write multiple CEL expressions that ensures we are appropriately evaluating these requirements in a way that we can return helpful messages to end users? For example, when I provide something like 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.
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.
As of right now, I'm not aware of any plans to have setting the I understand the idea for future proofing if we want to allow for that architecture shift in the future, but, even then, allowing the desiredImage to be optional seems important for the case of disabling OCL. The steps for disabling (as I understand) are
My view is between steps 2 & 3, while the node is updating, OCL is still technically enabled since the node has a @cheesesashimi @umohnani8 or @yuqi-zhang do any of you have thoughts on the ideas being discussed in this thread? 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.
Why are we adding a spec field for this if the goal is for it to just communicate status? Spec fields indicate that it is a configurable field. 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. It might be helpful for me as a reviewer if you could answer the following questions for me:
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.
Adding If we should not include the ConfigImage in Spec, that's fine and we can remove it. I was not really aware that everything in
The MachineConfigDaemon owns/manages the resource.
There is one
The MCO populates all information in the MachineConfigNode objects & users can consume the information how they wish by getting & describing the MCN for the node they are hoping to see more information about. Since it is relatively new, there is nothing reacting to the MCN object yet. There have informal talks about the idea of using the MCN to trigger node updates instead of node annotations in the future, so that's a future proofing idea to have in mind, but beyond just ideas, I'm only aware of users consuming information from the MCN. This is the enhancement for the MCN as it stands in 4.19 and may give more information on initial intentions. The WIP 4.20 additions are proposed in this working PR (which will be updated based on any conversations in this PR). 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. There's quite a bit of discussion in the thread already, but I think to add some additional context, one of the main design goal of MCN is to reflect and provide additional context on the existing MCO-managed node-object fields (annotations), which is used primarily both as status as well as a way for the controller and daemon to communicate the current and desired states. We did not want to shove additional fields into the node object, so MCN would be the place for future fields that facilitate that (right now, we have PinnedImageSets dependent on MCN) In that pattern, for the MCN, the consumption model is that the "spec" is set and managed by the controller, and the "status" should be used by the daemon, (although @isabella-janssen you would need to correct me if I'm wrong there) Long term I think that's the pattern we'd want. The spec, much like node object fields today, is not something we'd like the user to directly set, but rather be set by the controller. In that vein I think it's fine to match the MachineConfig setup we have today to keep that consistentcy. If we'd like to reconsider that approach, I think the discussion point would be whether MCN should be status only, and consider some other approach to do controller-daemon interactions. So to the last question of "Who/what reacts to a MachineConfigNode object?" I'd say it's the controller and the daemon reacting to each others updates to it. |
||
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 OCL 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 the fully qualified image pull spec of the image that is | ||
// currently applied to the node. | ||
// This field is optional because when image-mode is first enabled on a | ||
// node, there is no currentImage because the node has not yet applied | ||
// the updated image. Only after the updated image is applied will the | ||
// currentImage be populated. | ||
// The format of the push spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
// The length of the whole spec must be between 1 to 447 characters. | ||
// +optional | ||
CurrentImage ImageDigestFormat `json:"currentImage"` | ||
// desiredImage is a mirror of the desired image from the Spec. When the | ||
// current and desired image are not equal, the node is in an updating phase. This field is required. | ||
// The format of the push spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
// The length of the whole spec must be between 1 to 447 characters. | ||
// +optional | ||
DesiredImage ImageDigestFormat `json:"desiredImage"` | ||
} | ||
|
||
// 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 +282,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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is expected behavior if this value is not provided?
Lets explicitly mention in the GoDoc that this field is optional and what it means when it is omitted/empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments have been updated to describe the expected behavior when the field is empty. Please provide any additional suggestions/changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link shared is to comments on a totally different type. My original comment still stands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the confusion, it should be updated now as seen here.