flavors: Add test op before patching RevisionName
This wasn't previously possible as PatchOperation would omit empty nil
values. With that resolved we can now add a test op to ensure
revisionName is empty before we update.
@@ -228,6 +228,11 @@ func GenerateRevisionNamePatch(flavorRevision, preferenceRevision *appsv1.Contro
if flavorRevision != nil {
patches = append(patches,
+ utiltypes.PatchOperation{
+ Op: utiltypes.PatchTestOp,
+ Path: "/spec/flavor/revisionName",
+ Value: nil,
+ },
utiltypes.PatchOperation{
Op: utiltypes.PatchAddOp,
Path: "/spec/flavor/revisionName",
@@ -238,6 +243,11 @@ func GenerateRevisionNamePatch(flavorRevision, preferenceRevision *appsv1.Contro
if preferenceRevision != nil {
patches = append(patches,
+ utiltypes.PatchOperation{
+ Op: utiltypes.PatchTestOp,
+ Path: "/spec/preference/revisionName",
+ Value: nil,
+ },
utiltypes.PatchOperation{
Op: utiltypes.PatchAddOp,
Path: "/spec/preference/revisionName",
