Documentation ¶
Index ¶
- Constants
- Variables
- func ContainerGenerator(ctx context.Context, config *DockerConfig, client *dockerclient.Client) (iter.Seq[types.ContainerJSON], error)
- func FilteredContainerGenerator(ctx context.Context, config *DockerConfig, client *dockerclient.Client, ...) (iter.Seq[*DockerTarget], error)
- func List(ctx context.Context, client kubernetes.Interface, config *Config) (map[string]string, error)
- func Run(ctx context.Context, client kubernetes.Interface, config *Config) error
- func RunDocker(ctx context.Context, client *dockerclient.Client, config *DockerConfig) error
- func SetColorList(podColors, containerColors []string) error
- func WatchDockers(ctx context.Context, config *DockerConfig, filter *dockerTargetFilter, ...) (chan *DockerTarget, error)
- func WatchTargets(ctx context.Context, i v1.PodInterface, labelSelector labels.Selector, ...) (chan *Target, error)
- type Config
- type ContainerState
- type DockerConfig
- type DockerTail
- type DockerTarget
- type FileTail
- type Log
- type ResourceMatcher
- type ResumeRequest
- type Tail
- func (t *Tail) Close()
- func (t *Tail) ConsumeRequest(ctx context.Context, request rest.ResponseWrapper) error
- func (t *Tail) GetResumeRequest() *ResumeRequest
- func (t *Tail) Print(msg string)
- func (t *Tail) Resume(ctx context.Context, resumeRequest *ResumeRequest) error
- func (t *Tail) Start(ctx context.Context) error
- type TailOptions
- type Target
Constants ¶
const ( RUNNING = "running" WAITING = "waiting" TERMINATED = "terminated" ALL_STATES = "all" )
const TimestampFormatDefault = "2006-01-02T15:04:05.000000000Z07:00"
RFC3339Nano with trailing zeros
const TimestampFormatShort = "01-02 15:04:05"
time.DateTime without year
Variables ¶
var ( PodMatcher = ResourceMatcher{/* contains filtered or unexported fields */} ReplicationControllerMatcher = ResourceMatcher{/* contains filtered or unexported fields */} ServiceMatcher = ResourceMatcher{/* contains filtered or unexported fields */} DaemonSetMatcher = ResourceMatcher{/* contains filtered or unexported fields */} DeploymentMatcher = ResourceMatcher{/* contains filtered or unexported fields */} ReplicaSetMatcher = ResourceMatcher{/* contains filtered or unexported fields */} StatefulSetMatcher = ResourceMatcher{/* contains filtered or unexported fields */} JobMatcher = ResourceMatcher{/* contains filtered or unexported fields */} // job does not have a short name ResourceMatchers = []ResourceMatcher{ PodMatcher, ReplicationControllerMatcher, ServiceMatcher, DeploymentMatcher, DaemonSetMatcher, ReplicaSetMatcher, StatefulSetMatcher, JobMatcher, } )
Functions ¶
func ContainerGenerator ¶
func ContainerGenerator(ctx context.Context, config *DockerConfig, client *dockerclient.Client) (iter.Seq[types.ContainerJSON], error)
func FilteredContainerGenerator ¶
func FilteredContainerGenerator(ctx context.Context, config *DockerConfig, client *dockerclient.Client, filter *dockerTargetFilter) (iter.Seq[*DockerTarget], error)
func List ¶
func List(ctx context.Context, client kubernetes.Interface, config *Config) (map[string]string, error)
List returns a map of all 'app.kubernetes.io/instance' values.
func RunDocker ¶
func RunDocker(ctx context.Context, client *dockerclient.Client, config *DockerConfig) error
func SetColorList ¶
func WatchDockers ¶
func WatchDockers(ctx context.Context, config *DockerConfig, filter *dockerTargetFilter, client *dockerclient.Client) (chan *DockerTarget, error)
Types ¶
type Config ¶
type Config struct { Namespaces []string PodQuery *regexp.Regexp ExcludePodQuery []*regexp.Regexp Timestamps bool TimestampFormat string Location *time.Location ContainerQuery *regexp.Regexp ExcludeContainerQuery []*regexp.Regexp ContainerStates []ContainerState Exclude []*regexp.Regexp Include []*regexp.Regexp Highlight []*regexp.Regexp InitContainers bool EphemeralContainers bool Since time.Duration AllNamespaces bool LabelSelector labels.Selector FieldSelector fields.Selector TailLines *int64 Template *template.Template Follow bool Resource string OnlyLogLines bool MaxLogRequests int Stdin bool DiffContainer 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 DockerConfig ¶
type DockerConfig struct { Timestamps bool TimestampFormat string Location *time.Location ContainerQuery []*regexp.Regexp ExcludeContainerQuery []*regexp.Regexp Exclude []*regexp.Regexp ImageQuery []*regexp.Regexp Include []*regexp.Regexp Highlight []*regexp.Regexp Since time.Duration TailLines int64 Template *template.Template Follow bool OnlyLogLines bool MaxLogRequests int Stdin bool Out io.Writer ErrOut io.Writer }
Config contains the config for tailfin
type DockerTail ¶
type DockerTail struct { ContainerId string ContainerName string ComposeProject string Tty bool StartedAt time.Time FinishedAt string Options *TailOptions // contains filtered or unexported fields }
func NewDockerTail ¶
func NewDockerTail( client *dockerclient.Client, containerId string, containerName string, composeProject string, tty bool, startedAt time.Time, finishedAt string, tmpl *template.Template, out, errOut io.Writer, options *TailOptions, ) *DockerTail
func (*DockerTail) Close ¶
func (t *DockerTail) Close()
func (*DockerTail) Print ¶
func (t *DockerTail) Print(msg string)
type DockerTarget ¶
type FileTail ¶
type FileTail struct { Options *TailOptions // contains filtered or unexported fields }
func NewFileTail ¶
func NewFileTail(tmpl *template.Template, in io.Reader, out, errOut io.Writer, options *TailOptions) *FileTail
NewFileTail returns a new tail of the input reader
func (*FileTail) ConsumeReader ¶
ConsumeReader reads the data from the reader and writes into the out writer.
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"` // Docker compose project name ComposeProject string `json:"composeProject"` PodColor *color.Color `json:"-"` ComposeColor *color.Color `json:"-"` ContainerColor *color.Color `json:"-"` }
Log is the object which will be used together with the template to generate the output.
type ResourceMatcher ¶
type ResourceMatcher struct {
// contains filtered or unexported fields
}
ResourceMatcher is a matcher for Kubernetes resources
func (*ResourceMatcher) AllNames ¶
func (r *ResourceMatcher) AllNames() []string
AllNames returns the resource names including the aliases
func (*ResourceMatcher) Matches ¶
func (r *ResourceMatcher) Matches(name string) bool
Matches returns if name matches one of the resource names
func (*ResourceMatcher) Name ¶
func (r *ResourceMatcher) Name() string
Name returns the resource name in singular
type ResumeRequest ¶
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, diffContainer bool) *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.
func (*Tail) GetResumeRequest ¶
func (t *Tail) GetResumeRequest() *ResumeRequest
type TailOptions ¶
type TailOptions struct { Timestamps bool TimestampFormat string Location *time.Location SinceSeconds *int64 DockerSinceTime time.Time SinceTime *metav1.Time Exclude []*regexp.Regexp Include []*regexp.Regexp Highlight []*regexp.Regexp Namespace bool TailLines *int64 DockerTailLines string Follow bool OnlyLogLines bool // contains filtered or unexported fields }
func (TailOptions) HighlightMatchedString ¶
func (o TailOptions) HighlightMatchedString(msg string) string
func (TailOptions) IsExclude ¶
func (o TailOptions) IsExclude(msg string) bool
func (TailOptions) IsInclude ¶
func (o TailOptions) IsInclude(msg string) bool
func (TailOptions) UpdateTimezoneAndFormat ¶
func (o TailOptions) UpdateTimezoneAndFormat(timestamp string) (string, error)
type Target ¶
Target is a target to watch
func ListTargets ¶
func ListTargets(ctx context.Context, i corev1client.PodInterface, labelSelector labels.Selector, fieldSelector fields.Selector, filter *targetFilter) ([]*Target, error)
ListTargets returns targets by listing and filtering pods