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

Add basic support for notifications package #160

Merged

Conversation

Devaansh-Kumar
Copy link
Contributor

@Devaansh-Kumar Devaansh-Kumar commented Jun 6, 2024

What type of PR is this?

/kind feature
/kind documentation

What this PR does / why we need it:
This PR provides a skeleton structure for the notifications package

Which issue(s) this PR fixes:

This pull request addresses part of the issue described in #131

Does this PR introduce a user-facing change?:

Created a new notifications package to provide mechanism for providers to display useful information generated during conversion process

/cc @LiorLieberman @mlavacca

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. kind/documentation Categorizes issue or PR as related to documentation. labels Jun 6, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 6, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @Devaansh-Kumar!

It looks like this is your first PR to kubernetes-sigs/ingress2gateway 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/ingress2gateway has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 6, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @Devaansh-Kumar. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 6, 2024
Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks for this first PR, @Devaansh-Kumar!

/ok-to-test

pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Show resolved Hide resolved
t := newTableConfig()

t.SetTitle(fmt.Sprintf("Notifications from %v", provider))
t.AppendHeader(table.Row{"Provider", "Message Type", "Notification"})
Copy link
Member

Choose a reason for hiding this comment

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

I'd stick with either the "message" or the "notification" naming, which means "Notification type | notification" or "message type | message".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with changing the Heading "Message Type" to "Notification Type", but withing the Notification struct I cannot change Message field to Notification as there would be a name clash and Notification struct consists of both a Type and a message that we want to send.
Do you thing I should change MessageType to NotificationType as well?

pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 12, 2024
@Devaansh-Kumar
Copy link
Contributor Author

@mlavacca I have made changes according to your comments and left some comments of my own and am ready for next round of review

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 13, 2024
PROVIDER.md Outdated Show resolved Hide resolved
Copy link
Member

@LiorLieberman LiorLieberman left a comment

Choose a reason for hiding this comment

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

I am uncomfortable to approve this CL because I want to see the whole picture of how the notifications will be added, then I can have an opinion on the structure introduced here as well.

Can you add the other part of the logic here ?
To make review easy, you can logically split it to commits instead of separate PRs.

Comment on lines 22 to 23
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
Copy link
Member

Choose a reason for hiding this comment

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

We should be careful importing these non standard libraries, are there more common alternatives ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a well used library, so it should not be a concern. One alternative would be https://github.com/olekukonko/tablewriter but i feel the package we are using offers more flexibility and options.

Copy link
Member

Choose a reason for hiding this comment

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

ok about this, if it was an APACHE licenses it was all good.
I checked and it looks like CNCF has a process for allowlisting MIT licenses. https://github.com/olekukonko/tablewriter is allowed, you can find it here.

The approval processes would probably take a bit of time, and has some requirements, here is an example of exception request.

Up to you if you want to go through this process, or move to use github.com/olekukonko/tablewriter and remove the colors. I'd go with the latter.

pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
@Devaansh-Kumar
Copy link
Contributor Author

I am uncomfortable to approve this CL because I want to see the whole picture of how the notifications will be added, then I can have an opinion on the structure introduced here as well.

Can you add the other part of the logic here ? To make review easy, you can logically split it to commits instead of separate PRs.

By other part you mean the part involving having a calling object as a column right?

@LiorLieberman
Copy link
Member

LiorLieberman commented Jun 16, 2024 via email

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 24, 2024
pkg/i2gw/ingress2gateway.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Show resolved Hide resolved
pkg/i2gw/providers/istio/converter.go Show resolved Hide resolved
Copy link
Member

@LiorLieberman LiorLieberman 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, thank you Devaansh!

Mostly LGTM, I left a few last comments, plus can you add a test to notifications.go ? to see that we get the tables we expect?

If its too hard for this PR, I am happy to wait for a followup PR but if its straightforward i'd prefer to include it here.

pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/providers/istio/converter.go Show resolved Hide resolved
@Devaansh-Kumar
Copy link
Contributor Author

This is great, thank you Devaansh!

Mostly LGTM, I left a few last comments, plus can you add a test to notifications.go ? to see that we get the tables we expect?

If its too hard for this PR, I am happy to wait for a followup PR but if its straightforward i'd prefer to include it here.

Yeah I would prefer to do this in a seperate PR.

pkg/i2gw/notifications/config.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
cmd/print.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
pkg/i2gw/notifications/notifications.go Outdated Show resolved Hide resolved
cmd/print.go Outdated Show resolved Hide resolved
pkg/i2gw/ingress2gateway.go Outdated Show resolved Hide resolved
pkg/i2gw/ingress2gateway.go Outdated Show resolved Hide resolved
pkg/i2gw/ingress2gateway.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
@LiorLieberman
Copy link
Member

/approve
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 12, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Devaansh-Kumar, LiorLieberman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 12, 2024
@LiorLieberman
Copy link
Member

@Devaansh-Kumar can you rebase?

@LiorLieberman
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2024
@LiorLieberman LiorLieberman merged commit 2659102 into kubernetes-sigs:main Jul 12, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants