Support bundle analysis
Support bundle analysis turns collected files into checks that explain the health of a cluster or host. An analyzer specification selects data, applies a condition, and returns an outcome such as pass, warn, or fail with a message that downstream tools can show or save in the bundle. See Support bundle workflows for the full collection-to-upload flow, Support bundle collection for the evidence source, Support bundle redaction for data masking, and Support bundle artifacts and upload for downstream reports.
Analysis model
An analyzer is a small rule that connects one kind of collected data to one or more outcomes. The analysis service reads the bundle through a file provider, runs the selected analyzer types, and combines their results into a list with summary counts and optional error data. The same model supports analysis during bundle creation and analysis of an existing local or remote bundle.
The main concepts are:
| Concept | Purpose |
|---|---|
| Analyzer specification | Names the data to inspect and defines the conditions for each result. |
| Collected artifact | A file or group of files in the unpacked bundle that supplies the actual value. |
| Outcome | A pass, warn, or fail branch with a condition, message, and optional help URI. |
| Analysis result | The decision for one check. It can also identify a host, Kubernetes object, category, severity, or related context. |
| Analysis summary | Counts results by state and records errors, duration, confidence, and agents used when the enhanced result model is used. |
Analyzer specifications
An analyzer specification is stored in an Analyzer or SupportBundle object. Its spec holds cluster analyzers and host analyzers. Each check has shared metadata for its display name, exclusion, strict handling, and annotations. The concrete analyzer type then defines which artifact or live-shaped data the check expects. pkg/…/analyzer_types.go• L23-45 pkg/…/analyzer_shared.go• L238-243
The analysis entry point accepts an analyzer specification as text or as part of a support-bundle specification. It normalizes older versions to v1beta2, then reads either Analyzer.spec or SupportBundle.spec. If no analyzer text is supplied to the standalone download path, the system uses a small default set instead. pkg/…/download.go• L65-90 pkg/…/download.go• L222-269
Outcome rules
An outcome has one branch: fail, warn, or pass. The branch can include a when condition. The analyzer evaluates outcomes in their listed order and returns the first matching branch for the common outcome evaluator. A branch without a condition acts as the default for its state. pkg/…/outcome.go• L3-13 pkg/…/host_analyzer.go• L119-196
References: pkg/…/outcome.go• L3-13 pkg/…/host_analyzer.go• L119-196
The result keeps the selected branch's message and optional URI. A missing match is not a successful pass. Depending on the analyzer, it can produce no result, a warning for missing data, or a failure that says the analyzer is invalid. This distinction lets a caller tell a healthy check from a check that could not run.
References: pkg/…/outcome.go• L3-13 pkg/…/host_analyzer.go• L119-196
Exclusion and strictness
An analyzer can be excluded before it reads any artifact. Exclusion accepts a Boolean value or a Boolean-like string. Strictness is read from the analyzer union and stamped onto every result by the analysis entry point, including results created for analyzer errors. pkg/…/analyzer.go• L45-63 pkg/…/analyzer.go• L117-173 pkg/…/analyzer.go• L183-224
Excluded checks do not create normal result entries. A check that fails while it runs creates a failure result with the analyzer title and error text in the legacy path. This preserves a visible signal instead of silently dropping a broken check. pkg/…/analyzer.go• L66-113
References: pkg/…/analyzer.go• L45-63 pkg/…/analyzer.go• L66-113 pkg/…/analyzer.go• L117-173 pkg/…/analyzer.go• L183-224
Collected artifact evaluation
The evaluator treats the unpacked support bundle as a named data set. A check asks for one file or a group of matching files, and the file provider returns the bytes without changing the analyzer's rule. A missing file is reported as a not-found condition. A glob can produce several inputs for one check. pkg/…/download.go• L272-360
The high-level flow from a specification to outcome data is:
flowchart LR
S[Analyzer specification] --> T[Select analyzer type]
T --> A[Locate collected artifact]
A --> E[Extract or compare data]
E --> O[Evaluate outcome rules]
O --> R[Pass, warn, or fail result]
R --> M[Summary and analysis artifacts]
Checks may parse text, YAML, JSON, Kubernetes resource data, metrics, or host command output. The parser is part of the analyzer type. The common contract is that parsed or matched data is compared with the specification and converted to a result with a title and message.
Text and structured data
Text analyzers inspect one or more files with a regular expression. A pattern outcome tests whether the pattern matches. A group outcome can name captured values and compare them with simple conditions. The analyzer can ignore an empty file set or return a warning when no matching files exist. pkg/…/text_analyze.go• L36-123 pkg/…/text_analyze.go• L139-207 pkg/…/text_analyze.go• L209-286
References: pkg/…/text_analyze.go• L36-123 pkg/…/text_analyze.go• L139-207 pkg/…/text_analyze.go• L209-286
YAML and JSON comparison analyzers parse a selected file, optionally select a nested value, and compare it with an expected value. YAML uses a named path. JSON supports a named path or JSONPath. JSON list values are compared without relying on their order. Outcome messages can use values from the original document. pkg/…/yaml_compare.go• L32-77 pkg/…/json_compare.go• L43-113
References: pkg/…/yaml_compare.go• L32-77 pkg/…/json_compare.go• L43-113
Missing and invalid data
Artifact absence and artifact parse errors have different meanings. A check can explicitly ignore missing files. Otherwise, analyzer-specific behavior reports a warning or a failure result. Invalid YAML, JSON, regular expressions, paths, or conditions can stop that check with an error. The caller records such errors separately from the pass, warn, and fail counts in the enhanced result model. pkg/…/text_analyze.go• L59-77 pkg/…/node_resources.go• L56-78 pkg/…/engine.go• L164-170
References: pkg/…/text_analyze.go• L59-77 pkg/…/node_resources.go• L56-78 pkg/…/engine.go• L164-170
Analyzer scopes
Analyzer scopes describe the level at which a check reads evidence. Cluster analyzers inspect cluster-wide state or Kubernetes objects. Host analyzers inspect data collected from individual machines. Resource analyzers narrow a check to selected Kubernetes resources or node capacity. Comparison analyzers test a value from a structured artifact against an expected value.
Cluster analyzers
Cluster analyzers evaluate shared Kubernetes state and cluster services. They cover broad checks such as Kubernetes version, distribution, container runtime, node resources, workloads, storage classes, ingress, events, databases, and other cluster services. The specification maps each named analyzer type to one supported check, so the selected type determines how its artifact data is interpreted. pkg/…/analyzer.go• L191-268 pkg/…/analyzer_shared.go• L10-18
The Kubernetes version analyzer reads the collected cluster version record and turns its version into a semantic version. It supports the v prefix and removes provider suffixes used by EKS and GKE before it checks ordered version ranges. The first matching fail, warn, or pass outcome supplies the result message and optional help URI. pkg/…/cluster_version.go• L25-50 pkg/…/cluster_version.go• L61-124
Cluster checks can return one result for the cluster or several results for objects and namespaces. Workload checks use names and namespace filters to focus on selected resources. The result can include an involved Kubernetes object so consumers can link the finding to the affected object. pkg/…/engine.go• L89-115
References: pkg/…/analyzer.go• L191-268 pkg/…/analyzer_shared.go• L10-18 pkg/…/cluster_version.go• L25-124 pkg/…/distribution.go• L86-427 pkg/…/engine.go• L89-115
Host analyzers
Host analyzers evaluate machine-level evidence such as CPU, memory, disk use, ports, services, operating system data, packages, kernel settings, certificates, and network paths. The host analyzer list uses a separate specification branch because its evidence comes from host collection rather than cluster collection. pkg/…/hostanalyzer_shared.go• L3-19 pkg/…/hostanalyzer_shared.go• L162-190
The host time analyzer evaluates timezone, clock synchronization, and NTP state from the collected host time record. A clock can count as synchronized from the reported NTP state or from a supported hypervisor clock measurement that is close to the host clock and was read within the allowed sampling window. A failed or uncertain hypervisor read does not change the separate NTP status. pkg/…/host_time.go• L32-58 pkg/…/host_time.go• L18-59
When a host check matches data for more than one node, the evaluator makes a result for each node and adds the node name to the result title. If no outcome matches, the shared host path keeps a warning result with the check title so the check remains visible. Host results also retain the configured strict flag when the check succeeds or fails. pkg/…/host_analyzer.go• L84-116 pkg/…/analyzer.go• L66-99
References: pkg/…/hostanalyzer_shared.go• L3-19 pkg/…/hostanalyzer_shared.go• L162-190 pkg/…/host_analyzer.go• L84-116 pkg/…/host_time.go• L32-58 pkg/…/host_time.go• L18-59 pkg/…/analyzer.go• L66-99
Resource analyzers
Resource analyzers select a Kubernetes object or a set of nodes before they evaluate a condition. A cluster-resource check locates an object by kind, scope, namespace, and name. It then checks a YAML field by expected value, regular expression, or a comparison condition. A missing object and an invalid field path become failure findings because the requested check cannot be satisfied. pkg/…/kube_resource.go• L67-116 pkg/…/kube_resource.go• L247-332
Node-resource checks first filter nodes by labels, taints, architecture, or capacity. Their conditions can test the count of matching nodes or an aggregate such as a minimum, maximum, or sum. This lets one result describe capacity across a selected part of the cluster rather than one node at a time. pkg/…/node_resources.go• L56-155 pkg/…/node_resources.go• L158-235
References: pkg/…/node_resources.go• L56-155 pkg/…/node_resources.go• L158-235
Comparison analyzers
Comparison analyzers answer a narrow question about structured data. YAML comparison reads a selected YAML value. JSON comparison reads a selected JSON value or JSONPath result. Both compare the actual value with the configured value and use outcomes to turn the Boolean comparison into pass, warn, or fail data. pkg/…/analyzer_shared.go• L172-188 pkg/…/yaml_compare.go• L41-139 pkg/…/json_compare.go• L52-188
The comparison result preserves the check title and the selected outcome message. This makes comparison analyzers useful for both exact configuration checks and checks that explain the actual value through a templated message.
References: pkg/…/yaml_compare.go• L41-139 pkg/…/json_compare.go• L52-188
Result and artifact data
The legacy analysis path returns AnalyzeResult entries with state flags, title, message, URI, strictness, and optional object context. The enhanced analysis model wraps these findings in AnalysisResult, which adds summary counts, metadata, errors, remediation, categories, confidence, severity, and relationships. Consumers can therefore use the same check decision for a simple CLI response or a richer report. pkg/…/analyzer.go• L27-40 pkg/…/analyzer.go• L117-173 pkg/…/engine.go• L81-115
The analysis engine selects available agents, runs the analyzers, appends their findings, records agent and analyzer errors, and calculates the summary. It counts a result as pass, warn, or fail by its state flags. Errors are counted separately. Remediation is collected from failed results when requested. pkg/…/engine.go• L329-490 pkg/…/engine.go• L512-555
When analysis runs during bundle creation, the results are serialized into the bundle's analysis file before the bundle is archived. When analysis runs as a separate operation, the caller can format the results as YAML or JSON. See Support bundle artifacts and upload for the downstream artifact and upload path. pkg/…/supportbundle.go• L199-220 cmd/…/analyze.go• L18-64
Report artifacts
The artifact manager turns an enhanced analysis result into a primary analysis.json file and optional format-specific and summary files. The primary artifact includes the result data and a summary of pass, warn, fail, and error counts. Additional reports can expose top issues, findings, correlations, and remediation guidance. pkg/…/artifacts.go• L120-190 pkg/…/artifacts.go• L193-244
Artifact generation is a reporting step. It does not replace the analyzer decision. If a report format is unsupported or one supplementary report fails, the analysis result remains the source data and the manager can continue with the artifacts it can create. pkg/…/artifacts.go• L247-283 pkg/…/artifacts.go• L286-310
References: pkg/…/artifacts.go• L247-283 pkg/…/artifacts.go• L286-310
Change checklist
When these files or sections are changed, remember to consider these:
- Keep analyzer type names aligned across the v1beta2 schema, the analyzer dispatch map, and any conversion from custom analyzers to the enhanced analyzer model.
- Keep collector output paths aligned with the
collectorName,fileName, resource path, and host glob rules used by analyzers. - Preserve the meaning of missing data versus an analyzer execution error. These signals affect warning results and summary error counts in different ways.
- Keep outcome order and default
whenbehavior aligned across shared outcome evaluation, text matching, resource checks, and YAML or JSON comparison. - Keep cluster version parsing aligned with the version strings written by collection, including provider suffixes and the version ranges used in outcomes.
- Keep distribution detection markers aligned with the node and API resource data produced by collection. Preserve accepted distribution name forms when changing distribution conditions.
- Keep host time analyzer conditions aligned with the collected time record. Preserve the distinction between reported NTP synchronization and supported hypervisor clock evidence.
- Keep result state flags and summary counting aligned when adding fields to either the legacy result or enhanced result model.
- Preserve central strict-flag stamping for both normal and error results when adding or changing analyzer entry points.
- Keep the analysis file written during bundle creation compatible with the report and upload consumers described in Support bundle artifacts and upload.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The analyzer names a file or collector path that collection did not produce | The check warns, fails, or returns no result instead of evaluating the intended evidence | Match analyzer paths to collector output and use the ignore option only when absence is expected |
| The collected cluster version is missing, malformed, or uses an unsupported version suffix | The Kubernetes version check cannot compare the cluster with its configured ranges and analysis returns an error | Collect cluster-info/cluster_version.json and validate provider version formats before analysis |
| The collected node data does not contain a recognized distribution marker | The distribution check cannot match its configured condition and returns a warning instead of a supported-distribution pass | Collect the node list and use a condition for a recognized distribution name |
| The host time record has an invalid clock condition, a failed hypervisor read, or an uncertain hypervisor measurement | The time check returns an error or treats the clock as unsynchronized even when the host has a usable NTP result | Use supported condition syntax and retain the NTP status in the collected record |
| A YAML path, JSONPath, regular expression, or condition has invalid syntax | The check cannot produce a trusted outcome and an analysis error or failure result is returned | Validate the rule against a representative collected artifact |
| A cluster-resource check uses the wrong kind, scope, namespace, or name | The requested object is treated as missing and the check fails | Use the same resource scope and name that the collector stores |
| An analyzer is excluded or has no matching outcome | The check is absent or remains unresolved rather than becoming a pass | Review exclusion flags and provide a complete ordered outcome set |
| A custom analyzer cannot be converted to the enhanced analysis format | A configuration failure result is added and the summary fail count increases | Use a supported analyzer type and keep conversion mappings current |
| A strict flag is read from only one member of an analyzer union or is not copied to generated results | Consumers lose the policy marker that controls how strongly they treat the finding | Read the union-level strict state and stamp it onto normal and error results |
| A report format is unsupported or cannot be written | That report is skipped while other analysis artifacts may still be produced | Treat analysis.json and the in-memory analysis result as the primary data |
Key files
| File | Why to read it |
|---|---|
| pkg/…/download.go | Shows how a bundle and analyzer specification enter analysis and how collected files are exposed. |
| pkg/…/analyzer.go | Shows the common analyzer contract, dispatch by analyzer type, exclusion, strictness, deduplication, and legacy result shape. |
| pkg/…/analyzer_test.go | Shows the guarantees for exclusion and strict flags, duplicate analyzer removal, nil input, and strict propagation to normal and error results. |
| pkg/…/host_analyzer.go | Shows shared host result handling and ordered outcome evaluation. |
| pkg/…/host_time.go | Shows how host time evidence and hypervisor clock measurements become synchronization outcomes. |
| pkg/…/host_time_hypervisor_test.go | Shows the supported host clock evidence, boundary behavior, and separation of NTP state from hypervisor clock evidence. |
| pkg/…/host_time.go | Shows the host time data collected for timezone, NTP, and hypervisor clock checks. |
| pkg/…/cluster_version.go | Shows how the collected Kubernetes version is normalized, compared with ordered ranges, and returned as a result. |
| pkg/…/cluster_version_test.go | Shows the supported version forms and the fail, warn, and pass range behavior. |
| pkg/…/distribution.go | Illustrates cluster distribution detection from node and API resource evidence and its outcome handling. |
| pkg/…/analyzer_shared.go | Defines the main cluster, resource, text, and comparison analyzer shapes. |
| pkg/…/hostanalyzer_shared.go | Defines the host analyzer shapes and their artifact-oriented inputs. |
| pkg/…/outcome.go | Defines pass, warn, and fail outcome branches. |
| pkg/…/kube_resource.go | Illustrates object selection and resource-field evaluation. |
| pkg/…/node_resources.go | Illustrates filtering and aggregate evaluation across nodes. |
| pkg/…/text_analyze.go | Illustrates text and regular-expression evaluation across collected files. |
| pkg/…/yaml_compare.go and pkg/…/json_compare.go | Illustrate structured value comparison and outcome selection. |
| pkg/…/distribution_test.go | Shows the supported distribution names and the evidence used to recognize Tanzu and other distributions. |
| pkg/…/engine.go | Defines enhanced result data, summary counts, errors, remediation, and agent orchestration. |
| pkg/…/artifacts.go | Shows how analysis results become report artifacts. |
| pkg/…/supportbundle.go | Shows where analysis is placed in bundle creation before archive and upload. |