API specifications and configuration
The Troubleshoot API defines declarative specifications for collecting system data, checking that data, preparing preflight results, protecting sensitive content, and building support bundles. Versioned Go types, JSON schemas, Kubernetes custom resource definitions (CRDs), and YAML samples let the same intent move between a direct API client and a Kubernetes cluster.
System contract
The API uses Kubernetes-style objects with an apiVersion, a kind, object metadata, and a spec. The spec states the work to perform. The runtime turns that statement into collection results, analyzer outcomes, redacted content, or a support bundle.
| Resource | Primary purpose | Main specification content |
|---|---|---|
SupportBundle | Produce a support bundle from cluster and host evidence | Collectors, host collectors, analyzers, host analyzers, post-collection actions, and an optional source URI |
Collector | Collect evidence as a reusable definition | Cluster collectors, host collectors, post-collection actions, and an optional source URI |
Analyzer | Define checks over collected evidence | Cluster analyzers, host analyzers, and an optional source URI |
Preflight | Check an environment before installation or operation | Collectors, remote collectors, analyzers, result upload target, and an optional source URI |
Redactor | Define which bundle content must be removed or masked | File selectors, literal values, regular expressions, and YAML paths |
These resources share collector and analyzer definitions where the execution context permits it. A support bundle can therefore combine evidence gathering and checks in one specification, while a preflight can use the same check model for an earlier environment decision. Collector and Analyzer resources also make those definitions reusable outside a single support-bundle object. See Troubleshoot API types and schemas for the field-level contract.
Versioned API groups
The version in apiVersion selects the contract that a producer and consumer agree to use. v1beta1 uses the troubleshoot.replicated.com group. v1beta2 and the partial v1beta3 model use the troubleshoot.sh group, so a version change can also change the API group.
| Version | Role in the contract |
|---|---|
troubleshoot.replicated.com/v1beta1 | Earlier contract for support bundles, collectors, analyzers, preflights, and redactors |
troubleshoot.sh/v1beta2 | Broad contract for cluster, host, remote, analysis, redaction, and support-bundle specifications |
troubleshoot.sh/v1beta3 | Newer contract with a focused value-source model for database collectors and TLS data |
The version boundary is part of the data contract. A document with the wrong group, version, or kind is not the same specification, even when its inner fields look similar. The Kubernetes resources register each version under its own group and version, while the standalone schemas describe the object shape for use outside Kubernetes.
References: pkg/…/register.go• L19-45 pkg/…/register.go• L19-45 pkg/…/register.go• L19-45 pkg/…/supportbundle_types.go• L23-47 pkg/…/supportbundle_types.go• L23-51 pkg/…/supportbundle_types.go• L23-51
Version conversion
The current v1beta3 path converts supported values to the v1beta2 support-bundle model before execution. It resolves database URIs and TLS certificate fields from literal values or Kubernetes Secret and ConfigMap references. The conversion is not a general upgrade for every v1beta3 capability, so a specification that uses fields outside the supported conversion path can lose behavior or fail before execution.
This boundary lets newer configuration express values without placing them directly in the specification. It also means that a change to a versioned field needs a matching conversion rule when an older execution model remains the target.
References: pkg/…/converter.go• L11-39 pkg/…/converter.go• L42-94 pkg/…/converter.go• L97-169 pkg/…/string_or_valuefrom.go• L3-63
Declarative capability model
Each specification describes a set of named capability blocks. The block selects a kind of evidence or check, and its fields state the target, scope, limits, expected value, or result message without embedding a procedural workflow.
Collection capabilities
Collectors turn target state into named evidence for later use. The contract covers Kubernetes state, resource and workload data, logs, commands, copied files, HTTP calls, database access, platform tools, and host or remote checks.
The collector model also carries the execution context needed to make a definition portable. A block can identify a namespace, pod or node selector, image and service account, timeout, TLS settings, or an external source URI. A collector can be excluded without removing it from a shared specification. These common controls let one configuration describe different target environments while keeping the evidence intent stable.
References: pkg/…/collector_shared.go• L14-28 pkg/…/collector_shared.go• L53-94 pkg/…/collector_shared.go• L96-176 pkg/…/collector_shared.go• L178-239 pkg/…/collector_shared.go• L337-370
Analysis capabilities
Analyzers turn collected evidence into human-facing outcomes. They can inspect cluster state and resource status, compare text or structured data, inspect databases and platform reports, or evaluate host evidence.
Each check can carry a name, an exclusion choice, a strictness choice, annotations, and a set of outcomes. Outcomes express states such as pass, warn, or fail and can include a message, a condition, and a link for the operator. The analyzer therefore defines both the evidence to inspect and the decision language that downstream users see.
References: pkg/…/analyzer_shared.go• L10-38 pkg/…/analyzer_shared.go• L70-90 pkg/…/analyzer_shared.go• L161-196 pkg/…/analyzer_shared.go• L238-264 pkg/…/analyzer_shared.go• L283-321
Preflight capabilities
Preflight combines collection and analysis into an environment check. It can collect local cluster evidence, request remote host evidence, evaluate the result with the same analyzer language, and send the resulting report to a configured destination.
This model keeps the decision close to the requirements it tests. A preflight can state that a version, resource, credential, network path, or host condition must pass before an operation continues. The reusable collector and analyzer blocks make the check portable across a pre-install run and a support-bundle run.
References: pkg/…/preflight_types.go• L23-30 pkg/…/hostpreflight_types.go• L23-29 pkg/…/remote_collector_types.go• L23-29 config/…/troubleshoot_v1beta2_preflight.yaml• L1-50
Redaction capabilities
Redaction defines the sensitive content that must not remain in a bundle. A redaction rule selects one file or a set of files and identifies content by literal value, regular expression, or YAML path.
The redactor is a separate resource so the same protection policy can be loaded independently or associated with another bundle flow. Its optional source URI also supports a centrally managed policy while the local object remains a small declaration.
References: pkg/…/redact_shared.go• L3-23 pkg/…/redact_types.go• L23-43 schemas/redactor-troubleshoot-v1beta2.json• L16-85
Support-bundle flow
The support-bundle contract joins collection, analysis, redaction, and delivery around one specification. afterCollection actions can upload results or call a callback after collection, while the source URI and host execution options control where the definition comes from and where host work runs.
The following diagram shows how declarative inputs become evidence and operator-facing results.
flowchart LR
S[Versioned specification] --> C[Cluster and host collection]
S --> R[Redaction policy]
C --> E[Collected evidence]
E --> A[Analysis checks]
R --> B[Protected bundle content]
E --> B
A --> O[Pass, warn, or fail outcomes]
B --> D[Support-bundle delivery]
O --> D
References: pkg/…/supportbundle_types.go• L23-33 pkg/…/collector_types.go• L23-40 pkg/…/analyzer_types.go• L23-28 pkg/…/redact_types.go• L23-27
Configuration assets
The configuration surface has several representations with different jobs. Go types define the in-process contract. JSON schemas support validation by tools that do not use Go. CRDs make the contract available as namespaced Kubernetes resources. YAML samples show how an operator can assemble a valid resource.
Custom resource definitions
The troubleshoot.sh CRDs expose SupportBundle, Collector, Analyzer, Preflight, Redactor, HostCollector, and HostPreflight as namespaced resources. The CRD schemas describe the accepted v1beta2 shape and include the same high-level collector and analyzer blocks used by the standalone specifications.
CRDs are the deployable Kubernetes boundary. They allow configuration authors to store and distribute specifications through the Kubernetes API, while the embedded uri fields allow a resource to point to a source that can be updated or shared at runtime.
References: config/…/troubleshoot.sh_supportbundles.yaml• L7-20 config/…/troubleshoot.sh_collectors.yaml• L7-20 config/…/troubleshoot.sh_analyzers.yaml• L7-20 config/…/troubleshoot.sh_preflights.yaml• L7-20 config/…/troubleshoot.sh_redactors.yaml• L7-20 config/…/troubleshoot.sh_hostcollectors.yaml• L7-20 config/…/troubleshoot.sh_hostpreflights.yaml• L7-20
Standalone JSON schemas
The JSON schemas describe the same resource shapes for clients that do not use Kubernetes discovery or Go types. They make required values and supported nested blocks visible to editors, validators, and other tools that process JSON or YAML.
The schemas cover the five main resource kinds. Their most important shared contract is the nested capability model: collectors provide evidence, analyzers interpret it, and redactors select content to remove. A client should select the schema that matches the object’s apiVersion and kind instead of treating all versions as one shape.
References: schemas/supportbundle-troubleshoot-v1beta1.json• L1-18 schemas/supportbundle-troubleshoot-v1beta2.json• L1-18 schemas/collector-troubleshoot-v1beta2.json• L1-18 schemas/analyzer-troubleshoot-v1beta2.json• L1-18 schemas/preflight-troubleshoot-v1beta2.json• L1-18 schemas/redactor-troubleshoot-v1beta2.json• L1-18
Configuration samples
The sample resources show the intended assembly of a versioned object rather than a special runtime mode. The collector sample combines cluster information, command execution, and HTTP requests. The preflight sample combines analyzer checks with pass, warn, and fail messages. The analyzer sample is a scaffold and does not show a complete analyzer definition.
Use the samples as starting points for deployable YAML, then choose the more complete examples in configuration samples and CRDs when you need a ready-to-apply resource or a comparison between resource forms.
References: config/…/troubleshoot_v1beta2_collector.yaml• L1-80 config/…/troubleshoot_v1beta2_analyzer.yaml• L1-9 config/…/troubleshoot_v1beta2_preflight.yaml• L1-50
Portability boundaries
Portability depends on keeping the intent in the specification and the environment-specific inputs at clear boundaries. A URI can move a full specification outside the object. A value source can move a secret or certificate outside the object. Namespace, selector, image, timeout, and transport fields then adapt the same capability to a target environment.
The boundary is not transparent for every field. The v1beta3 value-source feature currently applies to the supported database and TLS path. Remote checks also require a host-side execution context, while cluster checks require access to the named Kubernetes resources. Treat these requirements as part of the portability contract rather than as optional deployment details.
External specification sources
A uri identifies the source of a specification that can be loaded or updated at runtime. Collector, analyzer, preflight, redactor, and support-bundle resources expose this choice at the resource level. Support bundles and collectors also support post-collection result upload and callback definitions.
External sources reduce duplication, but they add a dependency on the source being reachable and returning the expected versioned document. The local resource still needs the correct kind and version so the consumer knows how to interpret the loaded content.
References: pkg/…/collector_types.go• L29-40 pkg/…/analyzer_types.go• L23-28 pkg/…/preflight_types.go• L23-30 pkg/…/redact_types.go• L23-27 pkg/…/supportbundle_types.go• L23-33
Secret and ConfigMap value sources
The v1beta3 value-source model lets a literal string or a value from a Kubernetes Secret or ConfigMap fill a configuration field. The reference names the object and key, can name a namespace, and can mark the source optional.
This model keeps connection details and certificate material out of shared YAML. A missing required source stops resolution. An optional source resolves to an empty value when the object or key is absent, so authors must choose optionality with the expected runtime behavior in mind.
References: pkg/…/string_or_valuefrom.go• L3-63 pkg/…/collector_shared.go• L14-38 pkg/…/converter.go• L97-169
Change checklist
When these files or sections are changed, remember to consider these:
- A change to a versioned Go type must stay aligned with its standalone JSON schema and the matching CRD schema.
- A new or renamed collector or analyzer block must be reflected in every resource that embeds
CollectorAnalyze, including host and remote variants where applicable. - A change to
v1beta3value-source fields must preserve conversion and resolution into the execution model used byv1beta2. - A change to a resource group, version, kind, or plural must stay aligned across registration, CRDs, schemas, and deployable samples.
- A change to post-collection upload or callback fields must preserve the
uri,method, and redaction-report contract for downstream endpoints.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The object uses the wrong API group or version | The consumer selects the wrong contract or rejects the object | Validate apiVersion and kind against the matching schema or CRD |
| A required collector or analyzer field is missing | The resource can be accepted as an incomplete declaration but cannot perform the intended check | Validate against the versioned JSON schema or CRD before deployment |
A v1beta3 value source names a missing required Secret, ConfigMap, or key | Conversion fails before the database or TLS operation can run | Use a valid reference or mark the source optional only when an empty value is safe |
A v1beta3 object uses capability fields outside the supported conversion path | The intended collector, analyzer, or host behavior is not carried into the v1beta2 execution model | Confirm the version conversion supports each capability before adopting it |
| A source URI is unreachable or returns another versioned shape | Runtime loading fails or produces a document that the local consumer cannot interpret | Keep the URI reachable and validate the fetched document with the selected version schema |
| A redaction rule selects the wrong file or path | Sensitive data remains in the bundle or useful data is removed | Review selectors and removal rules against representative bundle paths |
Key files
| File | Why to read it |
|---|---|
| pkg/…/supportbundle_types.go | Defines the top-level support-bundle contract and how collection, analysis, host work, and post-collection actions join together |
| pkg/…/collector_types.go | Defines the reusable collector resource and its external source and delivery controls |
| pkg/…/analyzer_types.go | Defines the reusable analyzer resource and its host-analysis extension |
| pkg/…/collector_shared.go | Shows the broad evidence model shared by collector-bearing resources |
| pkg/…/analyzer_shared.go | Shows the check and outcome model shared by analyzer-bearing resources |
| pkg/…/preflight_types.go | Defines the preflight contract for local and remote checks |
| pkg/…/redact_shared.go | Defines the portable redaction rule model |
| pkg/…/string_or_valuefrom.go | Defines literal and Secret or ConfigMap-backed values |
| pkg/…/converter.go | Shows the boundary between the newer value-source contract and the execution model |
schemas/ | Provides standalone versioned validation shapes for API clients |
config/crds/ | Provides namespaced Kubernetes resource schemas for deployment |
config/samples/ | Provides small YAML examples for creating versioned resources |