plugin

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLOUR_NONE      = 0
	COLOUR_ERRORS    = 1
	COLOUR_COLUMNS   = 2
	COLOUR_MIX       = 3
	COLOUR_CUSTOM    = 4
	COLOUR_CUSTOMMIX = 5
)
View Source
const TypeIDContainer string = "C"
View Source
const TypeIDCronJob string = "O"
View Source
const TypeIDDaemonSet string = "A"
View Source
const TypeIDDeployment string = "D"
View Source
const TypeIDEphemeralContainer string = "E"
View Source
const TypeIDInitContainer string = "I"
View Source
const TypeIDJob string = "J"
View Source
const TypeIDNode string = "N"
View Source
const TypeIDPod string = "P"
View Source
const TypeIDReplicaSet string = "R"
View Source
const TypeIDStatefulSet string = "S"
View Source
const TypeNameContainer string = "Container"
View Source
const TypeNameCronJob string = "CronJob"
View Source
const TypeNameDaemonSet string = "DaemonSet"
View Source
const TypeNameDeployment string = "Deployment"
View Source
const TypeNameEphemeralContainer string = "EphemeralContainer"
View Source
const TypeNameInitContainer string = "InitContainer"
View Source
const TypeNameJob string = "Job"
View Source
const TypeNameNode string = "Node"
View Source
const TypeNamePod string = "Pod"
View Source
const TypeNameReplicaSet string = "ReplicaSet"
View Source
const TypeNameStatefulSet string = "StatefulSet"

Variables

View Source
var LogDebug bool

Functions

func Capabilities added in v0.0.19

