Apply: Migration from CSA to SSA: set the operation to Apply

If we don't, the (kops,Update) managed blocks are treated as different
from the (kops,Apply) block.  This causes conflicts when the two
blocks specific incompatible values.

Issue #14520 (I believe it is the fix!)
This commit is contained in:
justinsb 2022-11-22 08:12:00 -05:00
parent 46d33317a4
commit 32cb151419
1 changed files with 5 additions and 0 deletions

View File

@ -191,6 +191,11 @@ func createManagedFieldPatch(currentObject *unstructured.Unstructured) ([]byte,
fixedManagedField := managedField.DeepCopy()
if managedField.Manager == "kubectl-edit" || managedField.Manager == "kubectl-client-side-apply" {
fixedManagedField.Manager = "kops"
fixedManagedField.Operation = "Apply"
}
// In case we have a kops & Update manager
if fixedManagedField.Manager == "kops" && fixedManagedField.Operation == "Update" {
fixedManagedField.Operation = "Apply"
}
fixedManagedFields = append(fixedManagedFields, *fixedManagedField)
}