Skip to content

Commit

Permalink
Merge pull request #50012 from deads2k/cli-17-discovery
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

use specified discovery information if possible

Fixes kubernetes/kubernetes#49948

This uses the available discovery information if available, but it seems we never updated "normal" resources to show the singular name, so its often not available.  I've left this code compatible.

@enisoc @ash2k 
@kubernetes/sig-api-machinery-misc 

```release-note
custom resources that use unconventional pluralization now work properly with kubectl and garbage collection
```

Kubernetes-commit: e190f391129260527c119fe319216212c916ae5d
  • Loading branch information
k8s-publish-robot committed Sep 15, 2017
2 parents 1168e53 + 3655f86 commit 7a5075a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/api/meta/restmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ func NewDefaultRESTMapper(defaultGroupVersions []schema.GroupVersion, f VersionI

func (m *DefaultRESTMapper) Add(kind schema.GroupVersionKind, scope RESTScope) {
plural, singular := UnsafeGuessKindToResource(kind)
m.AddSpecific(kind, plural, singular, scope)
}

func (m *DefaultRESTMapper) AddSpecific(kind schema.GroupVersionKind, plural, singular schema.GroupVersionResource, scope RESTScope) {
m.singularToPlural[singular] = plural
m.pluralToSingular[plural] = singular

Expand Down

0 comments on commit 7a5075a

Please sign in to comment.