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

✨ enable conversion webhook by default #427

Merged

Conversation

droot
Copy link
Contributor

@droot droot commented May 14, 2019

This PR enables conversion webhook by default.

It also logs a warning at startup if a type is a multi-version and doesn't implement conversion. Users will get a false-positive if they build a controller for non-managed multi-version types. Looking for ideas to handle it better.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 14, 2019
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 14, 2019
@droot droot force-pushed the feature/enable-conversion-webhook branch from 3a254c3 to 09c23f1 Compare May 14, 2019 19:48
return err
err = conversion.CheckConvertibility(blder.mgr.GetScheme(), blder.apiType)
if err != nil {
log.Error(err, "conversion check failed", "GVK", gvk)
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm concerned that this error is going to be a bit spam-y for non-conversion cases (e.g. built-ins). Maybe we should have an explicit opt-in on the builder?

Copy link
Contributor

Choose a reason for hiding this comment

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

for posterity:

  • error out if there's a partial implementation (hub w/o spokes, spokes w/o hub, partial set of spokes, multiple hubs, etc)
  • log on success at V(1).Info("conversioned enabled for kind", "kind", groupKind, "hub", hubVersion, "spokes", spokeVersions) so that people can look for that line to debug too, or check for it's absence if they've failed to implement anything.

Copy link
Member

@mengqiy mengqiy May 15, 2019

Choose a reason for hiding this comment

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

i'm concerned that this error is going to be a bit spam-y for non-conversion cases (e.g. built-ins).

If kube-apiserver sends us conversion requests for built-ins, it means there is a bug in kube-apiserver, right?

EDIT: nvm. Sunil explained to me.

@droot droot force-pushed the feature/enable-conversion-webhook branch from 09c23f1 to baffe2d Compare May 15, 2019 21:53
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2019
Expect(err).NotTo(HaveOccurred())
})

It("should not return error for a built-in multi-version type", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably have a test for the error case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we should. It requires adding new type definitions (with partial conversion implementation), I will do that in a follow up PR.

@droot droot force-pushed the feature/enable-conversion-webhook branch from baffe2d to 8da12a6 Compare May 16, 2019 18:01
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2019
Copy link
Contributor Author

@droot droot left a comment

Choose a reason for hiding this comment

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

Cleaned up the go.mod/sum files. Ready to go now.

Expect(err).NotTo(HaveOccurred())
})

It("should not return error for a built-in multi-version type", func() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we should. It requires adding new type definitions (with partial conversion implementation), I will do that in a follow up PR.

@DirectXMan12
Copy link
Contributor

/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 May 16, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12, droot

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 merged commit b026aaa into kubernetes-sigs:master May 16, 2019
DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
change import path to use vanity URL sigs.k8s.io
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants