Merge pull request #62744 from liggitt/describe-cronjob

Automatic merge from submit-queue (batch tested with PRs 60201, 62744). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix kubectl describe cronjob

CronJob describer was attempting to use the internal batch clientset, which speaks to the batch/v1 API group. CronJobs do not exist in that API group.
This commit is contained in:
Kubernetes Submit Queue
2018-04-18 07:58:19 -07:00
committed by GitHub
5 changed files with 32 additions and 31 deletions

View File

@@ -166,16 +166,14 @@ func (f *ring1Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (
func (f *ring1Factory) Describer(mapping *meta.RESTMapping) (printers.Describer, error) {
clientset, err := f.clientAccessFactory.ClientSet()
if err != nil {
// if we can't make a client for this group/version, go generic if possible
if genericDescriber, genericErr := genericDescriber(f.clientAccessFactory, mapping); genericErr == nil {
return genericDescriber, nil
}
// otherwise return the original error
return nil, err
}
externalclientset, err := f.clientAccessFactory.KubernetesClientSet()
if err != nil {
return nil, err
}
// try to get a describer
if describer, ok := printersinternal.DescriberFor(mapping.GroupVersionKind.GroupKind(), clientset); ok {
if describer, ok := printersinternal.DescriberFor(mapping.GroupVersionKind.GroupKind(), clientset, externalclientset); ok {
return describer, nil
}
// if this is a kind we don't have a describer for yet, go generic if possible