-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
Also futz with build system Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
I'm still working on this /hold |
/hold cancel |
pass | ||
|
||
def EmptyRequests(self): | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen examples where they put a sleep here.
After code review from @mmatt11 Also other misc fixes and an example. Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
class TLSConfigError(Exception): | ||
pass | ||
|
||
class RequestGenerator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be a function (and should belong to the outputs domain model)
from falco.domain import Response, Request | ||
from falco.svc.outputs_pb2_grpc import serviceStub | ||
from falco.svc.version_pb2_grpc import serviceStub as versionServiceStub | ||
from falco.schema.version_pb2 import request as versionRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion the Client should only use domain models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a stab at the refactor you're suggesting and got pretty confused. Would you be willing to throw a patch together to move the code into the domain model?
falco/domain/request.py
Outdated
|
||
def __repr__(self): | ||
return f"{self.__class__.__name__}(keepalive={self.keepalive})" | ||
__slots__ = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably it's the same but maybe we should use a tuple here
@@ -1,27 +1,12 @@ | |||
import pytest | |||
|
|||
from falco import Request | |||
from output_pb2 import request | |||
from outputs_pb2 import request | |||
|
|||
|
|||
class TestRequest: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test doesn't have a purpose anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this doesn't have a purpose anymore.
Anyway, I'd leave it here for now for when we'll have fields into the request messages (eg., rule/alerts tags)
We don't have a release process yet but probably we should still bump the version number here -> https://github.com/falcosecurity/client-py/blob/master/falco/__version__.py#L4 |
Thanks @mmat11 ! I'll get to these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested this and works like a charm.
I don't have merge powers on this repo so just take my approve as a sign of appreciation for this work!
LGTM label has been added. Git tree hash: 089d3800857f2a9e8044eb1c93f6529d8727b657
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
Congrats for this awesome work @nibalizer 🤗
Left a comment about max_receive_message_length
grpc option.
Could you update the release-note block to match the conventions, please?
if endpoint.startswith("unix:///"): | ||
channel = grpc.insecure_channel( | ||
endpoint, | ||
options=[("grpc.max_receive_message_length", 1024 * 1024 * 512)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this value for receiving messages exact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copy and pasted from the tls connection below. I didn't find us setting a maximum size in the falco source code to match this with.
@@ -1,27 +1,12 @@ | |||
import pytest | |||
|
|||
from falco import Request | |||
from output_pb2 import request | |||
from outputs_pb2 import request | |||
|
|||
|
|||
class TestRequest: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this doesn't have a purpose anymore.
Anyway, I'd leave it here for now for when we'll have fields into the request messages (eg., rule/alerts tags)
BREAKING CHANGE: removes subscribe method from client and changes all examples This normalizes get/sub accross our examples Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com> Co-authored-by: Mattia <mattia@airmail.cc>
Thanks team for the reviews! I changed what I could. I don't think I can move the code into the domain model that you're asking for @mmat11, I just don't understand it well enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this awesome PR by @nibalizer 🎉
Further refinements can be done in follow-up PRs, imho.
Having this merged in now helps all the people from KubeCon that want to try out the gRPC alerts.
LGTM label has been added. Git tree hash: 66ce6ca20405f5c5e9ca38312ebdd816995ae65b
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: leodido 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 |
What type of PR is this?
/kind cleanup
/kind feature
Any specific area of the project related to this PR?
/area client
/area grpc
What this PR does / why we need it:
A few things in here:
pip install .
Which issue(s) this PR fixes:
Fixes #35
Fixes #34
Fixes #25
Special notes for your reviewer:
Does this PR introduce a user-facing change?: