-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,3 +200,39 @@ var _ = Describe("Conversion Webhook", func() { | |
}) | ||
|
||
}) | ||
|
||
var _ = Describe("Convertibility Check", func() { | ||
|
||
var scheme *runtime.Scheme | ||
|
||
BeforeEach(func() { | ||
|
||
scheme = kscheme.Scheme | ||
Expect(jobsapis.AddToScheme(scheme)).To(Succeed()) | ||
|
||
}) | ||
|
||
It("should not return error for convertible types", func() { | ||
obj := &jobsv2.ExternalJob{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "ExternalJob", | ||
APIVersion: "jobs.example.org/v2", | ||
}, | ||
} | ||
|
||
err := CheckConvertibility(scheme, obj) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
It("should not return error for a built-in multi-version type", func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably have a test for the error case There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
obj := &appsv1beta1.Deployment{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "Deployment", | ||
APIVersion: "apps/v1beta1", | ||
}, | ||
} | ||
|
||
err := CheckConvertibility(scheme, obj) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for posterity:
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.