Documentation ¶
Overview ¶
Package report handles reporting
Package report handles reporting ¶
Package report handles reporting
Index ¶
- Constants
- Variables
- func AddSourceAnalyzed(source string)
- func ClearReports()
- func ContributeIssue(log *zap.SugaredLogger, issue Issue) (err error)
- func ContributeIssuesMap(log *zap.SugaredLogger, source string, issues map[string]Issue) (err error)
- func GenerateHumanReport(log *zap.SugaredLogger, vzHelper helpers.VZHelper, reportCtx helpers.ReportCtx) (err error)
- func GetRelatedEventMessage(ns string) string
- func GetRelatedLogFromPodMessage(podLog string) string
- func GetRelatedPodMessage(pod, ns string) string
- func GetRelatedServiceMessage(service, ns string) string
- func GetRelatedVZResourceMessage() string
- func SingleMessage(message string) (messages []string)
- type Action
- type Issue
- func GetAllSourcesFilteredIssues(log *zap.SugaredLogger, includeInfo bool, minConfidence int, minImpact int) (filtered []Issue)
- func NewKnownIssueMessagesFiles(issueType string, source string, messages []string, fileNames []string) (issue Issue)
- func NewKnownIssueMessagesMatches(issueType string, source string, messages []string, matches []files.TextMatch) (issue Issue)
- func NewKnownIssueSupportingData(issueType string, source string, supportingData []SupportData) (issue Issue)
- type IssueReporter
- func (issueReporter *IssueReporter) AddKnownIssueMessagesFiles(issueType string, source string, messages []string, fileNames []string)
- func (issueReporter *IssueReporter) AddKnownIssueMessagesMatches(issueType string, source string, messages []string, matches []files.TextMatch)
- func (issueReporter *IssueReporter) AddKnownIssueSupportingData(issueType string, source string, supportingData []SupportData)
- func (issueReporter *IssueReporter) Contribute(log *zap.SugaredLogger, source string)
- type JSONPath
- type SupportData
Constants ¶
const ( ImagePullBackOff = "ImagePullBackOff" ImagePullRateLimit = "ImagePullRateLimit" ImagePullNotFound = "ImagePullNotFound" ImagePullService = "ImagePullService" InsufficientMemory = "InsufficientMemory" InsufficientCPU = "InsufficientCPU" IngressInstallFailure = "IngressInstallFailure" IngressLBLimitExceeded = "IngressLBLimitExceeded" IngressNoLoadBalancerIP = "IngressNoLoadBalancerIP" IngressOciIPLimitExceeded = "IngressOciIPLimitExceeded" InstallFailure = "InstallFailure" PendingPods = "PendingPods" PodProblemsNotReported = "PodProblemsNotReported" ComponentsNotReady = "ComponentsNotReady" IngressNoIPFound = "IngressNoIPFound" IstioIngressNoIP = "IstioIngressNoIP" IngressShapeInvalid = "IngressShapeInvalid" IstioIngressPrivateSubnet = "IstioIngressPrivateSubnet" NginxIngressPrivateSubnet = "NginxIngressPrivateSubnet" ExternalDNSConfigureIssue = "ExternalDNSConfigureIssue" KeycloakDataMigrationFailure = "KeycloakDataMigrationFailure" RancherIssues = "RancherIssues" VZClientHangingIssueDueToLongCertificateApproval = "VZClientHangingIssueDueToLongCertificateApproval" CertificateExpired = "CertificateExpired" CertificateExperiencingIssuesInCluster = "CertificateExperiencingIssuesInCluster" ClusterAPIClusterIssues = "ClusterAPIClusterIssues" CaCrtExpiredInCluster = "CaCrtExpiredInCluster" BlockStorageLimitExceeded = "BlockStorageLimitExceeded" TCPKeepIdleIssues = "TCPKeepIdleIssues" NamespaceCurrentlyInTerminatingStateForLongDuration = "NamespaceCurrentlyInTerminatingStateForLongDuration" InnoDBClusterResourceCurrentlyInTerminatingStateForLongDuration = "InnoDBClusterResourceCurrentlyInTerminatingStateForLongDuration" PodHangingOnDeletion = "PodHangingOnDeletion" PodWaitingOnReadinessGates = "PodWaitingOnReadiness" )
Known Issue Types.
const (
ConsultRunbook = "Consult %s using supporting details identified in the report"
)
Standard Action Summaries
Variables ¶
var KnownActions = map[string]Action{ ImagePullBackOff: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ImagePullBackOff][0])}, ImagePullRateLimit: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ImagePullRateLimit][0])}, ImagePullNotFound: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ImagePullNotFound][0])}, ImagePullService: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ImagePullService][0])}, InsufficientMemory: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[InsufficientMemory][0])}, InsufficientCPU: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[InsufficientCPU][0])}, IngressInstallFailure: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressInstallFailure][0])}, IngressLBLimitExceeded: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressLBLimitExceeded][0])}, IngressNoLoadBalancerIP: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressNoLoadBalancerIP][0])}, IngressOciIPLimitExceeded: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressOciIPLimitExceeded][0])}, InstallFailure: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[InstallFailure][0])}, PendingPods: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[PendingPods][0])}, PodProblemsNotReported: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[PodProblemsNotReported][0])}, IngressNoIPFound: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressNoIPFound][0])}, IstioIngressNoIP: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IstioIngressNoIP][0])}, IngressShapeInvalid: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IngressShapeInvalid][0])}, IstioIngressPrivateSubnet: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[IstioIngressPrivateSubnet][0])}, NginxIngressPrivateSubnet: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[NginxIngressPrivateSubnet][0])}, ExternalDNSConfigureIssue: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ExternalDNSConfigureIssue][0])}, KeycloakDataMigrationFailure: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[KeycloakDataMigrationFailure][0])}, ClusterAPIClusterIssues: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[ClusterAPIClusterIssues][0])}, RancherIssues: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[RancherIssues][0])}, BlockStorageLimitExceeded: {Summary: getConsultRunbookAction(ConsultRunbook, RunbookLinks[BlockStorageLimitExceeded][0])}, }
KnownActions are Standard Action types
var RunbookLinks = map[string][]string{ ImagePullBackOff: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/imagepullbackoff"}, ImagePullRateLimit: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/imagepullratelimit"}, ImagePullNotFound: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/imagepullnotfound"}, ImagePullService: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/imagepullservice"}, InsufficientMemory: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/insufficientmemory"}, InsufficientCPU: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/insufficientcpu"}, IngressInstallFailure: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingressinstallfailure"}, IngressLBLimitExceeded: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingresslblimitexceeded"}, IngressNoLoadBalancerIP: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingressnoloadbalancerip"}, IngressOciIPLimitExceeded: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingressociiplimitexceeded"}, InstallFailure: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/installfailure"}, PendingPods: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/pendingpods"}, PodProblemsNotReported: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/podproblemsnotreported"}, IngressNoIPFound: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingressnoloadbalancerip"}, IstioIngressNoIP: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/istioingressgatewaynoloadbalancerip"}, IngressShapeInvalid: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/ingressinvalidshape"}, IstioIngressPrivateSubnet: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/istioloadbalancercreation"}, NginxIngressPrivateSubnet: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/nginxloadbalancercreation"}, ExternalDNSConfigureIssue: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/externaldnsconfiguration"}, KeycloakDataMigrationFailure: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/keycloakdatamigrationfailure"}, ClusterAPIClusterIssues: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/clusterapiclusterissues"}, RancherIssues: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/rancherissues"}, BlockStorageLimitExceeded: {"https://verrazzano.io/" + version.GetEffectiveDocsVersion() + "/docs/troubleshooting/diagnostictools/analysisadvice/blockstoragelimitexceeded"}, }
RunbookLinks are known runbook links
Functions ¶
func AddSourceAnalyzed ¶
func AddSourceAnalyzed(source string)
AddSourceAnalyzed tells the report which sources have been analyzed. This way it knows the entire set of sources which were analyzed (not just the ones which had issues detected)
func ContributeIssue ¶
func ContributeIssue(log *zap.SugaredLogger, issue Issue) (err error)
ContributeIssue allows a single issue to be contributed
func ContributeIssuesMap ¶
func ContributeIssuesMap(log *zap.SugaredLogger, source string, issues map[string]Issue) (err error)
ContributeIssuesMap allows a map of issues to be contributed
func GenerateHumanReport ¶
func GenerateHumanReport(log *zap.SugaredLogger, vzHelper helpers.VZHelper, reportCtx helpers.ReportCtx) (err error)
GenerateHumanReport is a basic report generator TODO: This is super basic for now, need to do things like sort based on Confidence, add other formats on output, etc... Also add other niceties like time, Summary of what was analyzed, if no issues were found, etc...
func GetRelatedEventMessage ¶
GetRelatedEventMessage returns the message for an event, used for setting supporting data
func GetRelatedLogFromPodMessage ¶
GetRelatedLogFromPodMessage returns the message to indicate the issue in the pod log, in a given namespace
func GetRelatedPodMessage ¶
GetRelatedPodMessage returns the message for an issue in pod, used for setting supporting data
func GetRelatedServiceMessage ¶
GetRelatedServiceMessage returns the message for an issue in a service, used for setting supporting data
func GetRelatedVZResourceMessage ¶
func GetRelatedVZResourceMessage() string
GetRelatedVZResourceMessage returns the message for Verrazzano resource, used for setting supporting data
func SingleMessage ¶
SingleMessage is a helper which is useful when adding a single message to supporting data
Types ¶
type Action ¶
type Action struct { Summary string // Required, Summary of the action to take Links []string // Optional, runbook or other related Links with action details Steps []string // Optional, list of Steps to take (pointing to runbook is preferable if Actions are complex) }
Action describes what a user/developer should do to mitigate an issue that has been found. For example:
- Description of the action if more general
- Link(s) to a Runbook(s) are preferable here as instructions may evolve over time and may be complex
- A list of Steps to take
type Issue ¶
type Issue struct { Type string // Required, This identifies the type of issue. This is either a Known Issue type, or a custom type name Source string // Required, This is the source of the analysis, It may be the root of the cluster analyzed (ie: there can be multiple) Informational bool // Defaults to false, if this is not an issue but an Informational note (TBD: may separate these) Summary string // Required, there must be a Summary of the issue included Actions []Action // Optional, if Actions are known these are included. Actions will be reported in the order specified SupportingData []SupportData // Optional but highly desirable for issues when possible. Data that helps support issue identification Confidence int // Required if not informational 0-10 () Impact int // Optional 0-10 (TBD: This is a swag at how broad the impact is, 0 low, 10 high, defaults to -1 unknown) }
Issue holds the information about an issue, supporting data, and actions
func GetAllSourcesFilteredIssues ¶
func GetAllSourcesFilteredIssues(log *zap.SugaredLogger, includeInfo bool, minConfidence int, minImpact int) (filtered []Issue)
GetAllSourcesFilteredIssues is only being exported for the unit tests so they can inspect issues found in a report
func NewKnownIssueMessagesFiles ¶
func NewKnownIssueMessagesFiles(issueType string, source string, messages []string, fileNames []string) (issue Issue)
NewKnownIssueMessagesFiles adds a known issue
func NewKnownIssueMessagesMatches ¶
func NewKnownIssueMessagesMatches(issueType string, source string, messages []string, matches []files.TextMatch) (issue Issue)
NewKnownIssueMessagesMatches adds a known issue
func NewKnownIssueSupportingData ¶
func NewKnownIssueSupportingData(issueType string, source string, supportingData []SupportData) (issue Issue)
NewKnownIssueSupportingData adds a known issue
func (*Issue) Validate ¶
func (issue *Issue) Validate(log *zap.SugaredLogger, mapSource string) (err error)
Validate validates an issue. A zeroed Issue is not valid, there is some amount of information that must be specified for the Issue to be useful. Currently the report will validate that the issues contributed are valid at the point where they are being contributed.
type IssueReporter ¶
IssueReporter is a helper for consolidating known issues before contributing them to the report An analyzer may is free to use the IssueReporter NewKnown* helpers for known issues, however they are not required to do so and are free to form fully custom issues and Contribute those directly to the report.Contribute* helpers. This allows analyzers flexibility, but the goal here is that the IssueReporter can evolve to support all of the cases if possible.
func (*IssueReporter) AddKnownIssueMessagesFiles ¶
func (issueReporter *IssueReporter) AddKnownIssueMessagesFiles(issueType string, source string, messages []string, fileNames []string)
AddKnownIssueMessagesFiles adds a known issue
func (*IssueReporter) AddKnownIssueMessagesMatches ¶
func (issueReporter *IssueReporter) AddKnownIssueMessagesMatches(issueType string, source string, messages []string, matches []files.TextMatch)
AddKnownIssueMessagesMatches adds a known issue
func (*IssueReporter) AddKnownIssueSupportingData ¶
func (issueReporter *IssueReporter) AddKnownIssueSupportingData(issueType string, source string, supportingData []SupportData)
AddKnownIssueSupportingData adds a known issue
func (*IssueReporter) Contribute ¶
func (issueReporter *IssueReporter) Contribute(log *zap.SugaredLogger, source string)
Contribute will contribute issues which have been added to the issue reporter
type SupportData ¶
type SupportData struct { Messages []string // Optional, Messages and/or descriptions the supporting data RelatedFiles []string // Optional, if present provides a list of related files that support the issue identification TextMatches []files.TextMatch // Optional, if present provides search results that support the issue identification JSONPaths []JSONPath // Optional, if present provides a list of Json paths that support the issue identification }
SupportData is data which helps a user to further identify an issue TODO: Shake this out more as we add more types, see what we really end up needing here
func DeduplicateSupportingDataList ¶
func DeduplicateSupportingDataList(dataIn []SupportData) (dataOut []SupportData)
DeduplicateSupportingDataList