I'm getting around with the unstructured api
client := kubernetes.NewForConfig(rest.InClusterConfig())
groupResourceVersion := schema.GroupVersionResource{
Group: unstruct.GetObjectKind().GroupVersionKind().Group,
Version: unstruct.GetObjectKind().GroupVersionKind().Version,
Resource: unstruct.GetObjectKind().GroupVersionKind().Kind, // Resource == Kind ??
}
client.Resource(groupResourceVersion).Create(
ctx,
unstruct,
metav1.CreateOptions{},
)
How do you map a GroupVersionKind to GroupVersionResource?
Answering my own question, it seems that a REST call using
restmapperis needed: