utils

package
v0.0.0-...-9f7fac4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPodsSummary

func AllPodsSummary(pods []corev1.Pod) string

func CompactTestLogs

func CompactTestLogs(input string, threshold float64) string

func CrashLoopBackOffSummary

func CrashLoopBackOffSummary(pods []corev1.Pod) string

func DeduplicateLogsWithWindow

func DeduplicateLogsWithWindow(input string, threshold float64, windowSize int) string

DeduplicateLogsWithWindow removes similar lines based on relative similarity threshold within a sliding window of the last `windowSize` lines.

func ErrorStateSummary

func ErrorStateSummary(pods []corev1.Pod) string

func ExtractFailedJobsFromAggregate

func ExtractFailedJobsFromAggregate(logData string) map[string]bool

func ExtractFailingTestsBlock

func ExtractFailingTestsBlock(input string) (string, error)

func ExtractFlakyTestsBlock

func ExtractFlakyTestsBlock(input string) (string, error)

func ExtractMonitorTestFailures

func ExtractMonitorTestFailures(input string) (string, error)

func ExtractPath

func ExtractPath(url string) string

func ExtractProwJobInfo

func ExtractProwJobInfo(jobURL string) (string, string, error)

func ExtractStepName

func ExtractStepName(logLine string) (string, error)

ExtractStepName parses a log line and extracts the step name

func ExtractTestNameFromURL

func ExtractTestNameFromURL(url string) (string, error)

ExtractTestNameFromURL extracts the first "e2e-*" segment from a prow job URL

func FetchAggregateJobFailures

func FetchAggregateJobFailures(baseUrl, logData string) (string, error)

func FetchJSONBytes

func FetchJSONBytes(url string) ([]byte, error)

FetchJSONBytes fetches JSON data from the given URL and returns it as a byte slice.

func FetchTopLevelKeys

func FetchTopLevelKeys(data []byte) ([]string, error)

FetchTopLevelKeys fetches JSON from the URL and returns the top-level keys only.

func FetchURL

func FetchURL(url string) (string, error)

FetchURL fetches data from the given URL and returns it as a string

func FilterAcceptedTags

func FilterAcceptedTags(release *api.Release) []api.Tag

FilterAcceptedTags filters only tags with Phase == "Accepted"

func FilterPodsByNamespaceAsString

func FilterPodsByNamespaceAsString(pods []corev1.Pod, namespace string) string

func FilterPodsByNodeAsString

func FilterPodsByNodeAsString(pods []corev1.Pod, nodeName string) string

func FilterRejectedTags

func FilterRejectedTags(release *api.Release) []api.Tag

FilterRejectedTags filters only tags with Phase == "Rejected"

func FindNodeByName

func FindNodeByName(nodes []corev1.Node, name string) (*corev1.Node, error)

func GetContainerLogFilePath

func GetContainerLogFilePath(gatherExtraPath, podName, namespace, containerName string) string

func GetContainerNamesInPod

func GetContainerNamesInPod(pods []corev1.Pod, podName string) string

GetContainerNamesInPod returns a string of container names in the specified pod.

func GetErrorAndWarningFromSpyglassFile

func GetErrorAndWarningFromSpyglassFile(spyglassFilePath string) (string, error)

func GetGatherExtraFolderPath

func GetGatherExtraFolderPath(prowurl string) (string, error)

func GetNodeAnnotationsString

func GetNodeAnnotationsString(node *corev1.Node) string

GetNodeAnnotationsString returns all annotations from node metadata as a string

func GetNodeConditionsString

func GetNodeConditionsString(node *corev1.Node) string

GetNodeConditionsString returns node condition information as a formatted string

func GetNodeInfoString

func GetNodeInfoString(node *corev1.Node) string

GetNodeInfoString safely extracts and returns NodeInfo from a Node object as a formatted string

func GetNodeLabelsString

func GetNodeLabelsString(node *corev1.Node) string

