mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-24 14:12:18 +00:00
remove kubectl annotation logic from upgrade patch
adds unneccessary complexity. also discussed in SIG CLI meeting to keep annotation around for a while longer Kubernetes-commit: 0c055eae3c9eaea26574743f0623d6b0e9e3d6b4
This commit is contained in:
parent
3daf180aa6
commit
a45874a99b
@ -26,9 +26,7 @@ import (
|
|||||||
"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
|
"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
const csaAnnotationName = "kubectl.kubernetes.io/last-applied-configuration"
|
|
||||||
|
|
||||||
var csaAnnotationFieldSet = fieldpath.NewSet(fieldpath.MakePathOrDie("metadata", "annotations", csaAnnotationName))
|
|
||||||
|
|
||||||
// Upgrades the Manager information for fields managed with client-side-apply (CSA)
|
// Upgrades the Manager information for fields managed with client-side-apply (CSA)
|
||||||
// Prepares fields owned by `csaManager` for 'Update' operations for use now
|
// Prepares fields owned by `csaManager` for 'Update' operations for use now
|
||||||
@ -107,12 +105,8 @@ func UpgradeManagedFields(
|
|||||||
entry.Subresource == "")
|
entry.Subresource == "")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Wipe out last-applied-configuration annotation if it exists
|
|
||||||
annotations := accessor.GetAnnotations()
|
|
||||||
delete(annotations, csaAnnotationName)
|
|
||||||
|
|
||||||
// Commit changes to object
|
// Commit changes to object
|
||||||
accessor.SetAnnotations(annotations)
|
|
||||||
accessor.SetManagedFields(filteredManagers)
|
accessor.SetManagedFields(filteredManagers)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -154,10 +148,6 @@ func unionManagerIntoIndex(entries []metav1.ManagedFieldsEntry, targetIndex int,
|
|||||||
combinedFieldSet = combinedFieldSet.Union(&csaFieldSet)
|
combinedFieldSet = combinedFieldSet.Union(&csaFieldSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the resultant fieldset does not include the
|
|
||||||
// last applied annotation
|
|
||||||
combinedFieldSet = combinedFieldSet.Difference(csaAnnotationFieldSet)
|
|
||||||
|
|
||||||
// Encode the fields back to the serialized format
|
// Encode the fields back to the serialized format
|
||||||
err = encodeManagedFieldsEntrySet(&entries[targetIndex], *combinedFieldSet)
|
err = encodeManagedFieldsEntrySet(&entries[targetIndex], *combinedFieldSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user