Skip to content

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

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.

"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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@eharris128 how about --list-debuggable-pod-containers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--list-debuggable-pod-containers For this flag we would require users to provide a --pod as well?

Making sure I follow.

@kcq
Copy link
Contributor

kcq commented Nov 17, 2024

@eharris128 merging... do you mind adding the enhancements in a new PR

@kcq kcq merged commit 47a5711 into mintoolkit:master Nov 17, 2024
3 of 18 checks passed
@eharris128
Copy link
Contributor Author

@eharris128 merging... do you mind adding the enhancements in a new PR

Yes for sure. I mentioned above but --list-debuggable-pod-containers would be a flag requiring a user to pass in a --pod $name as well yes?

@kcq
Copy link
Contributor

kcq commented Nov 19, 2024

@eharris128 merging... do you mind adding the enhancements in a new PR

Yes for sure. I mentioned above but --list-debuggable-pod-containers would be a flag requiring a user to pass in a --pod $name as well yes?

It doesn't need to be an explicit pod parameter. It can be the default pod name based on the logic that's there already where we "ensure" the pod name. If a pod flag is not specified we pick the first available pod.

@kcq
Copy link
Contributor

kcq commented Nov 19, 2024

@eharris128 merging... do you mind adding the enhancements in a new PR

Yes for sure. I mentioned above but --list-debuggable-pod-containers would be a flag requiring a user to pass in a --pod $name as well yes?

@eharris128 We already have the pod, podName, err := ensurePod(ctx, api, nsName, commandParams.TargetPod) line that takes care of picking up / resolving the pod name. Need to use that podName when we call listK8sDebuggableContainers()

@eharris128
Copy link
Contributor Author

We already have the pod, podName, err := ensurePod(ctx, api, nsName, commandParams.TargetPod) line that takes care of picking up / resolving the pod name. Need to use that podName when we call listK8sDebuggableContainers()

Yup makes sense. I will add in a --list-debuggable-pod-containers flag that will do just this.

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