Documentation ¶
Index ¶
- Constants
- func List(ctx context.Context, config *Config) (map[string]string, error)
- func Run(ctx context.Context, config *Config) error
- func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp, ...) (chan *Target, chan *Target, error)
- type Config
- type ContainerState
- type Log
- type Tail
- type TailOptions
- type Target
Constants ¶
View Source
const ( RUNNING = "running" WAITING = "waiting" TERMINATED = "terminated" )
Variables ¶
This section is empty.
Functions ¶
func Watch ¶
func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp, excludePodFilter *regexp.Regexp, containerFilter *regexp.Regexp, containerExcludeFilter *regexp.Regexp, initContainers bool, ephemeralContainers bool, containerStates []ContainerState, labelSelector labels.Selector, fieldSelector fields.Selector) (chan *Target, chan *Target, error)
Watch starts listening to Kubernetes events and emits modified containers/pods. The first result is targets added, the second is targets removed
Types ¶
type Config ¶
type Config struct { KubeConfig string ContextName string Namespaces []string PodQuery *regexp.Regexp ExcludePodQuery *regexp.Regexp Timestamps bool Location *time.Location ContainerQuery *regexp.Regexp ExcludeContainerQuery *regexp.Regexp ContainerStates []ContainerState Exclude []*regexp.Regexp Include []*regexp.Regexp InitContainers bool EphemeralContainers bool Since time.Duration AllNamespaces bool LabelSelector labels.Selector FieldSelector fields.Selector TailLines *int64 Template *template.Template Follow bool Out io.Writer ErrOut io.Writer }
Config contains the config for stern
type ContainerState ¶
type ContainerState string
func NewContainerState ¶
func NewContainerState(stateConfig string) (ContainerState, error)
NewContainerState returns corresponding ContainerState
func (ContainerState) Match ¶
func (stateConfig ContainerState) Match(containerState v1.ContainerState) bool
Match returns ContainerState is matched
type Log ¶
type Log struct { // Message is the log message itself Message string `json:"message"` // Node name of the pod NodeName string `json:"nodeName"` // Namespace of the pod Namespace string `json:"namespace"` // PodName of the pod PodName string `json:"podName"` // ContainerName of the container ContainerName string `json:"containerName"` PodColor *color.Color `json:"-"` ContainerColor *color.Color `json:"-"` }
Log is the object which will be used together with the template to generate the output.
type Tail ¶
type Tail struct { NodeName string Namespace string PodName string ContainerName string Options *TailOptions // contains filtered or unexported fields }
func NewTail ¶
func NewTail(clientset corev1client.CoreV1Interface, nodeName, namespace, podName, containerName string, tmpl *template.Template, out, errOut io.Writer, options *TailOptions) *Tail
NewTail returns a new tail for a Kubernetes container inside a pod
func (*Tail) ConsumeRequest ¶
ConsumeRequest reads the data from request and writes into the out writer.
type TailOptions ¶
type TailOptions struct { Timestamps bool Location *time.Location SinceSeconds int64 Exclude []*regexp.Regexp Include []*regexp.Regexp Namespace bool TailLines *int64 Follow bool }
func (TailOptions) IsExclude ¶
func (o TailOptions) IsExclude(msg string) bool
func (TailOptions) IsInclude ¶
func (o TailOptions) IsInclude(msg string) bool
func (TailOptions) UpdateTimezoneIfNeeded ¶
func (o TailOptions) UpdateTimezoneIfNeeded(message string) (string, error)
Click to show internal directories.
Click to hide internal directories.