-
Notifications
You must be signed in to change notification settings - Fork 65
⚠ Introduce ClusterExtensionRevision API #2051
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: main
Are you sure you want to change the base?
Conversation
[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 |
PR needs rebase. 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. |
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a85e3c0
to
bca3b28
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.
Saw this come through in my notification inbox and even though it is a draft thought I'd give some early feedback on the API
// | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:XValidation:rule="self.matches(\"^([0-9]+)(\\\\.[0-9]+)?(\\\\.[0-9]+)?(-([-0-9A-Za-z]+(\\\\.[-0-9A-Za-z]+)*))?(\\\\+([-0-9A-Za-z]+(-\\\\.[-0-9A-Za-z]+)*))?\")",message="version must be well-formed semver" | ||
Version string `json:"version"` |
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.
Adding a CEL validation means you need to add a maximum length or you risk easily exceeding your cost budget as it calculates it using the worst-case scenario (which in this case would be the longest possible string value).
Additionally, I suspect the empty string is not a valid value here - meaning you probably want a minimum length to prevent the value being able to be set to the empty string.
// as being available. This helps track how long an upgrade has been pending. | ||
// | ||
// +kubebuilder:validation:Required | ||
AvailableSince metav1.Time `json:"availableSince"` |
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.
Kubernetes API conventions generally encourage time based naming to be of the format {thing}Time
. In this case it would be something like AvailableTime
as opposed to AvailableSince
.
// approvedAt indicates when this upgrade revision was approved for execution. | ||
// This field is set automatically when the approved field changes from false to true. | ||
// | ||
// +optional | ||
ApprovedAt *metav1.Time `json:"approvedAt,omitempty"` |
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.
Better suited for a status field/condition?
I'd suggest going the direction of a status condition instead of a field because you would automatically get the transition time when you flip the Approved
status condition to the True
state.
// ClusterExtension to trigger the upgrade to this version. | ||
// | ||
// +optional | ||
Approved bool `json:"approved,omitempty"` |
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.
Don't use a boolean. It is strongly encouraged to avoid the use of booleans because they often evolve beyond the true/false value.
Use an enum instead that allows the empty string for the unset case.
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:MaxLength:=253 | ||
// +kubebuilder:validation:XValidation:rule="self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\")",message="name must be a valid DNS1123 subdomain" |
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 a heads up that users can't see these validations in the generated documentation so it is strongly encouraged to explicitly include them in plain english sentences in the GoDoc.
|
||
// ClusterExtensionRevisionStatus defines the observed state of ClusterExtensionRevision | ||
type ClusterExtensionRevisionStatus struct { | ||
// conditions represent the latest available observations of the ClusterExtensionRevision's current state. |
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.
If you know the condition types you'll be using, it can be helpful for users to include them in the GoDoc so that they can use tools like kubectl explain ...
and get that information included.
// status represents the current status of this ClusterExtensionRevision. | ||
// | ||
// +optional | ||
Status ClusterExtensionRevisionStatus `json:"status,omitempty"` |
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.
Should be a pointer
bca3b28
to
9817f9a
Compare
9817f9a
to
2c5e338
Compare
Description
ClusterExtension
is created with a pinned versionthe
ClusterExtension
is installed and noCluterExtensionRevision
is createdClusterExtension
is created with a version rangethe latest from that version range is installed (existing behavior, using the resolver)
When the
ClusterExtension
is edited to change the version range from>=0.28.0 <=0.31.1
to>=0.28.0 <=0.32.0
a
ClusterExtensionRevision
is created for the new available version (notifying that an upgrade is available)Once the approval is granted (manually for now, until the Policy API is implemented and automatic upgrades for CRDs that pass the default allowed upgrade clauses on cluster is in place), the
ClusterExtension
is upgraded (ieClusterExtension
waits for approval while an upgrade is available):Once the upgrade is successful, the
ClusterExtensionRevision
is cleaned up:Current:
With this PR:
With the Policy API
Reviewer Checklist