-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Edge mixer template. Stackdriver Adapter: Add support to write to Context Graph #6709
Conversation
This client is not available upstream yet.
Build edges and entities from workload instance assertions Update edge template to have UIDs Replace traffic cache with edge cache Send from the new caches Send all entities and edges in a batch with the same timestamp Make it build Use generic path to service account Fix epochs Move context API dependencies into a local vendor directory Propagate endpoint setting from config
Fix identification of kubernetes owners and workload instances Moved contextgraph adapter to be a part of stackdriver. Move vendored contextgraph client Fix Gopkg.toml Update testconfig Temp comment out stackdriver trace code, causing panic. Update local test yaml Fix two errors on determining k8s entities from owner/WI names
Don't escape project names Add tests for workloadInstance Only print details if they exist Remove retry, so invalid entities and edges are not continually reasserted Use a 30 second timeout on AssertBatch calls, and plumb through context in function parameters
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.
mostly nits
|
||
// entityCache tracks the entities we've already seen. | ||
// It is not thread-safe. | ||
type entityCache struct { |
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 assume that pkg/cache
was insufficient for this purpose?
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.
@quentinmit Can you take a look? Thanks
|
||
// edgeCache tracks the edges we've already seen. | ||
// It is not thread-safe. | ||
type edgeCache struct { |
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.
these (edgeCache
and entityCache
) look identical. Is there no way to refactor the code so as we don't have identical Flush
and AssertAndCheck
methods?
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.
Not until generics land in Go 2 ;)
} | ||
} | ||
|
||
type mockLogger struct{} |
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.
can we use mixer/pkg/adapter/test/env.go
instead?
or, at the very least, embed adapter.logger
in the struct and only implement the needed methods?
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.
Yes, let me try this out.
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.
Done
} | ||
} | ||
case t := <-h.sendTick.C: | ||
if t.After(lastFlush.Add(9 * time.Minute)) { |
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.
should this (9 * time.Minute
) be configurable?
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.
No, it is a detail of the ContextGraph API, and wouldn't be good for the user to configure.
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.
Context API requires a refresh every 10m. This is something clients are just supposed to hardcode.
traffics: make(chan trafficAssertion), | ||
entitiesToSend: make([]entity, 0), | ||
edgesToSend: make([]edge, 0), | ||
sendTick: time.NewTicker(30 * time.Second), |
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.
should 30s
be a const, and/or configurable?
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 don't think it should be user configurable, but maybe. The ContextGraph API has a very low quota, and expects us to batch up asserts.
gax "github.com/googleapis/gax-go" | ||
|
||
"google.golang.org/api/option" | ||
contextgraphpb "google.golang.org/genproto/googleapis/cloud/contextgraph/v1alpha1" |
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.
style nit: we should separate out the istio imports section from the third-party. these two lines belong with the others.
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.
Will do.
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.
Done
Codecov Report
@@ Coverage Diff @@
## master #6709 +/- ##
=======================================
- Coverage 71% 70% -<1%
=======================================
Files 354 355 +1
Lines 30711 30610 -101
=======================================
- Hits 21579 21406 -173
- Misses 8284 8344 +60
- Partials 848 860 +12
Continue to review full report at Codecov.
|
We need this PR in ASAP to make the 1.0 release cut. We can make small adjustments to the code moving forward, but I see no major blockers in my review. /lgtm |
a810d36
to
06b2ee0
Compare
06b2ee0
to
a70ac9f
Compare
@douglas-reid Yay, all tests pass. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: douglas-reid, jeffmendoza 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 |
/test istio-presubmit |
Docker Hub!!
|
This includes #6408, so I'll close that one.
Add Mixer template for edge instances. These can be used by adapters to construct graphs of the Istio mesh.
Add support to Stackdriver adapter to write to the Stackdriver Context Graph API.
The Context Graph client is not available upstream yet. So vendor it inside the Stackdriver adapter until it is available.