mirror of https://github.com/k3s-io/k3s
Update annotation only if apply already called.
parent
a702d5f29b
commit
08b2275129
|
@ -163,9 +163,17 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error
|
|||
return modified, nil
|
||||
}
|
||||
|
||||
// If the last applied configuration annotation is already present, then
|
||||
// UpdateApplyAnnotation gets the modified configuration of the object,
|
||||
// without embedding it again, and then sets it on the object as the annotation.
|
||||
// Otherwise, it does nothing.
|
||||
func UpdateApplyAnnotation(info *resource.Info) error {
|
||||
original, err := GetOriginalConfiguration(info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(original) > 0 {
|
||||
modified, err := GetModifiedConfiguration(info, false)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -174,6 +182,7 @@ func UpdateApplyAnnotation(info *resource.Info) error {
|
|||
if err := SetOriginalConfiguration(info, modified); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue