mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #16086 from jackgr/conditional_annotation
Auto commit by PR queue bot
This commit is contained in:
commit
e97483ae7b
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user