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

feat(controllers): add support for notification templates #1775

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

chenlujjj
Copy link
Contributor

@chenlujjj chenlujjj commented Nov 26, 2024

related issue: #1736

Fixes: #1736

@theSuess
Copy link
Member

Thanks for the contribution! Can you use the common fields introduced in #1765? I'd also like to wait for #1770 to be merged just so we won't need to do this work again for notification templates as well

@weisdd
Copy link
Collaborator

weisdd commented Nov 27, 2024

I'm also in favour of having this PR rewritten on top of changes introduced in #1765 and #1770.

@chenlujjj
Copy link
Contributor Author

Sure, I'll do that.

@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 2 times, most recently from f604c8d to 0956145 Compare November 28, 2024 16:15
@CarlosLanderas
Copy link

Wow!!! This is awesome @chenlujjj!

We really need this and I was actually thinking about opening an issue to ask if I can contribute it myself.

Awesome thanks!

@CarlosLanderas
Copy link

Any ETA for this nice feature to be released?

Many thanks!

@chenlujjj
Copy link
Contributor Author

Hi @CarlosLanderas ,I'm waiting for #1770 to be merged, so that I can rewrite this PR on top of it.

@CarlosLanderas
Copy link

Perfect @chenlujjj , thanks!

@theSuess
Copy link
Member

@chenlujjj we just merged #1770 so if you have the time to rebase ontop of that, that'd be great!

@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch from 0956145 to d81aeae Compare December 16, 2024 10:38
@chenlujjj chenlujjj requested a review from hubeadmin as a code owner December 16, 2024 10:38
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch from d81aeae to af84b6b Compare December 16, 2024 11:39
Copy link
Contributor

@Baarsgaard Baarsgaard left a comment

Choose a reason for hiding this comment

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

Hi @chenlujjj looks good overall.
I spotted a few places in the Reconcile function where you're doing more than necessary.
Some of the code can be deleted or replaced with a couple of helper functions.

The other comments are mostly minor changes!

I wrote these diffs in the Github UI, there is likely an error in one or more of them

controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
api/v1beta1/grafananotificationtemplate_types.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Baarsgaard Baarsgaard left a comment

Choose a reason for hiding this comment

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

@theSuess, @weisdd,
What do you think about this change where we can essentially remove the ResyncPeriodHasElapsed check?

controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 4 times, most recently from c22bb96 to 87b78e6 Compare December 17, 2024 06:40
@chenlujjj
Copy link
Contributor Author

Thank you @Baarsgaard , I've updated the code based on your review suggestions and implementation of grafana folder controller.

Copy link
Contributor

@Baarsgaard Baarsgaard left a comment

Choose a reason for hiding this comment

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

Significantly less comments this time 😄 good work!

controllers/__debug_bin1929994336 Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 3 times, most recently from 4d31b7c to e42ad78 Compare December 23, 2024 08:13
@chenlujjj
Copy link
Contributor Author

@Baarsgaard Could you please take another review, thank you.

Copy link
Contributor

@Baarsgaard Baarsgaard left a comment

Choose a reason for hiding this comment

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

Hi @chenlujjj sorry for the delay, here's another couple of comments 😅
Additionally, I'm very sorry for the PRs that I open that end up blocking yours 🙇‍♂️

api/v1beta1/grafananotificationtemplate_types.go Outdated Show resolved Hide resolved
api/v1beta1/grafananotificationtemplate_types.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
api/v1beta1/grafananotificationtemplate_types.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 2 times, most recently from be3b5ac to 6b001c4 Compare December 29, 2024 11:23
@Baarsgaard
Copy link
Contributor

@chenlujjj Both #1801 and #1804 were merged, you can now continue, and I will not be opening any more PRs that interfere with this!

@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 3 times, most recently from 776792e to d2b665a Compare December 30, 2024 16:15
@chenlujjj
Copy link
Contributor Author

Thank you @Baarsgaard .
Hi @theSuess @weisdd Can anyone of you have a review ?

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.

Sorry for delays in reviews, during the holiday season many of maintainers are absent.

Overall, the code looks good to me, though we still need to make a few adjustments. Aside from the comments I've added, we also need to:

  • add an e2e-test for the resource;
  • add an example (check examples folder).

controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
controllers/grafananotificationtemplate_controller.go Outdated Show resolved Hide resolved
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch 2 times, most recently from 6bb18fc to 508ca25 Compare January 5, 2025 12:51
@chenlujjj chenlujjj force-pushed the feat/notificationtemplate branch from 508ca25 to 58c26bd Compare January 5, 2025 13:23
@chenlujjj
Copy link
Contributor Author

Hi @weisdd I've added the e2e-test and example

@CarlosLanderas
Copy link

Thanks again for the effort @chenlujjj

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.

@chenlujjj I've pushed a commit to fix the example (typo in kind and missing instanceSelector). For the rest, it should be good to be merged. Thanks for the effort!

And thanks to @Baarsgaard for the help with reviews :)

@weisdd weisdd added this pull request to the merge queue Jan 8, 2025
@weisdd weisdd changed the title feat: support notification template feat(controllers): add support for notification templates Jan 8, 2025
Merged via the queue into grafana:master with commit fbc0b9e Jan 8, 2025
14 checks passed
@chenlujjj
Copy link
Contributor Author

Thank you both! @weisdd @Baarsgaard

@chenlujjj
Copy link
Contributor Author

Hi @weisdd Could you tell me about the plan time of the next release ?

@weisdd
Copy link
Collaborator

weisdd commented Jan 10, 2025

@theSuess any thoughts on when we should cut a release? :)

@theSuess
Copy link
Member

theSuess commented Jan 13, 2025

@chenlujjj We'll aim for a release this Wednesday

@theSuess theSuess added the feature this PR introduces a new feature label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature this PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: provision notificationTemplates trough the operator
5 participants