FieldManager: Use actual version object rather than "v1"

Currently, the version is hard-coded to v1, let's use the actual version
of the object so that conversion will happen properly.
This commit is contained in:
Antoine Pelisse
2018-12-15 07:40:56 -08:00
parent d9cb621aef
commit 19ab44dbe9

View File

@@ -89,8 +89,7 @@ func (f *FieldManager) Update(liveObj, newObj runtime.Object, manager string) (r
if err != nil {
return nil, fmt.Errorf("failed to create typed live object: %v", err)
}
// TODO: We don't support multiple versions yet.
apiVersion := fieldpath.APIVersion("v1")
apiVersion := fieldpath.APIVersion(f.groupVersion.String())
managed, err = f.updater.Update(liveObjTyped, newObjTyped, apiVersion, managed, manager)
if err != nil {
return nil, fmt.Errorf("failed to update ManagedFields: %v", err)
@@ -129,8 +128,7 @@ func (f *FieldManager) Apply(liveObj runtime.Object, patch []byte, force bool) (
if err != nil {
return nil, fmt.Errorf("failed to create typed live object: %v", err)
}
// TODO: We don't support multiple versions yet.
apiVersion := fieldpath.APIVersion("v1")
apiVersion := fieldpath.APIVersion(f.groupVersion.String())
newObjTyped, managed, err := f.updater.Apply(liveObjTyped, patchObjTyped, apiVersion, managed, applyManager, force)
if err != nil {
return nil, err