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

chore(internal): switch all resources to a struct with common fields #1765

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

Baarsgaard
Copy link
Contributor

@Baarsgaard Baarsgaard commented Nov 18, 2024

This PR takes the first step towards refactoring the reconciliation loops for all CRs.

I've added a GrafanaCommonOptions struct which embeds the Common Options fields as a singular struct.

This means that all CRs will use the same comments, rules for CRD generation/deserialization, and default values.
This is especially apparent for ResyncPeriod which had a few different implementations.

This does add the AllowCrossNamespaceImport to GrafanaNotificationPolicies, but it is not handled in the Reconciliation loop as of now.

It is recommended to review this one commit at a time.
Individual commits may not compile except for the final one.

@Baarsgaard Baarsgaard marked this pull request as ready for review November 18, 2024 17:05
Copy link
Member

@theSuess theSuess left a comment

Choose a reason for hiding this comment

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

This looks good to me! Thanks for splitting this out. Would appreciate an additonal review just to be safe since this touches basically all resources

Copy link
Collaborator

@weisdd weisdd left a comment

Choose a reason for hiding this comment

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

The changes look good, and they're much easier to review now compared to what we had in the initial huge PR :)

What I would probably consider doing it future is moving from AllowCrossNamespaceImport *bool to AllowCrossNamespaceImport bool, because, in the end, we treat false and nil equally, so we can get rid of pointer verifications. But it doesn't have to be done under this PR, we'll change it later.

@weisdd weisdd added this pull request to the merge queue Nov 26, 2024
@weisdd weisdd changed the title Refactor: Common opts structs and ResyncPeriod chore(internal): switch all resources to a struct with common fields Nov 26, 2024
Merged via the queue into grafana:master with commit ffdc532 Nov 26, 2024
14 checks passed
@Baarsgaard Baarsgaard deleted the common_opts_structs branch November 26, 2024 10:37
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.

3 participants