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
8b34e0ed
Unverified
Commit
8b34e0ed
authored
Dec 09, 2016
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make --record compute patch using versioned object
parent
12806be2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
helpers.go
pkg/kubectl/cmd/util/helpers.go
+10
-4
No files found.
pkg/kubectl/cmd/util/helpers.go
View file @
8b34e0ed
...
...
@@ -523,18 +523,24 @@ func RecordChangeCause(obj runtime.Object, changeCause string) error {
// ChangeResourcePatch creates a strategic merge patch between the origin input resource info
// and the annotated with change-cause input resource info.
func
ChangeResourcePatch
(
info
*
resource
.
Info
,
changeCause
string
)
([]
byte
,
error
)
{
oldData
,
err
:=
json
.
Marshal
(
info
.
Object
)
// Get a versioned object
obj
,
err
:=
info
.
Mapping
.
ConvertToVersion
(
info
.
Object
,
info
.
Mapping
.
GroupVersionKind
.
GroupVersion
())
if
err
!=
nil
{
return
nil
,
err
}
if
err
:=
RecordChangeCause
(
info
.
Object
,
changeCause
);
err
!=
nil
{
oldData
,
err
:=
json
.
Marshal
(
obj
)
if
err
!=
nil
{
return
nil
,
err
}
if
err
:=
RecordChangeCause
(
obj
,
changeCause
);
err
!=
nil
{
return
nil
,
err
}
newData
,
err
:=
json
.
Marshal
(
info
.
Object
)
newData
,
err
:=
json
.
Marshal
(
obj
)
if
err
!=
nil
{
return
nil
,
err
}
return
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
info
.
Object
)
return
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
obj
)
}
// containsChangeCause checks if input resource info contains change-cause annotation.
...
...
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