debug

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 39 Imported by: 6

Documentation

Index

Constants

View Source
const (

	// ProfileLegacy represents the legacy debugging profile which is backwards-compatible with 1.23 behavior.
	ProfileLegacy = "legacy"
	// ProfileGeneral contains a reasonable set of defaults tailored for each debugging journey.
	ProfileGeneral = "general"
	// ProfileBaseline is identical to "general" but eliminates privileges that are disallowed under
	// the baseline security profile, such as host namespaces, host volume, mounts and SYS_PTRACE.
	ProfileBaseline = "baseline"
	// ProfileRestricted is identical to "baseline" but adds configuration that's required
	// under the restricted security profile, such as requiring a non-root user and dropping all capabilities.
	ProfileRestricted = "restricted"
	// ProfileNetadmin offers elevated privileges for network debugging.
	ProfileNetadmin = "netadmin"
	// ProfileSysadmin offers elevated privileges for debugging.
	ProfileSysadmin = "sysadmin"
)

Variables

This section is empty.

Functions

func NewCmdDebug

func NewCmdDebug(restClientGetter genericclioptions.RESTClientGetter, streams genericiooptions.IOStreams) *cobra.Command

NewCmdDebug returns a cobra command that runs kubectl debug.

Types

type DebugAttachFunc added in v0.30.0

type DebugAttachFunc func(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, cmdPath string, ns, podName, containerName string) error

type DebugOptions

type DebugOptions struct {
	Args               []string
	ArgsOnly           bool
	Attach             bool
	AttachFunc         DebugAttachFunc
	Container          string
	CopyTo             string
	Replace            bool
	Env                []corev1.EnvVar
	Image              string
	Interactive        bool
	KeepLabels         bool
	KeepAnnotations    bool
	KeepLiveness       bool
	KeepReadiness      bool
	KeepStartup        bool
	KeepInitContainers bool
	Namespace          string
	TargetNames        []string
	PullPolicy         corev1.PullPolicy
	Quiet              bool
	SameNode           bool
	SetImages          map[string]string
	ShareProcesses     bool
	TargetContainer    string
	TTY                bool
	Profile            string
	CustomProfileFile  string
	CustomProfile      *corev1.Container
	Applier            ProfileApplier

	Builder *resource.Builder
	genericiooptions.IOStreams
	WarningPrinter *printers.WarningPrinter

	resource.FilenameOptions
	// contains filtered or unexported fields
}

DebugOptions holds the options for an invocation of kubectl debug.

func NewDebugOptions

func NewDebugOptions(streams genericiooptions.IOStreams) *DebugOptions

NewDebugOptions returns a DebugOptions initialized with default values.

func (*DebugOptions) AddFlags added in v0.27.0

func (o *DebugOptions) AddFlags(cmd *cobra.Command)

func (*DebugOptions) Complete

func (o *DebugOptions) Complete(restClientGetter genericclioptions.RESTClientGetter, cmd *cobra.Command, args []string) error

Complete finishes run-time initialization of debug.DebugOptions.

func (*DebugOptions) Run

func (o *DebugOptions) Run(restClientGetter genericclioptions.RESTClientGetter, cmd *cobra.Command) error

Run executes a kubectl debug.

func (*DebugOptions) Validate

func (o *DebugOptions) Validate() error

Validate checks that the provided debug options are specified.

type KeepFlags added in v0.31.0

type KeepFlags struct {
	Labels         bool
	Annotations    bool
	Liveness       bool
	Readiness      bool
	Startup        bool
	InitContainers bool
}

KeepFlags holds the flag set that determine which fields to keep in the copy pod.

func (KeepFlags) RemoveAnnotations added in v0.31.0

func (kflags KeepFlags) RemoveAnnotations(p *corev1.Pod)

RemoveAnnotations remove annotations from the pod.

func (KeepFlags) RemoveInitContainers added in v0.31.0

func (kflags KeepFlags) RemoveInitContainers(p *corev1.Pod)

RemoveInitContainers remove initContainers from the pod.

func (KeepFlags) RemoveLabels added in v0.31.0

func (kflags KeepFlags) RemoveLabels(p *corev1.Pod)

RemoveLabels removes labels from the pod.

func (KeepFlags) RemoveProbes added in v0.31.0

func (kflags KeepFlags) RemoveProbes(p *corev1.Pod)

RemoveProbes remove probes from all containers of the pod.

type ProfileApplier added in v0.25.0

type ProfileApplier interface {
	// Apply applies the profile to the given container in the pod.
	Apply(pod *corev1.Pod, containerName string, target runtime.Object) error
}

func NewProfileApplier added in v0.25.0

func NewProfileApplier(profile string, kflags KeepFlags) (ProfileApplier, error)

NewProfileApplier returns a new Options for the given profile name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL