kubectldebug

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDebugCmd

func NewDebugCmd(streams genericclioptions.IOStreams) *cobra.Command

NewDebugCmd returns a cobra command wrapping DebugOptions

Types

type Config

type Config struct {
	AgentPort                int      `yaml:"agentPort,omitempty"`
	Image                    string   `yaml:"image,omitempty"`
	RegistrySecretName       string   `yaml:"registrySecretName,omitempty"`
	RegistrySecretNamespace  string   `yaml:"registrySecretNamespace,omitempty"`
	RegistrySkipTLSVerify    bool     `yaml:"registrySkipTLSVerify,omitempty"`
	ForkPodRetainLabels      []string `yaml:"forkPodRetainLabels,omitempty"`
	DebugAgentDaemonSet      string   `yaml:"debugAgentDaemonset,omitempty"`
	DebugAgentNamespace      string   `yaml:"debugAgentNamespace,omitempty"`
	Command                  []string `yaml:"command,omitempty"`
	PortForward              bool     `yaml:"portForward,omitempty"`
	CreateDebugAgentPod      bool     `yaml:"createDebugAgentPod,omitempty"`
	AgentPodNamePrefix       string   `yaml:"agentPodNamePrefix,omitempty"`
	AgentPodNamespace        string   `yaml:"agentPodNamespace,omitempty"`
	AgentImage               string   `yaml:"agentImage,omitempty"`
	AgentImagePullPolicy     string   `yaml:"agentImagePullPolicy,omitempty"`
	AgentImagePullSecretName string   `yaml:"agentImagePullSecretName,omitempty"`
	AgentPodCpuRequests      string   `yaml:"agentCpuRequests,omitempty"`
	AgentPodMemoryRequests   string   `yaml:"agentMemoryRequests,omitempty"`
	AgentPodCpuLimits        string   `yaml:"agentCpuLimits,omitempty"`
	AgentPodMemoryLimits     string   `yaml:"agentMemoryLimits,omitempty"`
	IsLxcfsEnabled           bool     `yaml:"isLxcfsEnabled,omitempty"`
	Verbosity                int      `yaml:"verbosity,omitempty"`
}

func Load

func Load(s string) (*Config, error)

func LoadFile

func LoadFile(filename string) (*Config, error)

type DebugOptions

type DebugOptions struct {

	// target pod select options
	Namespace           string
	PodName             string
	Fork                bool
	ForkPodRetainLabels []string

	// Debug-container options
	Image                   string
	RegistrySecretName      string
	RegistrySecretNamespace string
	RegistrySkipTLSVerify   bool
	IsLxcfsEnabled          bool
	ContainerName           string
	Command                 []string
	AppName                 string
	ConfigLocation          string

	// Debug-agent options
	CreateDebugAgentPod      bool
	AgentImage               string
	AgentPort                int
	AgentImagePullPolicy     string
	AgentImagePullSecretName string

	// agentPodName = agentPodNamePrefix + nodeName
	AgentPodName      string
	AgentPodNamespace string
	AgentPodNode      string
	AgentPodResource  agentPodResources

	Flags      *genericclioptions.ConfigFlags
	CoreClient coreclient.CoreV1Interface
	KubeCli    *kubernetes.Clientset
	Args       []string
	Config     *restclient.Config

	// use for port-forward
	RESTClient    *restclient.RESTClient
	PortForwarder portForwarder
	Ports         []string
	StopChannel   chan struct{}
	ReadyChannel  chan struct{}

	PortForward         bool
	DebugAgentDaemonSet string
	DebugAgentNamespace string

	genericclioptions.IOStreams

	Verbosity int
	Logger    *log.Logger
	UserName  string
	// contains filtered or unexported fields
}

DebugOptions specify how to run debug container in a running pod

func NewDebugOptions

func NewDebugOptions(streams genericclioptions.IOStreams) *DebugOptions

NewDebugOptions new debug options

func (*DebugOptions) Complete

func (o *DebugOptions) Complete(cmd *cobra.Command, args []string, argsLenAtDash int) error

Complete populate default values from KUBECONFIG file

func (*DebugOptions) Run

func (o *DebugOptions) Run() error

TODO: refactor Run() spaghetti code Run run

func (*DebugOptions) Validate

func (o *DebugOptions) Validate() error

Validate validate

Jump to

Keyboard shortcuts

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