tasklog

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	HostName          string `json:"hostname"`
	PodName           string `json:"podName"`
	Namespace         string `json:"namespace"`
	ContainerName     string `json:"containerName"`
	ContainerID       string `json:"containerId"`
	LogName           string `json:"logName"`
	PodUnixStartTime  int64  `json:"podUnixStartTime"`
	PodUnixFinishTime int64  `json:"podUnixFinishTime"`
}

Input contains all available information about task's execution that a log plugin can use to construct task's log links.

type Output

type Output struct {
	TaskLogs []*core.TaskLog `json:"taskLogs"`
}

Output contains all task logs a plugin generates for a given Input.

type Plugin

type Plugin interface {
	// Generates a TaskLog object given necessary computation information
	GetTaskLogs(input Input) (logs Output, err error)
}

Plugin represents an interface for task log plugins to implement to plug generated task log links into task events.

type TemplateLogPlugin

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

A simple log plugin that supports templates in urls to build the final log link. Supported templates are: {{ .podName }}: Gets the pod name as it shows in k8s dashboard, {{ .namespace }}: K8s namespace where the pod runs, {{ .containerName }}: The container name that generated the log, {{ .containerId }}: The container id docker/crio generated at run time, {{ .logName }}: A deployment specific name where to expect the logs to be. {{ .hostname }}: The hostname where the pod is running and where logs reside. {{ .podUnixStartTime }}: The pod creation time (in unix seconds, not millis) {{ .podUnixFinishTime }}: Don't have a good mechanism for this yet, but approximating with time.Now for now

func NewTemplateLogPlugin

func NewTemplateLogPlugin(templateUris []string, messageFormat core.TaskLog_MessageFormat) TemplateLogPlugin

NewTemplateLogPlugin creates a template-based log plugin with the provided template Uri and message format. Supported templates are: {{ .podName }}: Gets the pod name as it shows in k8s dashboard, {{ .namespace }}: K8s namespace where the pod runs, {{ .containerName }}: The container name that generated the log, {{ .containerId }}: The container id docker/crio generated at run time, {{ .logName }}: A deployment specific name where to expect the logs to be. {{ .hostname }}: The hostname where the pod is running and where logs reside.

func (TemplateLogPlugin) GetTaskLog

func (s TemplateLogPlugin) GetTaskLog(podName, namespace, containerName, containerID, logName string, podUnixStartTime, podUnixFinishTime int64) (core.TaskLog, error)

func (TemplateLogPlugin) GetTaskLogs

func (s TemplateLogPlugin) GetTaskLogs(input Input) (Output, error)

Jump to

Keyboard shortcuts

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