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
e97483ae
Commit
e97483ae
authored
Oct 26, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16086 from jackgr/conditional_annotation
Auto commit by PR queue bot
parents
03583fb8
08b22751
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
apply.go
pkg/kubectl/apply.go
+12
-3
No files found.
pkg/kubectl/apply.go
View file @
e97483ae
...
@@ -163,16 +163,25 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error
...
@@ -163,16 +163,25 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error
return
modified
,
nil
return
modified
,
nil
}
}
// If the last applied configuration annotation is already present, then
// UpdateApplyAnnotation gets the modified configuration of the object,
// UpdateApplyAnnotation gets the modified configuration of the object,
// without embedding it again, and then sets it on the object as the annotation.
// without embedding it again, and then sets it on the object as the annotation.
// Otherwise, it does nothing.
func
UpdateApplyAnnotation
(
info
*
resource
.
Info
)
error
{
func
UpdateApplyAnnotation
(
info
*
resource
.
Info
)
error
{
modified
,
err
:=
GetModifiedConfiguration
(
info
,
false
)
original
,
err
:=
GetOriginalConfiguration
(
info
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
SetOriginalConfiguration
(
info
,
modified
);
err
!=
nil
{
if
len
(
original
)
>
0
{
return
err
modified
,
err
:=
GetModifiedConfiguration
(
info
,
false
)
if
err
!=
nil
{
return
err
}
if
err
:=
SetOriginalConfiguration
(
info
,
modified
);
err
!=
nil
{
return
err
}
}
}
return
nil
return
nil
...
...
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