Skip to content

Conversation

@Arvindthiru
Copy link
Collaborator

@Arvindthiru Arvindthiru commented Oct 28, 2025

Description of your changes

  • Renaming AfterStageTask to StageTask just the struct to be reused by by both AfterStageTasks, BeforeStageTasks
  • Adding new optional field BeforeStageTasks to StageConfig
  • No breaking changes were introduced as part of the PR, all JSON names for updated fields remain the same

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@Arvindthiru Arvindthiru force-pushed the preStageApprovalAPI branch 2 times, most recently from de99f04 to 6b7e498 Compare October 29, 2025 19:56
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
@Arvindthiru Arvindthiru changed the title interface: beforeStageTasks for updateRun interface: beforeStageTask for updateRun Oct 29, 2025
@Arvindthiru Arvindthiru marked this pull request as ready for review October 29, 2025 20:09
// +kubebuilder:validation:Enum=TimedWait;Approval
// +kubebuilder:validation:Required
Type AfterStageTaskType `json:"type"`
Type StageTaskType `json:"type"`
Copy link
Collaborator

@britaniar britaniar Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM just worried about the name change. Wont existing updateRuns run into issues with this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we didn't change the json name "type". I verified in the CRD definition

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!


// The task that needs to be completed successfully before starting the stage.
// +kubebuilder:validation:Optional
BeforeStageTask *BeforeStageTask `json:"beforeStageTask,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to have more than one task?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible in the future, hence made BeforeStageTasks a list but we only support Approval as a BeforeStageTask so we currently only support one item within the list

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these changes not in yet?

Copy link
Collaborator Author

@Arvindthiru Arvindthiru Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are in as part of this commit d9bc4c7

}

// BeforeStageTask is the pre-stage task that needs to be completed before starting the stage.
type BeforeStageTask struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to create a different type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to StageTask for both BeforeStageTask, AfterStageTask

Arvind Thirumurugan added 4 commits October 30, 2025 11:57
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:Enum=TimedWait;Approval
// +kubebuilder:validation:Required
Type AfterStageTaskType `json:"type"`
Type StageTaskType `json:"type"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we didn't change the json name "type". I verified in the CRD definition

Copy link

@serbrech serbrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would really help if you clearly outlined in the PR description what APIs you are changing, what is the behavior expectation with existing data.
how defaulting and validation is handled, instead of leaving that to the reviewer.
It's not clear if what I infered from reading the code is the intended behavior.

Same with the change of type and why it's fine/what are the implications

type StageTask struct {
// The type of the before or after stage task.
// +kubebuilder:validation:Enum=TimedWait;Approval
// +kubebuilder:validation:Required
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you handle the fact that you are adding a new property that is required?
I would expect this to fail get+re-put of existing updateruns?
at least any client that does not bump the SDK will fail manipulating the updatrun object, as it won't be able to serialize the Type property?
Is there a way to configure defaults on added properties? is there a way to test this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this will work as existing updateruns would have no value, so it will get a default value on read of "TimedWait", which is the correct expectation.
new updateruns are required to specify the type because of validation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ia an existing object I'm re-naming for re-use

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Type property on the object is new, and is required.

@Arvindthiru Arvindthiru merged commit f136911 into kubefleet-dev:main Nov 3, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants