Skip to content

Commit 1cb21f9

Browse files
authored
packagevariant controller should unpropose deletion when needed (#3759)
1 parent 13c3683 commit 1cb21f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

porch/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ func (r *PackageVariantReconciler) findAndUpdateExistingRevisions(ctx context.Co
269269
var err error
270270
for i, downstream := range downstreams {
271271
if r.isUpToDate(pv, downstream) {
272+
if downstream.Spec.Lifecycle == porchapi.PackageRevisionLifecycleDeletionProposed {
273+
// We proposed this package revision for deletion in the past, but now it
274+
// matches our target, so we no longer want it to be deleted.
275+
downstream.Spec.Lifecycle = porchapi.PackageRevisionLifecyclePublished
276+
if err := r.Client.Update(ctx, downstream); err != nil {
277+
klog.Errorf("error updating package revision lifecycle: %v", err)
278+
}
279+
}
272280
continue
273281
}
274282
if porchapi.LifecycleIsPublished(downstream.Spec.Lifecycle) {

0 commit comments

Comments
 (0)