Skip to content

Conversation

sttts
Copy link

@sttts sttts commented May 15, 2018

In the normal scheme we know the full set of registered GVKs of a given object in convertToVersion (https://github.com/sttts/kubernetes/blob/c5445d3c56e06ab366b9cca34bd69c5cc386ec47/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go#L542). In the case of Unstructured, we have no clue. By setting the GVK in the object we get this information.

Native types' NewFuncs() only return the internal object. For the upper reason this is enough to get the API group.

func newREST(resource schema.GroupResource, kind, listKind schema.GroupVersionKind, strategy customResourceStrategy, optsGetter generic.RESTOptionsGetter, categories []string, tableConvertor rest.TableConvertor) (*REST, *StatusREST) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &unstructured.Unstructured{} },
NewFunc: func() runtime.Object {
Copy link
Author

Choose a reason for hiding this comment

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

alternatively we could change convertToVersion to know the GVK instead of deriving it from the Unstructured object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants