-
Notifications
You must be signed in to change notification settings - Fork 84
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
[Issue] no kind "CronTab" is registered for version "stable.example.com/v1" #17
Comments
Thanks for raising this @yang-wang11 and I'm unsure I follow what exactly your steps were. You mentioned |
@mhausenblas @sttts yes, I follow the book step by step(chapter 4-5). I did the following changes:
you may see below code generated from var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
stablev1.AddToScheme,
}
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
} I tried to force execute its init function. the error does seem not to disappear. _ "typedClient/client/clientset/versioned/scheme" |
Note the different spelling: CronTab vs. Crontab. The scheme has the latter, the clients wants the former. |
Is this a copy-and-pasted error message? Am not sure where client-gen gets the CronTab type from. It is based on the Go type, not the CRD yaml. Hence, it should print a "Crontab" error, not "CronTab" 🤔 |
@sttts thanks for the help.
|
If you add a type to a scheme, its Go type name is used as kind (via reflection). Now I also understand what is going on. You are getting a CronTab from the server and the client tries to find a CronTab in its scheme. It only finds a Crontab, which is not helpful. So the server returns an unexpected object. Those two have to match. Where |
yes, this error message copy from the console. |
@sttts @mhausenblas thanks for the help. it works. |
I made a copy from cnat to
crontab
, below is its definition of CRDthe code of types.go
and the code of register.go
after the command
generate-groups.sh "deepcopy,client,informer,lister"
be executed, following code raise an errorthe error message was
however the kind
CronTab
has already been registered inregister.go
, not sure why it happened. is there anyone who can help on that? thanks.The text was updated successfully, but these errors were encountered: