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

reconcilers: Add an initial concept of a dedicated reconcilers object in mediator #872

Merged
merged 3 commits into from
Sep 7, 2023

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Sep 6, 2023

This creates a reconcilers object whose purpose is to persist the entities when
needed and call for policy evaluation if required. The intent is to add
further functionality here so we could do gradual or scheduled reconciles of objects.

This also adds a unit test for the executor!

@JAORMX JAORMX requested a review from jhrozek September 6, 2023 09:09
@JAORMX JAORMX changed the title reconcilers: Add an initial concept of a dedicated reconcilers object in mediator WIP: reconcilers: Add an initial concept of a dedicated reconcilers object in mediator Sep 6, 2023
@JAORMX JAORMX force-pushed the reconcilers-refactor branch 4 times, most recently from 0543a9d to b6e564c Compare September 7, 2023 06:07
@JAORMX JAORMX changed the title WIP: reconcilers: Add an initial concept of a dedicated reconcilers object in mediator reconcilers: Add an initial concept of a dedicated reconcilers object in mediator Sep 7, 2023
@JAORMX
Copy link
Contributor Author

JAORMX commented Sep 7, 2023

@jhrozek you mentioned you had some comments.

… in mediator

This creates a reconcilers object whose purpose is to persist the entities when
needed and call for policy evaluation if required. The intent is to add
further functionality here so we could do gradual or scheduled reconciles of objects.
This uses the passthrough builtin ingestor and a simple rego rule that always passes.
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

this is great!
I added two comments because if I didn't add any it would look as if I acked a large PR without reading it :-) but please go ahead and merge now.

return nil, fmt.Errorf("error generating UUID: %w", err)
}

msg := message.NewMessage(id.String(), nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: should we return nil, err rather than empty_msg, err on error? (I know that the caller should just not touch the first return parameter on error..)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WithProvider(ectx.Provider).
WithGroupID(ectx.Group.ID).
WithRepository(repo).
WithRepositoryID(dbrepo.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

since all handlers are now building entityInfoWrapper, then calling buildMessage and then publish using the same topic for all the publishers now, maybe another refactor might be to have a closure that would just return the entityInfoWrapper and then a shared code would build the message and publish it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JAORMX JAORMX merged commit ab147f3 into main Sep 7, 2023
12 checks passed
@JAORMX JAORMX deleted the reconcilers-refactor branch September 7, 2023 10:29
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.

None yet

2 participants