mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Warn user for runtime support of debug targeting
Add a warning message to `kubectl debug` when using the `--target` option as many runtimes don't support it yet.
This commit is contained in:
parent
92aff21558
commit
968185e1f7
@ -272,9 +272,18 @@ func (o *DebugOptions) Validate(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TargetContainer
|
// TargetContainer
|
||||||
if len(o.TargetContainer) > 0 && len(o.CopyTo) > 0 {
|
if len(o.TargetContainer) > 0 {
|
||||||
|
if len(o.CopyTo) > 0 {
|
||||||
return fmt.Errorf("--target is incompatible with --copy-to. Use --share-processes instead.")
|
return fmt.Errorf("--target is incompatible with --copy-to. Use --share-processes instead.")
|
||||||
}
|
}
|
||||||
|
if !o.Quiet {
|
||||||
|
// If the runtime doesn't support container namespace targeting this will fail silently, which has caused
|
||||||
|
// some confusion (ex: https://issues.k8s.io/98362), so print a warning. This can be removed when
|
||||||
|
// EphemeralContainers are generally available.
|
||||||
|
fmt.Fprintf(o.Out, "Targeting container %q. If you don't see processes from this container it may be because the container runtime doesn't support this feature.\n", o.TargetContainer)
|
||||||
|
// TODO(verb): Add a list of supported container runtimes to https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/ and then link here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TTY
|
// TTY
|
||||||
if o.TTY && !o.Interactive {
|
if o.TTY && !o.Interactive {
|
||||||
|
Loading…
Reference in New Issue
Block a user