-
Notifications
You must be signed in to change notification settings - Fork 81
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
Index more sqlite cache fields #271
Index more sqlite cache fields #271
Conversation
5ca4081
to
67c463f
Compare
I figured out the other fields, except I'm not sure if the events should go in the empty-string group or in group |
cf9dd7e
to
b97d575
Compare
494b7ea
to
5e3de28
Compare
5e3de28
to
8eb3632
Compare
88f64b9
to
eb55ceb
Compare
I implemented the requested changes
eb55ceb
to
c9e8789
Compare
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 solid to me, the only real small problem being a missed error handling if
.
Other than that it's totally optional nitpicks.
Thanks for all the work! Looking forward to see this in.
99fb430
to
f226a31
Compare
Misc changes: - Use the builtin Event class, not events.k8s.io (by looking at the dashboard client code) - Specify full path to the management.cattle.io fields. - Map `Event.type` to `Event._type` for indexing. Use a compound transform-func to first check for a "signal", and then to run all the relevant transformers until either one fails or the list is exhausted. - Includes moving the fakeSummaryCache type into a common area. Use a simpler way of running transforms.
c3ec254
to
44c7f7a
Compare
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.
LGTM
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 got a few concerns on implementation, but the functionality looks good. If we can't address the issues here due to timeline, let's get a separate issue up to track that as tech-debt.
) | ||
|
||
func TestTransformEvents(t *testing.T) { | ||
tests := []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.
Needs a test case where there's no "type" and so we don't add "_type".
converters := make([]func(*unstructured.Unstructured) (*unstructured.Unstructured, error), 0) | ||
if gvk.Kind == "Event" && gvk.Group == "" && gvk.Version == "v1" { | ||
converters = append(converters, events.TransformEventObject) | ||
} | ||
converters = append(converters, t.defaultFields.TransformCommon) |
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.
Nit: You could initialize this with the common converter:
converters := make([]func(*unstructured.Unstructured) (*unstructured.Unstructured, error), 0) | |
if gvk.Kind == "Event" && gvk.Group == "" && gvk.Version == "v1" { | |
converters = append(converters, events.TransformEventObject) | |
} | |
converters = append(converters, t.defaultFields.TransformCommon) | |
converters := []func(*unstructured.Unstructured) (*unstructured.Unstructured, error){t.defaultFields.TransformCommon} | |
if gvk.Kind == "Event" && gvk.Group == "" && gvk.Version == "v1" { | |
converters = append(converters, events.TransformEventObject) | |
} |
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'd rather leave the transformers running from specific to general, until we find they can be run in any order.
raw, isSignal, err := common.GetUnstructured(test.input) | ||
require.False(t, isSignal) | ||
require.Nil(t, err) |
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.
Nit: I'm not sure that this should be part of this set of tests. The GetUnstructured call is part of the implementation detail of the Transform function - not something that is directly part of this package.
Related to #46642
I don't see a straightforward way to test this