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
6f76247e
Commit
6f76247e
authored
May 24, 2018
by
xuzhonghu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace `__internal` with runtime.APIVersionInternal
parent
481b2dc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
scheme.go
staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go
+1
-1
versioning_test.go
...nery/pkg/runtime/serializer/versioning/versioning_test.go
+8
-8
No files found.
staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go
View file @
6f76247e
...
@@ -122,7 +122,7 @@ func (s *Scheme) nameFunc(t reflect.Type) string {
...
@@ -122,7 +122,7 @@ func (s *Scheme) nameFunc(t reflect.Type) string {
for
_
,
gvk
:=
range
gvks
{
for
_
,
gvk
:=
range
gvks
{
internalGV
:=
gvk
.
GroupVersion
()
internalGV
:=
gvk
.
GroupVersion
()
internalGV
.
Version
=
"__internal"
// this is hacky and maybe should be passed in
internalGV
.
Version
=
APIVersionInternal
// this is hacky and maybe should be passed in
internalGVK
:=
internalGV
.
WithKind
(
gvk
.
Kind
)
internalGVK
:=
internalGV
.
WithKind
(
gvk
.
Kind
)
if
internalType
,
exists
:=
s
.
gvkToType
[
internalGVK
];
exists
{
if
internalType
,
exists
:=
s
.
gvkToType
[
internalGVK
];
exists
{
...
...
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning_test.go
View file @
6f76247e
...
@@ -129,25 +129,25 @@ func TestDecode(t *testing.T) {
...
@@ -129,25 +129,25 @@ func TestDecode(t *testing.T) {
}{
}{
{
{
serializer
:
&
mockSerializer
{
actual
:
gvk1
},
serializer
:
&
mockSerializer
{
actual
:
gvk1
},
convertor
:
&
checkConvertor
{
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
}},
convertor
:
&
checkConvertor
{
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
}},
expectedGVK
:
gvk1
,
expectedGVK
:
gvk1
,
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
},
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
},
},
},
{
{
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
}},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
}},
expectedGVK
:
gvk1
,
expectedGVK
:
gvk1
,
sameObject
:
decodable2
,
sameObject
:
decodable2
,
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
},
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
},
},
},
// defaultGVK.Group is allowed to force a conversion to the destination group
// defaultGVK.Group is allowed to force a conversion to the destination group
{
{
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
defaultGVK
:
&
schema
.
GroupVersionKind
{
Group
:
"force"
},
defaultGVK
:
&
schema
.
GroupVersionKind
{
Group
:
"force"
},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"force"
,
Version
:
"__internal"
}},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"force"
,
Version
:
runtime
.
APIVersionInternal
}},
expectedGVK
:
gvk1
,
expectedGVK
:
gvk1
,
sameObject
:
decodable2
,
sameObject
:
decodable2
,
decodes
:
schema
.
GroupVersion
{
Group
:
"force"
,
Version
:
"__internal"
},
decodes
:
schema
.
GroupVersion
{
Group
:
"force"
,
Version
:
runtime
.
APIVersionInternal
},
},
},
// uses direct conversion for into when objects differ
// uses direct conversion for into when objects differ
{
{
...
@@ -184,10 +184,10 @@ func TestDecode(t *testing.T) {
...
@@ -184,10 +184,10 @@ func TestDecode(t *testing.T) {
into
:
&
runtime
.
VersionedObjects
{
Objects
:
[]
runtime
.
Object
{}},
into
:
&
runtime
.
VersionedObjects
{
Objects
:
[]
runtime
.
Object
{}},
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
serializer
:
&
mockSerializer
{
actual
:
gvk1
,
obj
:
decodable1
},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
}},
convertor
:
&
checkConvertor
{
in
:
decodable1
,
obj
:
decodable2
,
groupVersion
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
}},
expectedGVK
:
gvk1
,
expectedGVK
:
gvk1
,
expectedObject
:
&
runtime
.
VersionedObjects
{
Objects
:
[]
runtime
.
Object
{
decodable1
,
decodable2
}},
expectedObject
:
&
runtime
.
VersionedObjects
{
Objects
:
[]
runtime
.
Object
{
decodable1
,
decodable2
}},
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
"__internal"
},
decodes
:
schema
.
GroupVersion
{
Group
:
"other"
,
Version
:
runtime
.
APIVersionInternal
},
},
},
// decode into the same version as the serialized object
// decode into the same version as the serialized object
...
...
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