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

krt: initial debug interface #53597

Merged
merged 6 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lint
  • Loading branch information
howardjohn committed Nov 5, 2024
commit 88c4623d2679d8e610f3edaaaab1041946a9e0ab
15 changes: 0 additions & 15 deletions pkg/kube/krt/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,27 +187,12 @@ func (h *manyCollection[I, O]) dump() CollectionDump {
cur.Dependencies = depss
inputs[string(k)] = cur
}
// var xx Key[I]
// x := h.objectDependencies[xx][0].

return CollectionDump{
Outputs: eraseMap(h.collectionState.outputs),
Inputs: inputs,
InputCollection: h.parent.(internalCollection[I]).name(),
}
//h.log.Errorf(">>> BEGIN DUMP")
//for k, deps := range h.objectDependencies {
// for _, dep := range deps {
// h.log.Errorf("Dependencies for: %v: %v (%v)", k, dep.collectionName, dep.filter)
// }
//}
//for i, os := range h.collectionState.mappings {
// h.log.Errorf("Input %v -> %v", i, os.UnsortedList())
//}
//for os, o := range h.collectionState.outputs {
// h.log.Errorf("Output %v -> %v", os, o)
//}
//h.log.Errorf("<<< END DUMP")
}

// nolint: unused // (not true, its to implement an interface)
Expand Down
1 change: 1 addition & 0 deletions pkg/kube/krt/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func maybeRegisterCollectionForDebugging[T any](c Collection[T], handler *DebugH
})
}

// nolint: unused // (not true, not sure why it thinks it is!)
func eraseMap[T any](l map[Key[T]]T) map[string]any {
nm := make(map[string]any, len(l))
for k, v := range l {
Expand Down
4 changes: 1 addition & 3 deletions pkg/kube/krt/informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ func (i *informer[I]) Synced() Syncer {
// nolint: unused // (not true, its to implement an interface)
func (i *informer[I]) dump() CollectionDump {
return CollectionDump{
Outputs: eraseMap(slices.GroupUnique(i.inf.List(metav1.NamespaceAll, klabels.Everything()), func(t I) Key[I] {
return GetKey(t)
})),
Outputs: eraseMap(slices.GroupUnique(i.inf.List(metav1.NamespaceAll, klabels.Everything()), GetKey)),
}
}

Expand Down