preflight

package
v0.123.11 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 53 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags added in v0.44.0

func AddFlags(flags *flag.FlagSet)

func ConcatPreflightSpec added in v0.50.0

func HasStrictAnalyzer added in v0.31.1

func HasStrictAnalyzer(analyzer *troubleshootv1beta2.Analyze) (bool, error)

HasStrictAnalyzers - checks and returns true if a preflight's analyzer has strict:true, else false

func HasStrictAnalyzers added in v0.31.1

func HasStrictAnalyzers(preflight *troubleshootv1beta2.Preflight) (bool, error)

HasStrictAnalyzers - checks and returns true if a preflight's analyzer has strict:true, else false

func HasStrictAnalyzersFailed added in v0.31.1

func HasStrictAnalyzersFailed(preflightResult *UploadPreflightResults) bool

HasStrictAnalyzersFailed - checks if preflight analyzer's result is strict:true and isFail:true, then returns true else false

func MergeMaps added in v0.123.11

func MergeMaps(base, overlay map[string]interface{}) map[string]interface{}

MergeMaps recursively merges two maps, with overlay taking precedence

func RenderWithHelmTemplate added in v0.123.0

func RenderWithHelmTemplate(templateContent string, values map[string]interface{}) (string, error)

RenderWithHelmTemplate renders a single YAML template string using Helm's engine with the provided values (corresponding to .Values in Helm templates).

func RunPreflights added in v0.44.0

func RunPreflights(interactive bool, output string, format string, args []string) error

func RunTemplate added in v0.123.0

func RunTemplate(templateFile string, valuesFiles []string, setValues []string, outputFile string) error

RunTemplate processes a templated preflight spec file with provided values

func SeedDefaultBooleans added in v0.123.0

func SeedDefaultBooleans(templateContent string, values map[string]interface{})

SeedDefaultBooleans scans the template content for boolean-like value references such as .Values.<path>.enabled or .Values.<path>.create and ensures that any missing paths in the provided values map are initialized with a default value of false. This prevents nil dereference errors during Helm rendering when templates access nested fields on absent maps.

func SeedParentMapsForValueRefs added in v0.123.0

func SeedParentMapsForValueRefs(templateContent string, values map[string]interface{})

SeedParentMapsForValueRefs scans the template for .Values.<path> references and ensures that any missing parent maps along those paths are created in the provided values map. This prevents Helm/template evaluation errors like "nil pointer evaluating interface {}.foo" when the template dereferences nested maps that are absent. Only parent maps up to the last segment are created; leaf values are never set.

Types

type ClusterCollectResult added in v0.10.0

type ClusterCollectResult struct {
	AllCollectedData map[string][]byte
	Collectors       []collect.Collector
	RemoteCollectors collect.RemoteCollectors

	Spec    *troubleshootv1beta2.Preflight
	Context context.Context
	// contains filtered or unexported fields
}

func (ClusterCollectResult) Analyze added in v0.10.0

Analyze runs the analyze phase of preflight checks

func (ClusterCollectResult) IsRBACAllowed added in v0.10.0

func (cr ClusterCollectResult) IsRBACAllowed() bool

type CollectOpts added in v0.9.27

type CollectOpts struct {
	Namespace              string
	IgnorePermissionErrors bool
	KubernetesRestConfig   *rest.Config
	Image                  string
	PullPolicy             string
	LabelSelector          string
	Timeout                time.Duration
	ProgressChan           chan interface{}

	// Optional path to the bundle directory to store the collected data
	BundlePath string
}

type CollectProgress added in v0.10.11

type CollectProgress struct {
	CurrentName    string
	CurrentStatus  string
	CompletedCount int
	TotalCount     int
	Collectors     map[string]CollectorStatus
}

func (*CollectProgress) String added in v0.13.4

func (cp *CollectProgress) String() string

type CollectResult added in v0.9.27

type CollectResult interface {
	Analyze() []*analyze.AnalyzeResult
	IsRBACAllowed() bool
}

func Collect added in v0.9.27

Collect runs the collection phase of preflight checks

