Skip to content

Conversation

@fabriziopandini
Copy link
Member

What this PR does / why we need it:
Add new lifecycle hooks / change existing hooks as defined by the lifecycle hooks proposal.

Which issue(s) this PR fixes:
Rif #12720

@fabriziopandini fabriziopandini added the area/runtime-sdk Issues or PRs related to Runtime SDK label Oct 20, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 20, 2025
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 20, 2025
@fabriziopandini fabriziopandini force-pushed the add-chained-upgrade-lifecyclehooks branch 2 times, most recently from e8af4c6 to 44888d3 Compare October 22, 2025 13:21
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why diff is so bad 😓
what I did is

  • minor adjustments to TestComputeControlPlaneVersion
  • drop TestComputeControlPlaneVersion_callAfterControlPlaneUpgrade and TestComputeControlPlaneVersion_callBeforeClusterUpgrade_trackIntentOfCallingAfterClusterUpgrade because they are replaced by the new test in lifecycle_hooks_test.go

Copy link
Member

Choose a reason for hiding this comment

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

Looks better if you enable "ignore whitespace diff"

@fabriziopandini fabriziopandini force-pushed the add-chained-upgrade-lifecyclehooks branch from 44888d3 to cae6d82 Compare October 22, 2025 13:27
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@fabriziopandini fabriziopandini force-pushed the add-chained-upgrade-lifecyclehooks branch from cae6d82 to 21b0d44 Compare October 23, 2025 19:52
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

Copy link
Member

Choose a reason for hiding this comment

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

Looks better if you enable "ignore whitespace diff"

}

func validateHookRequest(request runtimehooksv1.RequestObject, wantRequest runtimehooksv1.RequestObject) error {
if request, ok := request.(*runtimehooksv1.BeforeClusterUpgradeRequest); ok {
Copy link
Member

Choose a reason for hiding this comment

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

Why can't this just be a simple compare between two types? (e.g. with cmp.Diff)

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not use cmp.diff because there was already specific code to validate the cluster parameter in the request and I did not want to loose this coverage, so I extended it to validate specifically the additional parameters we care about for each request types

Copy link
Member

@sbueringer sbueringer Oct 28, 2025

Choose a reason for hiding this comment

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

Setting Cluster to equal and then using cmp.Diff seems much safer to me

Let's remember to extend this check when we introduce new fields to the types

@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Oct 28, 2025
@sbueringer
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 28, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 09871b784dc24e0ea897c3c07b1bb2b517f53056

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 28, 2025
@k8s-ci-robot k8s-ci-robot merged commit 0c94cde into kubernetes-sigs:main Oct 28, 2025
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/runtime-sdk Issues or PRs related to Runtime SDK cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants