-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[opsrc] Do not delete csc during purge #117
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ import ( | |
"github.com/operator-framework/operator-marketplace/pkg/datastore" | ||
"github.com/operator-framework/operator-marketplace/pkg/phase" | ||
log "github.com/sirupsen/logrus" | ||
k8s_errors "k8s.io/apimachinery/pkg/api/errors" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
|
@@ -52,19 +51,12 @@ func (r *purgingReconciler) Reconcile(ctx context.Context, in *v1alpha1.Operator | |
|
||
out = in.DeepCopy() | ||
|
||
r.logger.Info("Purging all resource(s)") | ||
// We will purge the datastore and leave the CatalogSourceConfig object | ||
// alone. It will be updated accordingly by the reconciliation loop. | ||
|
||
r.datastore.RemoveOperatorSource(in.GetUID()) | ||
|
||
builder := &CatalogSourceConfigBuilder{} | ||
csc := builder.WithTypeMeta(). | ||
WithNamespacedName(in.Namespace, in.Name). | ||
CatalogSourceConfig() | ||
|
||
if err = r.client.Delete(ctx, csc); err != nil && !k8s_errors.IsNotFound(err) { | ||
nextPhase = phase.GetNextWithMessage(phase.OperatorSourcePurging, err.Error()) | ||
return | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update the comments in this file to reflect that we are no longer actually "purging" the operator source object itself? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be reflected in log statement which says There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the log statement to clarify what has been purged. |
||
r.logger.Info("Purged datastore. No change(s) were made to corresponding CatalogSourceConfig") | ||
|
||
// Since all observable states stored in the Status resource might already | ||
// be stale, we should Reset everything in Status except for 'Current Phase' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow how the
CatalogSourceConfig
will get updated during the reconciliation process given it's phase will remain atSucceeded
. Shouldn't you force an update so that we get the current state from Quay? Or are you saying that it will get updated during the next sync loop?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
CatalogSourceConfig
object will get updated during the 'Configuring' phase.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right this makes sense. Basically the Purging phase, rather than deleting the object, just resets the status and then sets the next phase to Initial. That way the configuring reconciler just updates the already existing object and it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, sorry I missed the bit of existing code below. Make sense now.