Documentation
¶
Index ¶
- func FlattenResults(resultsByGroup map[check.CheckGroup][]check.CheckExecution) []check.CheckExecution
- func OutputJSON(out io.Writer, results []check.CheckExecution, clusterVersion *string, ...) error
- func OutputTable(out io.Writer, results []check.CheckExecution, opts TableOutputOptions) error
- func OutputYAML(out io.Writer, results []check.CheckExecution, clusterVersion *string, ...) error
- func ValidateCheckSelector(selector string) error
- func ValidateCheckSelectors(selectors []string) error
- type CheckResultOutput
- type CheckResultTableRow
- type Command
- type CommandOption
- type LintOutput
- type OutputFormat
- type SharedOptions
- type TableOutputOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlattenResults ¶
func FlattenResults(resultsByGroup map[check.CheckGroup][]check.CheckExecution) []check.CheckExecution
FlattenResults converts a map of results by group to a flat sorted array. Results are sorted by: 1. Group (canonical order: Dependency, Service, Component, Workload) 2. Kind (alphabetically within each group) 3. Name (alphabetically within each kind).
func OutputJSON ¶
func OutputJSON(out io.Writer, results []check.CheckExecution, clusterVersion *string, targetVersion *string) error
OutputJSON outputs diagnostic results in List format.
func OutputTable ¶
func OutputTable(out io.Writer, results []check.CheckExecution, opts TableOutputOptions) error
OutputTable is a shared function for outputting check results in table format. When opts.ShowImpactedObjects is true, impacted objects are listed after the summary.
func OutputYAML ¶
func OutputYAML(out io.Writer, results []check.CheckExecution, clusterVersion *string, targetVersion *string) error
OutputYAML outputs diagnostic results in List format.
func ValidateCheckSelector ¶
ValidateCheckSelector validates a single check selector pattern.
func ValidateCheckSelectors ¶ added in v0.0.18
ValidateCheckSelectors validates all check selector patterns.
Types ¶
type CheckResultOutput ¶
type CheckResultOutput struct {
CheckID string `json:"checkId" yaml:"checkId"`
CheckName string `json:"checkName" yaml:"checkName"`
Group string `json:"group" yaml:"group"`
Status string `json:"status" yaml:"status"`
Impact *string `json:"impact,omitempty" yaml:"impact,omitempty"`
Message string `json:"message" yaml:"message"`
Remediation string `json:"remediation,omitempty" yaml:"remediation,omitempty"`
Details map[string]any `json:"details,omitempty" yaml:"details,omitempty"`
}
CheckResultOutput represents a check result for JSON/YAML output.
type CheckResultTableRow ¶
type CheckResultTableRow struct {
Status string
Group string
Kind string
Check string
Impact string
Message string
Description string
}
CheckResultTableRow represents a single condition row for table output. Each row represents one condition from a diagnostic result.
type Command ¶
type Command struct {
// TargetVersion is the optional target version for upgrade assessment.
// If empty, runs in lint mode (validates current state).
// If set, runs in upgrade mode (assesses upgrade readiness to target version).
TargetVersion string
// contains filtered or unexported fields
}
Command contains the lint command configuration.
func NewCommand ¶
func NewCommand( streams genericiooptions.IOStreams, configFlags *genericclioptions.ConfigFlags, options ...CommandOption, ) *Command
NewCommand creates a new Command with defaults. Per FR-014, SharedOptions are initialized internally. ConfigFlags must be provided to ensure CLI auth flags are properly propagated. Optional configuration can be provided via functional options (e.g., WithTargetVersion).
type CommandOption ¶
type CommandOption func(*Command)
CommandOption is a functional option for configuring a Command. Use with NewCommand for optional configuration like target version.
Example:
cmd := lint.NewCommand(streams, configFlags,
lint.WithTargetVersion("3.0"),
)
func WithTargetVersion ¶
func WithTargetVersion(version string) CommandOption
WithTargetVersion returns a CommandOption that sets the target version.
type LintOutput ¶
type LintOutput struct {
ClusterVersion *string `json:"clusterVersion,omitempty" yaml:"clusterVersion,omitempty"`
TargetVersion *string `json:"targetVersion,omitempty" yaml:"targetVersion,omitempty"`
Components []CheckResultOutput `json:"components" yaml:"components"`
Services []CheckResultOutput `json:"services" yaml:"services"`
Dependencies []CheckResultOutput `json:"dependencies" yaml:"dependencies"`
Workloads []CheckResultOutput `json:"workloads" yaml:"workloads"`
Summary struct {
Total int `json:"total" yaml:"total"`
Passed int `json:"passed" yaml:"passed"`
Failed int `json:"failed" yaml:"failed"`
} `json:"summary" yaml:"summary"`
}
LintOutput represents the full lint output for JSON/YAML.
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format for lint commands.
const ( OutputFormatTable OutputFormat = "table" OutputFormatJSON OutputFormat = "json" OutputFormatYAML OutputFormat = "yaml" // DefaultTimeout is the default timeout for lint commands. DefaultTimeout = 5 * time.Minute )
func (OutputFormat) Validate ¶
func (o OutputFormat) Validate() error
Validate checks if the output format is valid.
type SharedOptions ¶
type SharedOptions struct {
IO iostreams.Interface
ConfigFlags *genericclioptions.ConfigFlags
OutputFormat OutputFormat
CheckSelectors []string
FailOnCritical bool
FailOnWarning bool
Verbose bool
Timeout time.Duration
Client client.Client
// Throttling settings for Kubernetes API client
}
SharedOptions contains options common to all lint subcommands.
func NewSharedOptions ¶
func NewSharedOptions( streams genericiooptions.IOStreams, configFlags *genericclioptions.ConfigFlags, ) *SharedOptions
NewSharedOptions creates a new SharedOptions with defaults. ConfigFlags must be provided by the caller to ensure CLI auth flags are properly propagated.
func (*SharedOptions) Complete ¶
func (o *SharedOptions) Complete() error
Complete populates the client and performs pre-validation setup.
func (*SharedOptions) Validate ¶
func (o *SharedOptions) Validate() error
Validate checks that all required options are valid.
type TableOutputOptions ¶ added in v0.0.24
type TableOutputOptions struct {
// ShowImpactedObjects enables listing impacted objects after the summary.
ShowImpactedObjects bool
// NamespaceRequesters maps namespace names to their openshift.io/requester annotation value.
// Used when ShowImpactedObjects is true to display the requester for each namespace group.
NamespaceRequesters map[string]string
}
TableOutputOptions configures the behavior of OutputTable.