stern

package
v0.0.0-...-747b0db Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUNNING    = "running"
	WAITING    = "waiting"
	TERMINATED = "terminated"
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, config *Config) error

Run starts the main run loop

func Watch

func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp, containerFilter *regexp.Regexp, containerExcludeFilter *regexp.Regexp, initContainers bool, containerState ContainerState, labelSelector labels.Selector, timeoutSeconds int64, closed chan bool, restart chan bool) (chan *Target, chan *Target, error)

Types

type Config

type Config struct {
	KubeConfig            string
	ContextName           string
	ClusterName           string
	Namespace             string
	PodQuery              *regexp.Regexp
	Timestamps            bool
	ContainerQuery        *regexp.Regexp
	ExcludeContainerQuery *regexp.Regexp
	ContainerState        ContainerState
	Exclude               []*regexp.Regexp
	Include               []*regexp.Regexp
	InitContainers        bool
	Since                 time.Duration
	AllNamespaces         bool
	LabelSelector         labels.Selector
	TailLines             *int64
	Template              *template.Template
	GraylogServer         string
	GraylogRetries        int
	GraylogTransport      string
	GraylogPort           string
	GraylogCacerts        string
	GraylogInsecure       bool
	ClientTimeout         int64
	ClientQPS             float32
	ClientBurst           int
	ExitAfter             time.Duration
}

Config contains the config for stern

type ContainerState

type ContainerState []string

func NewContainerState

func NewContainerState(stateConfig []string) (ContainerState, error)

func (ContainerState) Match

func (stateConfig ContainerState) Match(containerState v1.ContainerState) bool

type Log

type Log struct {
	// Message is the log message itself
	Message string `json:"message"`

	// Namespace of the pod
	Namespace string `json:"namespace"`

	// PodName of the pod
	PodName string `json:"podName"`

	// ContainerName of the container
	ContainerName string `json:"containerName"`

	// Name of the node the pod is running on
	NodeName string `json:"nodeName"`

	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 {
	Namespace     string
	PodName       string
	ContainerName string
	NodeName      string
	Options       *TailOptions

	Active bool
	// contains filtered or unexported fields
}

Tail struct holds the data for tailing process

func NewTail

func NewTail(namespace, podName, containerName string, nodeName string, tmpl *template.Template, options *TailOptions) *Tail

NewTail returns a new tail for a Kubernetes container inside a pod

func (*Tail) Close

func (t *Tail) Close()

Close stops tailing

func (*Tail) PrintClose

func (t *Tail) PrintClose()

func (*Tail) PrintOpen

func (t *Tail) PrintOpen()

func (*Tail) PrintStreamNotReady

func (t *Tail) PrintStreamNotReady(err error)

func (*Tail) Start

func (t *Tail) Start(ctx context.Context, i v1.PodInterface, gelfWriter *gelf.TCPWriter, httpClient *http.Client, caCertPool *x509.CertPool, logC chan<- string)

Start starts tailing

type TailOptions

type TailOptions struct {
	Timestamps       bool
	SinceSeconds     int64
	Exclude          []*regexp.Regexp
	Include          []*regexp.Regexp
	Namespace        bool
	TailLines        *int64
	ContextName      string
	ClusterName      string
	GraylogServer    string
	GraylogRetries   int
	GraylogTransport string
	GraylogPort      string
	GraylogCacerts   string
	GraylogInsecure  bool
}

TailOptions struct holds the options for tailing process

type Target

type Target struct {
	Namespace string
	Pod       string
	Container string
	NodeName  string
}

Target is a target to watch

func (*Target) GetID

func (t *Target) GetID() string

GetID returns the ID of the object

Jump to

Keyboard shortcuts

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