@@ -31,7 +31,7 @@ import (
31
31
// Client has the methods required to update the storage version.
32
32
type Client interface {
33
33
Create (context.Context , * v1alpha1.StorageVersion , metav1.CreateOptions ) (* v1alpha1.StorageVersion , error )
34
- Update (context.Context , * v1alpha1.StorageVersion , metav1.UpdateOptions ) (* v1alpha1.StorageVersion , error )
34
+ UpdateStatus (context.Context , * v1alpha1.StorageVersion , metav1.UpdateOptions ) (* v1alpha1.StorageVersion , error )
35
35
Get (context.Context , string , metav1.GetOptions ) (* v1alpha1.StorageVersion , error )
36
36
}
37
37
@@ -91,10 +91,16 @@ func singleUpdate(c Client, apiserverID string, gr schema.GroupResource, encodin
91
91
}
92
92
updatedSV := localUpdateStorageVersion (sv , apiserverID , encodingVersion , decodableVersions )
93
93
if shouldCreate {
94
- _ , err := c .Create (context .TODO (), updatedSV , metav1.CreateOptions {})
94
+ createdSV , err := c .Create (context .TODO (), updatedSV , metav1.CreateOptions {})
95
+ if err != nil {
96
+ return err
97
+ }
98
+ // assign the calculated status to the object just created, then update status
99
+ createdSV .Status = updatedSV .Status
100
+ _ , err = c .UpdateStatus (context .TODO (), createdSV , metav1.UpdateOptions {})
95
101
return err
96
102
}
97
- _ , err = c .Update (context .TODO (), updatedSV , metav1.UpdateOptions {})
103
+ _ , err = c .UpdateStatus (context .TODO (), updatedSV , metav1.UpdateOptions {})
98
104
return err
99
105
}
100
106
0 commit comments