Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b0b71111
Commit
b0b71111
authored
May 03, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apimachinery: rename meta.{ -> UnsafeGuess}KindToResource
parent
20df6100
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
scale_expansion.go
...ted/clientset/typed/extensions/v1beta1/scale_expansion.go
+2
-2
scale_expansion.go
...ntset/typed/extensions/internalversion/scale_expansion.go
+2
-2
thirdparty.go
pkg/master/thirdparty/thirdparty.go
+2
-2
codec.go
pkg/registry/extensions/thirdpartyresourcedata/codec.go
+1
-1
restmapper.go
staging/src/k8s.io/apimachinery/pkg/api/meta/restmapper.go
+3
-3
restmapper_test.go
...g/src/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go
+1
-1
scale_expansion.go
...go/kubernetes/typed/extensions/v1beta1/scale_expansion.go
+2
-2
No files found.
pkg/client/clientset_generated/clientset/typed/extensions/v1beta1/scale_expansion.go
View file @
b0b71111
...
...
@@ -34,7 +34,7 @@ func (c *scales) Get(kind string, name string) (result *v1beta1.Scale, err error
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
...
...
@@ -51,7 +51,7 @@ func (c *scales) Update(kind string, scale *v1beta1.Scale) (result *v1beta1.Scal
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Put
()
.
Namespace
(
scale
.
Namespace
)
.
...
...
pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/scale_expansion.go
View file @
b0b71111
...
...
@@ -34,7 +34,7 @@ func (c *scales) Get(kind string, name string) (result *extensions.Scale, err er
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
...
...
@@ -51,7 +51,7 @@ func (c *scales) Update(kind string, scale *extensions.Scale) (result *extension
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Put
()
.
Namespace
(
scale
.
Namespace
)
.
...
...
pkg/master/thirdparty/thirdparty.go
View file @
b0b71111
...
...
@@ -110,7 +110,7 @@ func (m *ThirdPartyResourceServer) HasThirdPartyResource(rsrc *extensions.ThirdP
if
entry
==
nil
{
return
false
,
nil
}
plural
,
_
:=
meta
.
KindToResource
(
schema
.
GroupVersionKind
{
plural
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
schema
.
GroupVersionKind
{
Group
:
group
,
Version
:
rsrc
.
Versions
[
0
]
.
Name
,
Kind
:
kind
,
...
...
@@ -258,7 +258,7 @@ func (m *ThirdPartyResourceServer) InstallThirdPartyResource(rsrc *extensions.Th
if
len
(
rsrc
.
Versions
)
==
0
{
return
fmt
.
Errorf
(
"ThirdPartyResource %s has no defined versions"
,
rsrc
.
Name
)
}
plural
,
_
:=
meta
.
KindToResource
(
schema
.
GroupVersionKind
{
plural
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
schema
.
GroupVersionKind
{
Group
:
group
,
Version
:
rsrc
.
Versions
[
0
]
.
Name
,
Kind
:
kind
,
...
...
pkg/registry/extensions/thirdpartyresourcedata/codec.go
View file @
b0b71111
...
...
@@ -74,7 +74,7 @@ type thirdPartyResourceDataMapper struct {
var
_
meta
.
RESTMapper
=
&
thirdPartyResourceDataMapper
{}
func
(
t
*
thirdPartyResourceDataMapper
)
getResource
()
schema
.
GroupVersionResource
{
plural
,
_
:=
meta
.
KindToResource
(
t
.
getKind
())
plural
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
t
.
getKind
())
return
plural
}
...
...
staging/src/k8s.io/apimachinery/pkg/api/meta/restmapper.go
View file @
b0b71111
...
...
@@ -116,7 +116,7 @@ func NewDefaultRESTMapper(defaultGroupVersions []schema.GroupVersion, f VersionI
}
func
(
m
*
DefaultRESTMapper
)
Add
(
kind
schema
.
GroupVersionKind
,
scope
RESTScope
)
{
plural
,
singular
:=
KindToResource
(
kind
)
plural
,
singular
:=
UnsafeGuess
KindToResource
(
kind
)
m
.
singularToPlural
[
singular
]
=
plural
m
.
pluralToSingular
[
plural
]
=
singular
...
...
@@ -136,10 +136,10 @@ var unpluralizedSuffixes = []string{
"endpoints"
,
}
// KindToResource converts Kind to a resource name.
//
UnsafeGuess
KindToResource converts Kind to a resource name.
// Broken. This method only "sort of" works when used outside of this package. It assumes that Kinds and Resources match
// and they aren't guaranteed to do so.
func
KindToResource
(
kind
schema
.
GroupVersionKind
)
(
/*plural*/
schema
.
GroupVersionResource
/*singular*/
,
schema
.
GroupVersionResource
)
{
func
UnsafeGuess
KindToResource
(
kind
schema
.
GroupVersionKind
)
(
/*plural*/
schema
.
GroupVersionResource
/*singular*/
,
schema
.
GroupVersionResource
)
{
kindName
:=
kind
.
Kind
if
len
(
kindName
)
==
0
{
return
schema
.
GroupVersionResource
{},
schema
.
GroupVersionResource
{}
...
...
staging/src/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go
View file @
b0b71111
...
...
@@ -485,7 +485,7 @@ func TestKindToResource(t *testing.T) {
for
i
,
testCase
:=
range
testCases
{
version
:=
schema
.
GroupVersion
{}
plural
,
singular
:=
KindToResource
(
version
.
WithKind
(
testCase
.
Kind
))
plural
,
singular
:=
UnsafeGuess
KindToResource
(
version
.
WithKind
(
testCase
.
Kind
))
if
singular
!=
version
.
WithResource
(
testCase
.
Singular
)
||
plural
!=
version
.
WithResource
(
testCase
.
Plural
)
{
t
.
Errorf
(
"%d: unexpected plural and singular: %v %v"
,
i
,
plural
,
singular
)
}
...
...
staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/scale_expansion.go
View file @
b0b71111
...
...
@@ -34,7 +34,7 @@ func (c *scales) Get(kind string, name string) (result *v1beta1.Scale, err error
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
...
...
@@ -51,7 +51,7 @@ func (c *scales) Update(kind string, scale *v1beta1.Scale) (result *v1beta1.Scal
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind
:=
schema
.
GroupVersionKind
{
Kind
:
kind
}
resource
,
_
:=
meta
.
KindToResource
(
fullyQualifiedKind
)
resource
,
_
:=
meta
.
UnsafeGuess
KindToResource
(
fullyQualifiedKind
)
err
=
c
.
client
.
Put
()
.
Namespace
(
scale
.
Namespace
)
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment