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

Implementation for event driven tink #301

Merged
merged 13 commits into from
Dec 7, 2020

Conversation

gauravgahlot
Copy link
Contributor

@gauravgahlot gauravgahlot commented Sep 21, 2020

Description

This PR provides the implementation for event-driven Tinkerbell base model proposed here.

Note
We would like to keep Watch as the function used to stream events for the new event-driven tink. Therefore, the existing hardware.Watch has been renamed to hardware.DeprecatedWatch.

This will also require some changes in Hegel, so that it can use the hardware.DeprecatedWatch.

Why is this needed

Fixes: #294

How Has This Been Tested?

Unit tests and manual testing.

How are existing users impacted? What migration steps/scripts do we need?

This contains a bc-break. Watch has been renamed to DeprecatedWatch, clients will need to be regenerated and upgraded.

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

Known issues in progress (fixed)

  • an event being received twice on the same stream
  • tink hardware watch <id> fails to correctly print the hardware data for new events

@gauravgahlot gauravgahlot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge Signal to Mergify to block merging of the PR. labels Sep 21, 2020
@gauravgahlot gauravgahlot self-assigned this Sep 21, 2020
@codecov
Copy link

codecov bot commented Sep 21, 2020

Codecov Report

Merging #301 (14badba) into master (1992c1c) will increase coverage by 2.64%.
The diff coverage is 60.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #301      +/-   ##
==========================================
+ Coverage   26.09%   28.73%   +2.64%     
==========================================
  Files          14       19       +5     
  Lines        1280     1385     +105     
==========================================
+ Hits          334      398      +64     
- Misses        921      960      +39     
- Partials       25       27       +2     
Impacted Files Coverage Δ
grpc-server/events.go 0.00% <0.00%> (ø)
grpc-server/grpc_server.go 0.00% <0.00%> (ø)
grpc-server/hardware.go 1.55% <ø> (ø)
client/informers/informer.go 20.00% <20.00%> (ø)
cmd/tink-cli/cmd/events.go 33.33% <33.33%> (ø)
client/informers/notification.go 88.67% <88.67%> (ø)
client/informers/mock.go 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1992c1c...14badba. Read the comment docs.

@gauravgahlot gauravgahlot force-pushed the event-driven-tink branch 3 times, most recently from 67b9cbc to 4782daf Compare September 21, 2020 14:27
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved
protos/event/event.proto Outdated Show resolved Hide resolved
protos/event/event.proto Outdated Show resolved Hide resolved
protos/event/event.proto Outdated Show resolved Hide resolved
protos/event/event.proto Outdated Show resolved Hide resolved
@gianarb
Copy link
Contributor

gianarb commented Sep 22, 2020

According to the demo @gauravgahlot gave today here some feedback.
I have a couple of things to say about the UX and on the feature itself.

I think we should not use an integer for event types and resource_type we should use strings. They are way more readable as constant and it won't require to actually have a catalog of them. A few bytes to store but who cares. If we start supporting custom events and types it will be impossible to keep a centralized index.

We have to figure out how to effectively deserialize data from bytes to struct and JSON.

The CLI I think should reflect that filters we will have to implement something like --resource-type --resource-id --event-type. The --frame can be a more clear --from 5m (that's should be the default value)

Other than that, great start!

protos/events/events.proto Outdated Show resolved Hide resolved
protos/events/events.proto Outdated Show resolved Hide resolved
@gauravgahlot gauravgahlot force-pushed the event-driven-tink branch 6 times, most recently from a637b63 to b42b2c7 Compare September 25, 2020 10:02
@mmlb
Copy link
Contributor

mmlb commented Sep 25, 2020

@splaspood fyi

protos/events/events.proto Outdated Show resolved Hide resolved
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved
deploy/db/tinkerbell-init.sql Outdated Show resolved Hide resolved

CREATE TRIGGER hardware_trigger
AFTER INSERT OR UPDATE ON hardware
FOR EACH ROW EXECUTE PROCEDURE hardware_event();
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also ensure the old entries are trimmed away right?

protos/protoc.sh Outdated Show resolved Hide resolved
@gauravgahlot gauravgahlot force-pushed the event-driven-tink branch 2 times, most recently from 9d4faa2 to cf5fc78 Compare September 29, 2020 04:03
@gianarb gianarb requested review from nathangoulding and removed request for nathangoulding December 3, 2020 10:48
mmlb
mmlb previously approved these changes Dec 4, 2020
@gauravgahlot
Copy link
Contributor Author

Updated branch with a rebase, no changes.

gianarb
gianarb previously approved these changes Dec 7, 2020
@gianarb gianarb requested a review from mmlb December 7, 2020 13:32
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
@gauravgahlot gauravgahlot removed the request for review from nathangoulding December 7, 2020 18:47
@mergify mergify bot merged commit 9c52cca into tinkerbell:master Dec 7, 2020
@gauravgahlot gauravgahlot deleted the event-driven-tink branch December 7, 2020 18:48
@mmlb mmlb removed the ready-to-merge Signal to Mergify to merge the PR. label Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event driven implementation
5 participants