GetNodeLabelsString returns all labels from node metadata as a string

func GetPodsByNamespace

func GetPodsByNamespace(pods []corev1.Pod, namespace string) []corev1.Pod

func GetSpyglassDataRelevantToTestFailure

func GetSpyglassDataRelevantToTestFailure(spyglassFilePath, testName string) (string, error)

Given a test name check for the Locator.Keys objects in the spyglass data to see if there is an entry with key "e2e-test" that matches the test name. return result as string

func GetSpyglassFileNames

func GetSpyglassFileNames(logsPath, testName, stepFolder string) ([]string, error)

func IndentMultiline

func IndentMultiline(s, indent string) string

func InitStateSummary

func InitStateSummary(pods []corev1.Pod) string

func LoadClusterOperatorsFromFile

func LoadClusterOperatorsFromFile(filePath string) ([]configv1.ClusterOperator, error)

Load JSON array of ClusterOperators from file

func LoadClusterVersionFromFile

func LoadClusterVersionFromFile(filePath string) (*configv1.ClusterVersion, error)

Load ClusterVersion object from file

func LoadNodesFromFile

func LoadNodesFromFile(path string) ([]corev1.Node, error)

func LoadPodsFromFile

func LoadPodsFromFile(path string) ([]corev1.Pod, error)

func ParseAPIReleaseInfo

func ParseAPIReleaseInfo(data []byte) (*api.APIReleaseInfo, error)

ParseAPIReleaseInfo converts raw JSON bytes into APIReleaseInfo

func ParseChangeLog

func ParseChangeLog(data []byte) (*api.ChangeLog, error)

func ParseChangeLogComponentInfoList

func ParseChangeLogComponentInfoList(data []byte) ([]api.ChangeLogComponentInfo, error)

func ParseChangeLogImageInfoList

func ParseChangeLogImageInfoList(data []byte) ([]api.ChangeLogImageInfo, error)

func ParseChangeLogReleaseInfo

func ParseChangeLogReleaseInfo(data []byte) (*api.ChangeLogReleaseInfo, error)

func ParseCommitInfoList

func ParseCommitInfoList(data []byte) ([]api.CommitInfo, error)

func ParseRelease

func ParseRelease(data []byte) (*api.Release, error)

ParseRelease parses a JSON byte slice into a Release struct

func ParseUpgradeHistoryList

func ParseUpgradeHistoryList(data []byte) ([]api.UpgradeHistory, error)

func ParseVerificationJobsSummary

func ParseVerificationJobsSummary(data []byte) (*api.VerificationJobsSummary, error)

func ParseVerificationStatusMap

func ParseVerificationStatusMap(data []byte) (api.VerificationStatusMap, error)

func PendingPodsSummary

func PendingPodsSummary(pods []corev1.Pod) string

func RunningPodsSummary

func RunningPodsSummary(pods []corev1.Pod) string

Types

type EventInterval

type EventInterval struct {
	Level             string  `json:"level"`
	Display           bool    `json:"display"`
	Source            string  `json:"source,omitempty"`
	StructuredLocator Locator `json:"locator"`
	StructuredMessage Message `json:"message"`

	From *time.Time `json:"from"`
	To   *time.Time `json:"to"`
	// Filename is the base filename we read the intervals from in gcs. If multiple,
	// that usually means one for upgrade and one for conformance portions of the job run.
	// TODO: this may need to be revisited once we're further along with the UI/new schema.
	Filename string `json:"filename"`
}

type Locator

type Locator struct {
	Type string            `json:"type"`
	Keys map[string]string `json:"keys"`
}

Types originally from origin monitorapi package

type Message

type Message struct {
	Reason       string            `json:"reason"`
	Cause        string            `json:"cause"`
	HumanMessage string            `json:"humanMessage"`
	Annotations  map[string]string `json:"annotations"`
}

type Report

type Report struct {
	Items []EventInterval `json:"items"`
}

Jump to

Keyboard shortcuts

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