-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
Currently, there are two ways of registering conversion functions:
(1) Using AddConversionFuncs():
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go#L341
(2) Using AddConversionFunc()/AddGeneratedConversionFunc():
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go#L353
And what is extremely surprising, those registrations goes into two different and separate sets of conversions:
(a) The ones registered by (1), are NOT used at the top-level of conversions:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go#L494
(b) But as soon as you get into "default" mode (the reflection-based), the ones registered by (2) are NO LONGER used - only the ones from the first set are used:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go#L563
This is incredibly misleading, and I think is actually leading to couple places that I guess didn't mean to do that, e.g.:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/conversion.go#L29
We need to get rid of (1), and clean this stuff up.
@kubernetes/sig-api-machinery-bugs
@liggitt @deads2k @smarterclayton - FYI