Skip to content
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

fix: explicit workflow invocation uses the same resource intance that reconcile api #2686

Merged
merged 3 commits into from
Feb 14, 2025

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Feb 13, 2025

Signed-off-by: Attila Mészáros [email protected]

@csviri csviri requested a review from metacosm February 13, 2025 12:29
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
@csviri csviri requested a review from xstefank February 13, 2025 13:03
@@ -116,4 +116,8 @@ public DefaultContext<P> setRetryInfo(RetryInfo retryInfo) {
this.retryInfo = retryInfo;
return this;
}

public P getPrimaryResource() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of exposing this method only for tests…

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for jumping in here, but if this method is not exposed, how a main reconciliation loop will be aware that the primary resource has changed if in the middle of one reconciliation an explicit dependent resource reconciliation is requested via context.managedWorkflowAndDependentResourceContext().reconcileManagedWorkflow(); It may happen that the primary resource is updated, or either its status, and then the main reconciliation loop will not be using a most up to date version of the primary resource. Or am I wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afalhambra-hivemq usually you get this as a parameter for example here for dependent resources:

It is not part of the interface (Context) just the impl so it is unit testable but you never access this primary resource through this method. I think @metacosm has a point I'm not big fan either, but on the other hand if there is no other way to unit test it I prefer to be just pragmatic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that's the intent here, though. Also, the primary should probably not changed during a reconciliation loop but be the target of a subsequent reconciliation because otherwise the current one might be operating on inconsistent basis (for example, some dependents might have seen the old primary version and taken decisions based on that, while others might see a new, possibly contradictory version…)

Copy link
Collaborator Author

@csviri csviri Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use SSA should not change, otherwise fine. We should explain that in docs maybe more thoroughly or in a separate blogpost.
Will expand that section in release blogpost (currently there is a TODO 😶‍🌫️ )

@metacosm metacosm changed the title fix: explicit workflow invication uses the same resource intance that reconcile api fix: explicit workflow invocation uses the same resource intance that reconcile api Feb 14, 2025
@csviri csviri merged commit f5f0a60 into main Feb 14, 2025
57 checks passed
@csviri csviri deleted the fix-explicit-invoce-resource branch February 14, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants