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

List all k8s debuggable containers #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eharris128
Copy link
Contributor

What

  • User can list debuggable container across k8s pods
  • Runs make fmt against syscall files

Why

  • This is a precursor step to pick which container to debug within the TUI. Also valuable in its own right.

How Tested

Screencast.from.2024-11-07.15-20-10.webm

@@ -96,6 +96,23 @@ func HandleKubernetesRuntime(
return
}

if commandParams.ActionListDebuggableContainers {
Copy link
Contributor

Choose a reason for hiding this comment

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

@eharris128 what was the reason to move commandParams.ActionListDebuggableContainers here? Was the intent to support listing debuggable containers across all pods in the (selected) namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes exactly. Although what you point out below was neglected with this approach.

}

for cname, iname := range result {
xc.Out.Info("debuggable.container", ovars{"name": cname, "image": iname})
Copy link
Contributor

Choose a reason for hiding this comment

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

@eharris128 if the intent is to show all debuggable containers across all pods then we need the pod name for each record we are printing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Definitely a necessary extension.

@@ -136,22 +153,6 @@ func HandleKubernetesRuntime(
"ec.count": len(pod.Spec.EphemeralContainers),
}).Debug("target pod info")

if commandParams.ActionListDebuggableContainers {
Copy link
Contributor

Choose a reason for hiding this comment

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

@eharris128 it might still be good to have an option to list all debuggable containers in a given pod, but if we have both options (to list them for all pods and for a specific pod) then we'll need a separate flag for this, so you can explicitly select what option you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah supporting both paths - per pod and across pods seems reasonable to me.

I do not remember how the --list-debuggable-containers flag performs right now (or before my change) if one passed in --pod as well.

Feels like adding a new flag to differentiate by one pod versus all pods would be the clearest UX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants