-
Notifications
You must be signed in to change notification settings - Fork 576
AGENT-1330: machineconfiguration/v1alpha1: add InternalReleaseImage #2510
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?
AGENT-1330: machineconfiguration/v1alpha1: add InternalReleaseImage #2510
Conversation
|
@andfasano: This pull request references AGENT-1330 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Hello @andfasano! Some important instructions when contributing to openshift/api: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
9ea943a to
9eca225
Compare
0d80867 to
7ea433e
Compare
|
/retest-required |
|
I'm currently experimenting with AI for API review, hopefully some of the content it is generating is helpful for you to improve your API The following code blocks were generated by Claude I think the linting issues are actually not the response I'd like. Instead lets try and make the zero values not valid (required fields or For the comments, it has highlighted that you haven't explained what happens when the optional fields are omitted, though I'm not sure its suggestions are super helpful, please review and think about what you'd actually like to put in. If it has identified something where you can't think of a reason why it wouldn't be present, then maybe the field should actually be required Quizzing specifically about whether all validations were documented, some further output |
7b60a33 to
ab6545c
Compare
|
/api-review |
cf83224 to
c2f669c
Compare
|
/test verify |
f330e2a to
6b6941e
Compare
a9c080e to
5bb2da8
Compare
|
/retest |
5bb2da8 to
ee91dd4
Compare
|
/retest |
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.
Overall the structure makes more sense to me. A few questions/comments on the new MCN fields (and the previous question on the conditions)
| // +listType=map | ||
| // +listMapKey=name | ||
| // +kubebuilder:validation:MaxItems=5 | ||
| // +optional |
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.
Just thinking out loud, maybe we should have this be required (if the IRI status exists) so at it would always reflect what the daemon is currently detecting? And if we don't detect anything we just have an empty list?
eb17df7 to
b91c71a
Compare
...sts/internalreleaseimages.machineconfiguration.openshift.io/NoRegistryClusterOperations.yaml
Show resolved
Hide resolved
69a28e6 to
67cbb0e
Compare
67cbb0e to
7727158
Compare
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 conditions looks good, some more comments inline:
And also, running claude again via #2548 to see what it suggests:
Summary
✅ Linting checks PASSED - No issues found with make lint
Detailed Analysis
I've reviewed the PR against both Kubernetes and OpenShift API conventions. The changes introduce a new v1alpha1 API
(InternalReleaseImage) and add corresponding status fields to the existing v1 MachineConfigNode API.
Critical Issues Found
1. Missing Optional Field Behavior Documentation
Line 161-166 in machineconfiguration/v1/types_machineconfignode.go:
Current (problematic) code:
// internalReleaseImage describes the status of the release payloads stored in the node.
// When specified, an internalReleaseImage custom resource exists on the cluster, and the specified images will be made
available on the control plane nodes.
// This field will reflect the actual on-disk state of those release images.
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
// +optional
InternalReleaseImage MachineConfigNodeStatusInternalReleaseImage `json:"internalReleaseImage,omitzero,omitempty"`
Suggested change:
- // internalReleaseImage describes the status of the release payloads stored in the node.
- // When specified, an internalReleaseImage custom resource exists on the cluster, and the specified images will be
made available on the control plane nodes.
- // This field will reflect the actual on-disk state of those release images.
+ // internalReleaseImage describes the status of the release payloads stored in the node.
+ // When specified, an internalReleaseImage custom resource exists on the cluster, and the specified images will be
made available on the control plane nodes.
+ // This field will reflect the actual on-disk state of those release images.
+ // When omitted, no internalReleaseImage custom resource exists on the cluster, or the NoRegistryClusterOperations
feature gate is disabled.
Explanation: According to OpenShift API conventions, optional fields must explicitly document what happens when they are
omitted. The current documentation only explains when the field is specified, but doesn't clarify the omitted behavior.
---
2. Missing Validation Marker Documentation (MinItems/MaxItems)
Line 42-52 in machineconfiguration/v1alpha1/types_internalreleaseimage.go:
Current (problematic) code:
// releases is a list of release bundle identifiers that the user wants to
// add/remove to/from the control plane nodes.
// Entries must be unique, keyed on the name field.
// This field can contain between 1 and 5 entries.
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=5
// +listType=map
// +listMapKey=name
// +required
Releases []InternalReleaseImageRef `json:"releases,omitempty"`
Suggested change:
// releases is a list of release bundle identifiers that the user wants to
// add/remove to/from the control plane nodes.
// Entries must be unique, keyed on the name field.
- // This field can contain between 1 and 5 entries.
+ // This field is required and must contain between 1 and 5 entries.
Explanation: While the documentation mentions the range constraint, it should also clarify that the field is required
(not just via the marker). However, this is borderline acceptable as the constraint is documented. The main improvement
is making it clearer that this is a required field in the prose.
---
3. Inconsistent Required Field Marking
Line 172-183 in machineconfiguration/v1/types_machineconfignode.go:
Current (problematic) code:
// MachineConfigNodeStatusInternalReleaseImage holds information about the current and discovered release bundles for
the observed machine
// config node.
type MachineConfigNodeStatusInternalReleaseImage struct {
// releases is a list of the release bundles currently owned and managed by the
// cluster, indicating that their images can be safely pulled by any cluster entity
// requiring them.
// Entries must be unique, keyed on the name field.
// This field can contain between 1 and 5 entries.
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=5
// +required
Releases []MachineConfigNodeStatusInternalReleaseImageRef `json:"releases,omitempty"`
}
Suggested change:
// releases is a list of the release bundles currently owned and managed by the
// cluster, indicating that their images can be safely pulled by any cluster entity
// requiring them.
// Entries must be unique, keyed on the name field.
- // This field can contain between 1 and 5 entries.
+ // This field is required and must contain between 1 and 5 entries.
Explanation: The field is marked as +required but the documentation says "can contain" which is ambiguous. It should
explicitly state "is required and must contain" to match the validation marker.
---
4. Optional Field in Status Missing Omitted Behavior
Line 66-77 in machineconfiguration/v1alpha1/types_internalreleaseimage.go:
Current (problematic) code:
// releases is a list of the release bundles currently owned and managed by the
// cluster, indicating that their images can be safely pulled by any cluster entity
// requiring them.
// Entries must be unique, keyed on the name field.
// This field can contain between 1 and 5 entries.
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=5
// +optional
Releases []InternalReleaseImageStatusRef `json:"releases,omitempty"`
Suggested change:
// releases is a list of the release bundles currently owned and managed by the
// cluster, indicating that their images can be safely pulled by any cluster entity
// requiring them.
// Entries must be unique, keyed on the name field.
- // This field can contain between 1 and 5 entries.
+ // When specified, this field must contain between 1 and 5 entries.
+ // When omitted, no release bundles have been observed or managed yet.
Explanation: This optional field doesn't explain what it means when it's omitted. According to the API review
requirements, optional fields must document their omitted behavior.
---
5. Spelling Error in Documentation
Line 116 and Line 224 in both files:
Current (problematic) code:
// InternalReleaseImageConditionTypeInstalling describes a new release that is getting installed on the current node.
Due the size of the data
// transfered, the operation could take several minutes
Suggested change:
- // InternalReleaseImageConditionTypeInstalling describes a new release that is getting installed on the current node.
Due the size of the data
- // transfered, the operation could take several minutes
+ // InternalReleaseImageConditionTypeInstalling describes a new release that is getting installed on the current node.
Due to the size of the data
+ // transferred, the operation could take several minutes
Explanation: Two errors: "Due the" should be "Due to the" and "transfered" should be "transferred" (two r's).
---
Positive Observations
✅ Strong validation coverage - The API includes comprehensive CEL validation rules for the image field format
✅ Good documentation structure - Field purposes are generally well-documented
✅ Proper feature gating - Both APIs are properly gated behind the NoRegistryClusterOperations feature gate
✅ Consistent naming - Field names follow Kubernetes/OpenShift conventions (camelCase in JSON, PascalCase in Go)
✅ List type annotations - Proper use of +listType=map with +listMapKey for uniqueness constraints
✅ Validation markers documented - MinLength/MaxLength constraints are documented in prose
---
Recommendations
MUST FIX:
1. Document omitted behavior for all optional fields (Issues #1 and #4)
2. Fix spelling errors in condition type documentation (Issue #5)
SHOULD FIX:
3. Clarify required field documentation to explicitly state "required" in prose (Issues #2 and #3)
---
Conclusion
The PR demonstrates good API design practices but has critical documentation gaps around optional field behavior that
must be addressed before merging. These gaps violate the OpenShift API convention requirement that optional fields must
explain what happens when omitted.
Once the optional field documentation is updated, this API will be compliant with both Kubernetes and OpenShift API
conventions.
Also ran the same review command from the master branch, it had the same suggestions, but a couple more things:
API Review Report for PR #2510
...
Issue 7: Duplicate InternalReleaseImageConditionType in wrong package
Line 217: The InternalReleaseImageConditionType enum is defined in the v1 package but the comment references
MachineConfigNodeStatusInternalReleaseImageRef, suggesting this might be used across both v1 and v1alpha1.
Current (problematic) code:
// InternalReleaseImageConditionType is each possible state for each possible
MachineConfigNodeStatusInternalReleaseImageRef
// conditions type.
// +enum
type InternalReleaseImageConditionType string
Status: ⚠️ DESIGN CONCERN - This same enum type is defined in both machineconfiguration/v1/types_machineconfignode.go
and machineconfiguration/v1alpha1/types_internalreleaseimage.go. While not strictly a documentation issue, this creates
type duplication between API versions. Consider if one should reference the other or if they should be in a shared
package.
---
● 📊 SUMMARY
Critical Issues (Must Fix): 2
1. machineconfiguration/v1alpha1/types_internalreleaseimage.go:47 - Releases field: Missing clear statement that field
is required (should say "must contain" not "can contain")
2. machineconfiguration/v1alpha1/types_internalreleaseimage.go:87 - Conditions field: Missing omitted behavior
documentation and MinItems/MaxItems documentation
Medium Issues (Should Fix): 2
3. machineconfiguration/v1/types_machineconfignode.go:166 - InternalReleaseImage field: Missing omitted behavior
documentation
4. machineconfiguration/v1/types_machineconfignode.go:182 - Releases field: Inconsistent wording ("can contain" vs "must
contain")
Design Concerns: 1
5. Type Duplication: InternalReleaseImageConditionType is defined identically in both v1 and v1alpha1 packages
---
✅ What's Done Well
1. Comprehensive validation rules: The XValidation rules for image references are well-designed and thoroughly enforce
the OCI image format
2. Length constraints documented: MinLength and MaxLength constraints are clearly documented for most fields
3. Field purpose clear: Most fields have clear descriptions of their purpose and use
4. Feature gate usage: Proper use of feature gates for tech preview functionality
---
🔧 Recommended Actions
Before Merge:
1. Fix the two critical documentation issues for optional fields and required fields
2. Address the medium issues for consistency
3. Consider refactoring the duplicated InternalReleaseImageConditionType to a shared location
Post-Review:
- Run make update-codegen-crds
API_GROUP_VERSIONS=machineconfiguration.openshift.io/v1,machineconfiguration.openshift.io/v1alpha1 after making
documentation changes
- Re-run make lint to ensure no new issues are introduced
---
So it somewhat caught that the crd isn't being deployed, also comment on that inline
...rds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml
Show resolved
Hide resolved
e4169d2 to
a42fe26
Compare
a42fe26 to
443472b
Compare
…re adopted for the MCN status field
443472b to
4e1fa38
Compare
|
/retest |
|
@andfasano: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
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.
Thanks for the updates, going to mark this shadow review completed, barring some minor nits and typos below
| // | ||
| // Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. | ||
| // +openshift:compatibility-gen:level=4 | ||
| type InternalReleaseImageList struct { |
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.
(minor): since we are making it a singleton cluster object, I wonder if we still need to define this list object
| // one of the control plane nodes | ||
| InternalReleaseImageConditionTypeMounted InternalReleaseImageConditionType = "Mounted" | ||
| // InternalReleaseImageConditionTypeInstalling describes a new release that is getting installed in the cluster. Due the size of the data | ||
| // transfered, the operation could take several minutes. The condition will remain in such state until all the control plane nodes will |
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.
nit: typo transfered -> transferred
| // the current node | ||
| InternalReleaseImageConditionTypeMounted InternalReleaseImageConditionType = "Mounted" | ||
| // InternalReleaseImageConditionTypeInstalling describes a new release that is getting installed on the current node. Due the size of the data | ||
| // transfered, the operation could take several minutes |
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.
nit: typo transfered -> transferred
|
|
||
| // spec describes the configuration of this internal release image. | ||
| // +required | ||
| Spec InternalReleaseImageSpec `json:"spec,omitzero"` |
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.
I think this should also have omitempty per https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#serialization-of-optionalrequired-fields ? Although I'm not 100% sure on this
This patch adds the new
InternalReleaseImageCRD. See openshift/enhancements#1821 for additional details