loader

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoadOptions

type LoadOptions struct {
	RawSpecs []string
	RawSpec  string

	// If true, the loader will return an error if any of the specs are not valid
	// else the invalid specs will be ignored
	Strict bool
}

type TroubleshootKinds

type TroubleshootKinds struct {
	AnalyzersV1Beta2        []troubleshootv1beta2.Analyzer
	CollectorsV1Beta2       []troubleshootv1beta2.Collector
	HostCollectorsV1Beta2   []troubleshootv1beta2.HostCollector
	HostPreflightsV1Beta2   []troubleshootv1beta2.HostPreflight
	PreflightsV1Beta2       []troubleshootv1beta2.Preflight
	RedactorsV1Beta2        []troubleshootv1beta2.Redactor
	RemoteCollectorsV1Beta2 []troubleshootv1beta2.RemoteCollector
	SupportBundlesV1Beta2   []troubleshootv1beta2.SupportBundle
}

func LoadSpecs

func LoadSpecs(ctx context.Context, opt LoadOptions) (*TroubleshootKinds, error)

LoadSpecs takes sources to load specs from and returns a TroubleshootKinds object that contains all the parsed troubleshoot specs.

The fetched specs should be yaml documents. The documents can be multidoc yamls separated by "---" which get split and parsed one at a time. All troubleshoot specs are extracted from the documents and returned in a TroubleshootKinds object.

If Secrets or ConfigMaps are found, they are parsed and the support bundle, redactor or preflight spec extracted from them. All other yaml documents will be ignored.

If the `Strict` flag is set to true, this function will return an error if any of the documents are not valid, else the invalid documents will be ignored.

func NewTroubleshootKinds

func NewTroubleshootKinds() *TroubleshootKinds

func (*TroubleshootKinds) Add added in v0.72.0

func (kinds *TroubleshootKinds) Add(other *TroubleshootKinds)

func (*TroubleshootKinds) IsEmpty

func (kinds *TroubleshootKinds) IsEmpty() bool

func (*TroubleshootKinds) ToYaml added in v0.72.0

func (kinds *TroubleshootKinds) ToYaml() (string, error)

ToYaml returns a yaml document/multi-doc of all the parsed specs This function utilises reflection to iterate over all the fields of the TroubleshootKinds object then marshals them to yaml.

Jump to

Keyboard shortcuts

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