interface: start/stop API for updateRun#314
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
.github/.copilot/breadcrumbs/2025-10-29-1500-start-stop-updaterun-api.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
e48206a to
96621fc
Compare
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
| // +kubebuilder:validation:Optional | ||
| // +kubebuilder:validation:Enum=NotStarted;Started;Stopped;Abandoned | ||
| // +kubebuilder:default=NotStarted | ||
| State State `json:"state"` |
There was a problem hiding this comment.
we need to guard against a few invalid state transition like start -> NotStarted. Abandoned->* it seems CEL can do that?
There was a problem hiding this comment.
we also need to block any run that start with other than "NotStarted" state. I am not even sure if this is something that user should set. It seems like every run always starts with this state so there is no need for user to specify this state ever.
There was a problem hiding this comment.
as the previous vesion shows, NotStarted is more like a status than a state.
There was a problem hiding this comment.
Other alternative suggested by AI Pending or Ready.
But AI seems to think NotStarted already offers Explicit Intent Declaration from the user
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
|
|
||
| // UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated. | ||
| // It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object. | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'NotStarted' || self.state != 'Stopped'",message="invalid state transition: cannot transition from NotStarted to Stopped" |
There was a problem hiding this comment.
would the logic blow more straightforward to read?
rule="!(has(oldSelf.state) && oldSelf.state == 'NotStarted' && self.state == 'Stopped')"
| // UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated. | ||
| // It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object. | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'NotStarted' || self.state != 'Stopped'",message="invalid state transition: cannot transition from NotStarted to Stopped" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Started' || self.state != 'NotStarted'",message="invalid state transition: cannot transition from Started to NotStarted" |
There was a problem hiding this comment.
rule="!(has(oldSelf.state) && (oldSelf.state == 'Started' || oldSelf.state == 'Stopped' ) && self.state == 'Notstarted')"
| // Started: The update run should execute or resume execution. | ||
| // Stopped: The update run should pause execution. | ||
| // Abandoned: The update run should be abandoned and terminated. | ||
| // +kubebuilder:validation:Optional |
There was a problem hiding this comment.
I wonder why the validation is optional?
There was a problem hiding this comment.
Users allowed to not specify state, so we can apply the default state
Description of your changes
This PR aims to add new API changes to allow users to set the following intent on an updateRun,
Adding a new spec field called state which is an enum
Adding another condition type for updateRun status called Abandoned
Fixes #
I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer