tasklog

package
v1.9.30 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustCreateRegex

func MustCreateRegex(varName string) *regexp.Regexp

Types

type Input

type Input struct {
	HostName                  string
	PodName                   string
	Namespace                 string
	ContainerName             string
	ContainerID               string
	LogName                   string
	PodRFC3339StartTime       string
	PodRFC3339FinishTime      string
	PodUnixStartTime          int64
	PodUnixFinishTime         int64
	PodUID                    string
	TaskExecutionIdentifier   *core.TaskExecutionIdentifier
	ExtraTemplateVarsByScheme *TemplateVarsByScheme
}

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
}

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(i 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. See `defaultRegexes` for supported templates.

func NewTemplateLogPlugin

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

NewTemplateLogPlugin creates a template-based log plugin with the provided template Uri and message format. See `defaultRegexes` for supported templates.

func (TemplateLogPlugin) GetTaskLog

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

func (TemplateLogPlugin) GetTaskLogs

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

type TemplateScheme

type TemplateScheme int
const (
	TemplateSchemePod TemplateScheme = iota
	TemplateSchemeTaskExecution
)

func TemplateSchemeString

func TemplateSchemeString(s string) (TemplateScheme, error)

TemplateSchemeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func TemplateSchemeValues

func TemplateSchemeValues() []TemplateScheme

TemplateSchemeValues returns all values of the enum

func (TemplateScheme) IsATemplateScheme

func (i TemplateScheme) IsATemplateScheme() bool

IsATemplateScheme returns "true" if the value is listed in the enum definition. "false" otherwise

func (TemplateScheme) MarshalJSON

func (i TemplateScheme) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for TemplateScheme

func (TemplateScheme) MarshalYAML

func (i TemplateScheme) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for TemplateScheme

func (TemplateScheme) String

func (i TemplateScheme) String() string

func (*TemplateScheme) UnmarshalJSON

func (i *TemplateScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for TemplateScheme

func (*TemplateScheme) UnmarshalYAML

func (i *TemplateScheme) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for TemplateScheme

type TemplateVar

type TemplateVar struct {
	Regex *regexp.Regexp
	Value string
}

type TemplateVars

type TemplateVars []TemplateVar

type TemplateVarsByScheme

type TemplateVarsByScheme struct {
	Common        TemplateVars
	Pod           TemplateVars
	TaskExecution TemplateVars
}

Jump to

Keyboard shortcuts

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