Skip to content
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

✨ Implement library for topology mutation hooks implementation #7413

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR moves some of the utilities from our test extension into a library that every Runtime extension author can use.

It also adds comments to the test extension so all the implementation choices are explained and the Runtime extension authors can use it as a reference implementation for their own extension

Which issue(s) this PR fixes:
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 17, 2022
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 17, 2022
@@ -336,7 +336,7 @@ func (c *client) CallExtension(ctx context.Context, hook runtimecatalog.Hook, fo
}

log.Info(fmt.Sprintf("Calling extension handler %q", name))
var timeoutDuration time.Duration
timeoutDuration := runtimehooksv1.DefaultHandlersTimeoutSeconds * time.Second
Copy link
Member Author

Choose a reason for hiding this comment

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

This is consistent with what declared in the API

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can actaully dorp this nil check here. Becasue of the defaulting we have in discovery response this value can never be nill.

We should use this value runtimehooksv1.DefaultHandlersTimeoutSeconds at l.622 to set the default value.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed line 622
I think we should left the defaulting here even if it is redundant (thinking to clusterctl alpha plan, where we are going to use a "hacky version" if discovery)

}
aggregatedResponse.SetMessage(strings.Join(messages, ", "))
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 know we want back and forth on this but if the extension's errors do not surface the UX degrades a lot.
So I'm proposing to surface errors, document guidelines for error messages, and take time to implement a protection mechanism for flickering conditions

@fabriziopandini fabriziopandini changed the title ✨ Implement library for topology mutation hooks implementation [WIP] ✨ Implement library for topology mutation hooks implementation Oct 17, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2022
@@ -336,7 +336,7 @@ func (c *client) CallExtension(ctx context.Context, hook runtimecatalog.Hook, fo
}

log.Info(fmt.Sprintf("Calling extension handler %q", name))
var timeoutDuration time.Duration
timeoutDuration := runtimehooksv1.DefaultHandlersTimeoutSeconds * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can actaully dorp this nil check here. Becasue of the defaulting we have in discovery response this value can never be nill.

We should use this value runtimehooksv1.DefaultHandlersTimeoutSeconds at l.622 to set the default value.

exp/runtime/server/server.go Show resolved Hide resolved
exp/runtime/server/server.go Outdated Show resolved Hide resolved
internal/runtime/client/client.go Show resolved Hide resolved
test/extension/handlers/lifecycle/handlers.go Outdated Show resolved Hide resolved
@fabriziopandini fabriziopandini force-pushed the implement-topologymutation-library branch from f16942c to 0f042d5 Compare November 3, 2022 16:54
@fabriziopandini fabriziopandini changed the title [WIP] ✨ Implement library for topology mutation hooks implementation ✨ Implement library for topology mutation hooks implementation Nov 3, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 3, 2022
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Great work

@fabriziopandini
Copy link
Member Author

/retest

test/extension/main.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

lgtm pending #7413 (comment) + squash

@fabriziopandini fabriziopandini force-pushed the implement-topologymutation-library branch from 05038a9 to b6e824c Compare November 9, 2022 19:54
@sbueringer
Copy link
Member

Thx!

/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 Nov 10, 2022
@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 Nov 10, 2022
@k8s-ci-robot k8s-ci-robot merged commit 7662604 into kubernetes-sigs:main Nov 10, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Nov 10, 2022
@fabriziopandini fabriziopandini deleted the implement-topologymutation-library branch November 21, 2022 11:49
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants