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
4394bf77
Commit
4394bf77
authored
Mar 05, 2019
by
Kevin Wiesmüller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change managedFields sort order to oldest first
parent
081ccdc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
managedfields.go
...endpoints/handlers/fieldmanager/internal/managedfields.go
+1
-1
managedfields_test.go
...ints/handlers/fieldmanager/internal/managedfields_test.go
+13
-13
No files found.
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal/managedfields.go
View file @
4394bf77
...
...
@@ -161,7 +161,7 @@ func sortEncodedManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry)
return
false
}
if
!
p
.
Time
.
Equal
(
q
.
Time
)
{
return
q
.
Time
.
Before
(
p
.
Time
)
return
p
.
Time
.
Before
(
q
.
Time
)
}
return
p
.
Manager
<
q
.
Manager
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal/managedfields_test.go
View file @
4394bf77
...
...
@@ -31,14 +31,7 @@ import (
// (api format) to the format used by sigs.k8s.io/structured-merge-diff and back
func
TestRoundTripManagedFields
(
t
*
testing
.
T
)
{
tests
:=
[]
string
{
`- apiVersion: v1beta1
fields:
i:5:
f:i: {}
manager: foo
operation: Update
time: "2011-12-13T14:15:16Z"
- apiVersion: v1
`- apiVersion: v1
fields:
v:3:
f:alsoPi: {}
...
...
@@ -49,6 +42,13 @@ func TestRoundTripManagedFields(t *testing.T) {
manager: foo
operation: Update
time: "2001-02-03T04:05:06Z"
- apiVersion: v1beta1
fields:
i:5:
f:i: {}
manager: foo
operation: Update
time: "2011-12-13T14:15:16Z"
`
,
`- apiVersion: v1
fields:
...
...
@@ -240,7 +240,7 @@ func TestSortEncodedManagedFields(t *testing.T) {
},
},
{
name
:
"newest
fir
st"
,
name
:
"newest
la
st"
,
managedFields
:
[]
metav1
.
ManagedFieldsEntry
{
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
{
Manager
:
"a"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
...
...
@@ -250,8 +250,8 @@ func TestSortEncodedManagedFields(t *testing.T) {
expected
:
[]
metav1
.
ManagedFieldsEntry
{
{
Manager
:
"a"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"b"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
},
},
{
...
...
@@ -259,14 +259,14 @@ func TestSortEncodedManagedFields(t *testing.T) {
managedFields
:
[]
metav1
.
ManagedFieldsEntry
{
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
{
Manager
:
"a"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"d"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"200
2
-01-01T01:00:00Z"
)},
{
Manager
:
"d"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"200
1
-01-01T01:00:00Z"
)},
{
Manager
:
"b"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
},
expected
:
[]
metav1
.
ManagedFieldsEntry
{
{
Manager
:
"a"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"b"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"d"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
{
Manager
:
"d"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
},
},
{
...
...
@@ -282,10 +282,10 @@ func TestSortEncodedManagedFields(t *testing.T) {
expected
:
[]
metav1
.
ManagedFieldsEntry
{
{
Manager
:
"a"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"b"
,
Operation
:
metav1
.
ManagedFieldsOperationApply
,
Time
:
nil
},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
{
Manager
:
"d"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
{
Manager
:
"e"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
{
Manager
:
"f"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2002-01-01T01:00:00Z"
)},
{
Manager
:
"c"
,
Operation
:
metav1
.
ManagedFieldsOperationUpdate
,
Time
:
parseTimeOrPanic
(
"2001-01-01T01:00:00Z"
)},
},
},
}
...
...
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