targetselector

package
v1.1.1-0...-9418116 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContainerQuestion = "Select a container"

DefaultContainerQuestion defines the default question for selecting a container

View Source
const DefaultPodQuestion = "Select a pod"

DefaultPodQuestion defines the default question for selecting a pod

Variables

This section is empty.

Functions

func SelectPod

func SelectPod(client kubectl.Client, namespace string, labelSelector *string, question *string, onlyRunning bool, log log.Logger) (*v1.Pod, error)

SelectPod let's the user select a pod if necessary and optionally a container

Types

type CmdParameter

type CmdParameter struct {
	LabelSelector string
	Namespace     string
	ContainerName string
	PodName       string
	Pick          *bool
	Interactive   bool
}

CmdParameter holds the parameter we receive from the command

type ConfigParameter

type ConfigParameter struct {
	LabelSelector map[string]string
	Namespace     string
	ContainerName string
}

ConfigParameter holds the parameter we receive from the config

type SelectorParameter

type SelectorParameter struct {
	ConfigParameter ConfigParameter
	CmdParameter    CmdParameter
}

SelectorParameter holds the information from the config and the command overrides

func (*SelectorParameter) GetContainerName

func (t *SelectorParameter) GetContainerName() string

GetContainerName retrieves the container name from the parameters

func (*SelectorParameter) GetLabelSelector

func (t *SelectorParameter) GetLabelSelector(config *latest.Config) (string, error)

GetLabelSelector retrieves the label selector of the target

func (*SelectorParameter) GetNamespace

func (t *SelectorParameter) GetNamespace(config *latest.Config, kubeClient kubectl.Client) (string, error)

GetNamespace retrieves the target namespace

func (*SelectorParameter) GetPodName

func (t *SelectorParameter) GetPodName() string

GetPodName retrieves the pod name from the parameters

type TargetSelector

type TargetSelector struct {
	PodQuestion       *string
	ContainerQuestion *string

	AllowNonRunning bool
	SkipWait        bool
	// contains filtered or unexported fields
}

TargetSelector is the struct that will select a target

func NewTargetSelector

func NewTargetSelector(config *latest.Config, kubeClient kubectl.Client, sp *SelectorParameter, allowPick bool, imageSelector []string) (*TargetSelector, error)

NewTargetSelector creates a new target selector for selecting a target pod or container

func (*TargetSelector) GetContainer

func (t *TargetSelector) GetContainer(allowInitContainer bool, log log.Logger) (*v1.Pod, *v1.Container, error)

GetContainer retrieves a container and pod

func (*TargetSelector) GetPod

func (t *TargetSelector) GetPod(log log.Logger) (*v1.Pod, error)

GetPod retrieves a pod

Jump to

Keyboard shortcuts

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