func CollectHost added in v0.10.0

CollectHost runs the collection phase of host preflight checks

func CollectHostWithContext added in v0.57.0

func CollectHostWithContext(
	ctx context.Context, opts CollectOpts, p *troubleshootv1beta2.HostPreflight,
) (CollectResult, error)

func CollectRemote added in v0.15.0

Collect runs the collection phase of preflight checks

func CollectRemoteWithContext added in v0.57.0

func CollectRemoteWithContext(ctx context.Context, opts CollectOpts, p *troubleshootv1beta2.HostPreflight) (CollectResult, error)

func CollectWithContext added in v0.57.0

func CollectWithContext(ctx context.Context, opts CollectOpts, p *troubleshootv1beta2.Preflight) (CollectResult, error)

type CollectorStatus added in v0.28.2

type CollectorStatus struct {
	Status string
}

type HostCollectResult added in v0.10.0

type HostCollectResult struct {
	AllCollectedData map[string][]byte
	Collectors       []collect.HostCollector
	Spec             *troubleshootv1beta2.HostPreflight
	Context          context.Context
}

func (HostCollectResult) Analyze added in v0.10.0

func (c HostCollectResult) Analyze() []*analyze.AnalyzeResult

Analyze runs the analyze phase of host preflight checks

func (HostCollectResult) IsRBACAllowed added in v0.10.0

func (cr HostCollectResult) IsRBACAllowed() bool

type PreflightFlags added in v0.44.0

type PreflightFlags struct {
	Interactive               *bool
	Format                    *string
	CollectorImage            *string
	CollectorPullPolicy       *string
	CollectWithoutPermissions *bool
	Selector                  *string
	SinceTime                 *string
	Since                     *string
	Output                    *string
	Debug                     *bool
}

func NewPreflightFlags added in v0.44.0

func NewPreflightFlags() *PreflightFlags

type RemoteCollectResult added in v0.15.0

type RemoteCollectResult struct {
	AllCollectedData map[string][]byte
	Collectors       collect.RemoteCollectors
	Spec             *troubleshootv1beta2.HostPreflight
	Context          context.Context
}

func (RemoteCollectResult) Analyze added in v0.15.0

func (c RemoteCollectResult) Analyze() []*analyze.AnalyzeResult

Analyze runs the analyze phase of host preflight checks.

Runs the analysis for each node and aggregates the results.

func (RemoteCollectResult) IsRBACAllowed added in v0.15.0

func (cr RemoteCollectResult) IsRBACAllowed() bool

type TextOutput added in v0.70.3

type TextOutput struct {
	Pass []TextResultOutput `json:"pass,omitempty" yaml:"pass,omitempty"`
	Warn []TextResultOutput `json:"warn,omitempty" yaml:"warn,omitempty"`
	Fail []TextResultOutput `json:"fail,omitempty" yaml:"fail,omitempty"`
}

func ShowTextResultsStructured added in v0.70.3

func ShowTextResultsStructured(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) *TextOutput

Used by both JSON and YAML outputs

type TextResultOutput added in v0.70.3

type TextResultOutput struct {
	Title   string `json:"title" yaml:"title"`
	Message string `json:"message" yaml:"message"`
	URI     string `json:"uri,omitempty" yaml:"uri,omitempty"`
	Strict  bool   `json:"strict,omitempty" yaml:"strict,omitempty"`
}

type UploadPreflightError added in v0.9.27

type UploadPreflightError struct {
	Error string `json:"error"`
}

type UploadPreflightResult added in v0.9.27

type UploadPreflightResult struct {
	Strict bool `json:"strict,omitempty"`
	IsFail bool `json:"isFail,omitempty"`
	IsWarn bool `json:"isWarn,omitempty"`
	IsPass bool `json:"isPass,omitempty"`

	Title   string `json:"title"`
	Message string `json:"message"`
	URI     string `json:"uri,omitempty"`
}

type UploadPreflightResults added in v0.9.27

type UploadPreflightResults struct {
	Results []*UploadPreflightResult `json:"results,omitempty"`
	Errors  []*UploadPreflightError  `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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