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
05666fe6
Commit
05666fe6
authored
Feb 15, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20846 from deads2k/fix-groupmapping-order
Auto commit by PR queue bot
parents
b1dedc09
f89bd836
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
registered.go
pkg/apimachinery/registered/registered.go
+14
-12
versioning.go
pkg/runtime/serializer/versioning/versioning.go
+8
-0
No files found.
pkg/apimachinery/registered/registered.go
View file @
05666fe6
...
...
@@ -114,22 +114,24 @@ func IsEnabledVersion(v unversioned.GroupVersion) bool {
return
found
}
// EnabledVersions returns all enabled versions.
func
EnabledVersions
()
(
ret
[]
unversioned
.
GroupVersion
)
{
for
v
:=
range
enabledVersions
{
ret
=
append
(
ret
,
v
)
// EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups
// are priority order from best to worst
func
EnabledVersions
()
[]
unversioned
.
GroupVersion
{
ret
:=
[]
unversioned
.
GroupVersion
{}
for
_
,
groupMeta
:=
range
groupMetaMap
{
ret
=
append
(
ret
,
groupMeta
.
GroupVersions
...
)
}
return
return
ret
}
// EnabledVersionsForGroup returns all enabled versions for a group.
func
EnabledVersionsForGroup
(
group
string
)
(
ret
[]
unversioned
.
GroupVersion
)
{
for
v
:=
range
enabledVersions
{
if
v
.
Group
==
group
{
ret
=
append
(
ret
,
v
)
}
// EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst
func
EnabledVersionsForGroup
(
group
string
)
[]
unversioned
.
GroupVersion
{
groupMeta
,
ok
:=
groupMetaMap
[
group
]
if
!
ok
{
return
[]
unversioned
.
GroupVersion
{}
}
return
return
append
([]
unversioned
.
GroupVersion
{},
groupMeta
.
GroupVersions
...
)
}
// Group returns the metadata of a group if the gruop is registered, otherwise
...
...
pkg/runtime/serializer/versioning/versioning.go
View file @
05666fe6
...
...
@@ -57,12 +57,20 @@ func NewCodec(
if
encodeVersion
!=
nil
{
internal
.
encodeVersion
=
make
(
map
[
string
]
unversioned
.
GroupVersion
)
for
_
,
v
:=
range
encodeVersion
{
// first one for a group wins. This is consistent with best to worst order throughout the codebase
if
_
,
ok
:=
internal
.
encodeVersion
[
v
.
Group
];
ok
{
continue
}
internal
.
encodeVersion
[
v
.
Group
]
=
v
}
}
if
decodeVersion
!=
nil
{
internal
.
decodeVersion
=
make
(
map
[
string
]
unversioned
.
GroupVersion
)
for
_
,
v
:=
range
decodeVersion
{
// first one for a group wins. This is consistent with best to worst order throughout the codebase
if
_
,
ok
:=
internal
.
decodeVersion
[
v
.
Group
];
ok
{
continue
}
internal
.
decodeVersion
[
v
.
Group
]
=
v
}
}
...
...
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