func Capabilities(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

list details of configured liveness readiness and startup capabilities

func Commands

func Commands(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Environment added in v0.2.0

func Environment(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Image

func Image(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func InitSubCommands

func InitSubCommands(rootCmd *cobra.Command)

func Lifecycle added in v0.1.0

func Lifecycle(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Ports

func Ports(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string, runip bool) error

Ports show the port infor for each container

	runip - true = show ip details only
          - false = show all port info except ip info

func Probes

func Probes(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

list details of configured liveness readiness and startup probes

func Resources

func Resources(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string, resourceType string) error

func Restarts

func Restarts(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Security added in v0.0.19

func Security(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

list details of configured liveness readiness and startup security

func Status

func Status(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Version added in v0.1.6

func Version(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

func Volumes

func Volumes(cmd *cobra.Command, kubeFlags *genericclioptions.ConfigFlags, args []string) error

Types

type BuilderInformation added in v0.2.0

type BuilderInformation struct {
	// Pod  *v1.Pod
	Data          ParentData
	PodName       string
	ContainerType string // single letter type id
	Namespace     string
	NodeName      string
	Name          string // objects name
	TreeView      bool
	TypeName      string // k8s kind
}

type Cell added in v0.0.7

type Cell struct {
	// contains filtered or unexported fields
}

func NewCellColourFloat added in v0.2.11

func NewCellColourFloat(colour [2]int, text string, value float64) Cell

NewCellFloat quick wrapper to return a cell object containing the given colour, string and float

func NewCellColourInt added in v0.2.11

func NewCellColourInt(colour [2]int, text string, value int64) Cell

NewCellColorInt quick wrapper to return a cell object containing the given colour, string and int

func NewCellColourText added in v0.2.11

func NewCellColourText(colour [2]int, text string) Cell

NewCellColourText quick wrapper to return a cell object containing the given string and the colour to be used

func NewCellEmpty added in v0.2.7

func NewCellEmpty() Cell

func NewCellFloat added in v0.0.7

func NewCellFloat(text string, value float64) Cell

NewCellFloat quick wrapper to return a cell object containing the given string float

func NewCellInt added in v0.0.7

func NewCellInt(text string, value int64) Cell

NewCellInt quick wrapper to return a cell object containing the given string and int

func NewCellText added in v0.0.7

func NewCellText(text string) Cell

NewCellText quick wrapper to return a cell object containing the given string

func NewCellTextIndent added in v0.2.2

func NewCellTextIndent(text string, indentLevel int) Cell

NewCellTextIndent creates a text cell with an indentation indicator, this dosen't actually indent the cell it just

tells table.go Print to indent it for us

type Connector added in v0.0.13

type Connector struct {
	Flags commonFlags
	// contains filtered or unexported fields
}

func (*Connector) BuildOwnersList added in v0.2.1

func (c *Connector) BuildOwnersList() []*LeafNode

func (*Connector) GetConfigMapValue added in v0.0.13

func (c *Connector) GetConfigMapValue(configMap string, key string) string

func (*Connector) GetConfigMaps added in v0.0.13

func (c *Connector) GetConfigMaps(configMapName string) (v1.ConfigMap, error)

func (*Connector) GetCronJob added in v0.2.4

func (c *Connector) GetCronJob(jobName string, namespace string) *batchv1.CronJob

func (*Connector) GetDaemonSet added in v0.2.1

func (c *Connector) GetDaemonSet(daemonName string, namespace string) *a1.DaemonSet

func (*Connector) GetDeployment added in v0.2.1

func (c *Connector) GetDeployment(deploymentName string, namespace string) *a1.Deployment

func (*Connector) GetJob added in v0.2.4

func (c *Connector) GetJob(jobName string, namespace string) *batchv1.Job

func (*Connector) GetMetricPods added in v0.0.13

func (c *Connector) GetMetricPods(podNameList []string) ([]v1beta1.PodMetrics, error)

GetMetricPods get an array of pod metrics

func (*Connector) GetNamespace added in v0.0.13

func (c *Connector) GetNamespace(allNamespaces bool) string

GetNamespace retrieves the namespace that is currently set as default

func (*Connector) GetNodeLabels added in v0.1.5

func (c *Connector) GetNodeLabels(podList []v1.Pod) (map[string]map[string]string, error)

func (*Connector) GetNodes added in v0.1.5

func (c *Connector) GetNodes(nodeNameList []string) ([]v1.Node, error)

returns a list of nodes

func (*Connector) GetOwnersList added in v0.2.1

func (c *Connector) GetOwnersList() (map[string][]v1.Pod, map[string]string)

GetOwnersList calls GetOwnerReference for each pod and returns a unique list of owner types as the key with an array of pods as the value

func (*Connector) GetPodAnnotations added in v0.2.0

func (c *Connector) GetPodAnnotations(podList []v1.Pod) (map[string]map[string]string, error)

func (*Connector) GetPodLabels added in v0.1.5

func (c *Connector) GetPodLabels(podList []v1.Pod) (map[string]map[string]string, error)

func (*Connector) GetPods added in v0.0.13

func (c *Connector) GetPods(podNameList []string) ([]v1.Pod, error)

returns a list of pods or a list with one pod when given a pod name

func (*Connector) GetReplicaSet added in v0.2.1

func (c *Connector) GetReplicaSet(replicaName string, namespace string) *a1.ReplicaSet

func (*Connector) GetStatefulSet added in v0.2.1

func (c *Connector) GetStatefulSet(statefulsetName string, namespace string) *a1.StatefulSet

func (*Connector) LoadConfig added in v0.0.13

func (c *Connector) LoadConfig(configFlags *genericclioptions.ConfigFlags) error

load config for the k8s endpoint

func (*Connector) LoadCronJob added in v0.2.4

func (c *Connector) LoadCronJob(jobNameList []string, namespace string) error

func (*Connector) LoadDaemonSet added in v0.2.1

func (c *Connector) LoadDaemonSet(daemonNameList []string, namespace string) error

func (*Connector) LoadDeployment added in v0.2.1

func (c *Connector) LoadDeployment(deploymentNameList []string, namespace string) error

func (*Connector) LoadJob added in v0.2.4

func (c *Connector) LoadJob(jobNameList []string, namespace string) error

func (*Connector) LoadMetricConfig added in v0.0.13

func (c *Connector) LoadMetricConfig(configFlags *genericclioptions.ConfigFlags) error

load config for the metrics endpoint

func (*Connector) LoadPods added in v0.2.0

func (c *Connector) LoadPods(podNameList []string) error

func (*Connector) LoadReplicaSet added in v0.2.1

func (c *Connector) LoadReplicaSet(replicaNameList []string, namespace string) error

func (*Connector) LoadStatefulSet added in v0.2.1

func (c *Connector) LoadStatefulSet(statefulNameList []string, namespace string) error

func (*Connector) SelectMatchinghPodSpec added in v0.0.18

func (c *Connector) SelectMatchinghPodSpec(pods []v1.Pod) ([]v1.Pod, error)

SelectMatchingPodSpec select pods to inclue or exclude based on the field in v1.Pods.Spec an operator (!=, ==, =) and a string value to match with

func (*Connector) SetNamespace added in v0.0.13

func (c *Connector) SetNamespace(namespace string)

SetNamespace sets the namespace to use when searching for pods

type LeafNode added in v0.2.2

type LeafNode struct {
	// contains filtered or unexported fields
}

type Looper added in v0.2.0

type Looper interface {
	BuildBranch(info BuilderInformation, rows [][]Cell) ([]Cell, error)
	BuildContainerSpec(container v1.Container, info BuilderInformation) ([][]Cell, error)
	BuildEphemeralContainerSpec(container v1.EphemeralContainer, info BuilderInformation) ([][]Cell, error)
	BuildContainerStatus(container v1.ContainerStatus, info BuilderInformation) ([][]Cell, error)
	BuildPodRow(pod v1.Pod, info BuilderInformation) ([][]Cell, error)
	Headers() []string
	HideColumns(info BuilderInformation) []int
}

type ParentData added in v0.2.2

type ParentData struct {
	// contains filtered or unexported fields
}

type RowBuilder added in v0.2.0

type RowBuilder struct {
	Connection    *Connector
	Table         *Table
	CommonFlags   commonFlags
	PodName       []string // list of pod names to retrieve
	LoopStatus    bool     // do we need to loop over v1.Pod.Status.ContainerStatus
	LoopSpec      bool     // should we loop over v1.Pod.Spec.Containers
	LabelNodeName string

	LabelPodName string

	AnnotationPodName string

	ShowTreeView       bool // show the standard tree view with the resource sets as the root
	ShowPodName        bool
	ShowInitContainers bool
	ShowContainerType  bool
	ShowNodeTree       bool                  // show the tree view with the nodes at the root level rather than just the resource sets at root
	DontListContainers bool                  // dont loop through containers, only the main pod
	FilterList         map[string]matchValue // used to filter out rows from the table during Print function
	CalcFiltered       bool                  // the filterd out rows are included in the branch calculations
	DefaultHeaderLen   int
	InputFilename      string // filename to be used as the source instead of reading pod information from k8s api
	StdinChanged       bool   // have we been run as part of a shell redirect
	// contains filtered or unexported fields
}

func (*RowBuilder) Build added in v0.2.1

func (b *RowBuilder) Build(loop Looper) error

Build

func (*RowBuilder) BuildContainerTable added in v0.2.1

func (b *RowBuilder) BuildContainerTable(loop Looper, info *BuilderInformation, podList []v1.Pod) error

Build normal table

func (RowBuilder) HasStdinChanged added in v0.2.7

func (b RowBuilder) HasStdinChanged() (bool, error)

func (*RowBuilder) LoadHeaders added in v0.2.0

func (b *RowBuilder) LoadHeaders(loop Looper, info *BuilderInformation) error

LoadHeaders sets the default column headers hiding as needed

func (*RowBuilder) SetFlagsFrom added in v0.2.0

func (b *RowBuilder) SetFlagsFrom(commonFlagList commonFlags)

SetFlagsFrom sets the common flags to match the values retrieved from the passed object

type Table added in v0.0.4

type Table struct {
	ColourOutput  int
	CustomColours [][2]int
	// contains filtered or unexported fields
}

func (*Table) AddPlaceHolderRow added in v0.2.1

func (t *Table) AddPlaceHolderRow() int

AddPlaceHolderRow - Adds an updatable row to the table, returns an update id that can be used with UpdatePlaceHolderRow

func (*Table) AddRow added in v0.0.4

func (t *Table) AddRow(row ...Cell)

AddRow Adds a new row to the end of the table, accepts an array of strings

func (*Table) GetRows added in v0.0.7

func (t *Table) GetRows() [][]Cell

GetRows does what it says on the tin

func (*Table) HideColumn added in v0.0.4

func (t *Table) HideColumn(columnNumber int)

HideColumn select the column number to hide, columns numbers are the unsorted column number

func (*Table) HideOnlyNamedColumns added in v0.2.7

func (t *Table) HideOnlyNamedColumns(columnName []string) error

HideTheseColumns hides the column number to hide, columns numbers are the unsorted column number

func (*Table) HidePlaceHolderRow added in v0.2.1

func (t *Table) HidePlaceHolderRow(id int)

HidePlaceHolderRow matches the placeholder id to an actual row number and calls HideRows to hide the row

func (*Table) HideRows added in v0.0.7

func (t *Table) HideRows(rowID []int)

HideRows just sets the hide row flag, used by the print function to exclude the row from the output

func (*Table) ListOutOfRange added in v0.0.7

func (t *Table) ListOutOfRange(columnID int) ([]int, error)

ListOutOfRange when given a columnID to work with it will calculate a range and returns a list of rows with values outside that range

func (*Table) Order added in v0.0.4

func (t *Table) Order(items ...int)

Order changes the order of columns displayed in the table, specifying a subset of the column numbers will place those at the front in the order specified all other columns remain untouched

func (*Table) Print added in v0.0.4

func (t *Table) Print()

Print outputs the table on the terminal, taking the column order and visibiliy into account

func (*Table) PrintCsv added in v0.1.0

func (t *Table) PrintCsv()

PrintCsv outputs the table as a csv including the header row. all fileds are shown and all are unsorted as other programs can be used to filter and sort

func (*Table) PrintJson added in v0.0.4

func (t *Table) PrintJson()

PrintJson outputs the table on the terminal as json, all fileds are shown and all are unsorted as programs like jq can be used to filter and sort

func (*Table) PrintList added in v0.1.0

func (t *Table) PrintList()

PrintList outputs the key and value on a single line by its self. all fileds are shown and all are unsorted as other programs can be used to filter and sort

func (*Table) PrintYaml added in v0.1.0

func (t *Table) PrintYaml()

PrintYaml outputs the table on the terminal as yaml, all fileds are shown and all are unsorted as other programs can be used to filter and sort

func (*Table) SetHeader added in v0.0.4

func (t *Table) SetHeader(headItem ...string)

SetHeader sets the header row to the specified array of strings headerRow is always reinitilized to empty before headers are added

func (*Table) SortByNames added in v0.0.4

func (t *Table) SortByNames(name ...string) error

SortByNames given a , seperated list of names match them to actual headers and sort each one in order by default sorts in ascending to revers use ! in front of the header name returns error on fail and nil otherwise

func (*Table) UpdatePlaceHolderRow added in v0.2.1

func (t *Table) UpdatePlaceHolderRow(id int, cellList []Cell)

UpdatePlaceHolderRow - updates the given placeholder at id with the contents of cellList

Jump to

Keyboard shortcuts

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