Documentation
¶
Overview ¶
Package generate provides generation utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterFetcher ¶
type ClusterFetcher struct {
// contains filtered or unexported fields
}
ClusterFetcher fetches resources from a live Kubernetes cluster.
func NewClusterFetcher ¶
func NewClusterFetcher(f kcmdutil.Factory) (*ClusterFetcher, error)
NewClusterFetcher creates a ClusterFetcher using the given factory.
func (*ClusterFetcher) FetchResources ¶
func (f *ClusterFetcher) FetchResources(ctx context.Context, spec *ResourceSpec) ([]*unstructured.Unstructured, error)
FetchResources fetches all resources matching the given specification from the cluster.
type Fetcher ¶
type Fetcher interface {
FetchResources(ctx context.Context, spec *ResourceSpec) ([]*unstructured.Unstructured, error)
}
Fetcher fetches resources from a cluster or must-gather directory.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates kube-compare reference files.
func NewGenerator ¶
func NewGenerator(config *RefgenConfig, outputDir string) *Generator
NewGenerator creates a new Generator.
func (*Generator) Generate ¶
func (g *Generator) Generate(resourcesBySpec map[*ResourceSpec][]*unstructured.Unstructured) (string, error)
Generate writes the reference directory with metadata.yaml and CR files. resourcesBySpec must use the same pointers as the configured rows, i.e. &config.Resources[i] for each index i (see Options.Run); each row gets its own metadata part even when Kind matches another row.
type MustGatherFetcher ¶
type MustGatherFetcher struct {
// contains filtered or unexported fields
}
MustGatherFetcher fetches resources from a must-gather directory.
func NewMustGatherFetcher ¶
func NewMustGatherFetcher(mustGatherDir string) (*MustGatherFetcher, error)
NewMustGatherFetcher creates a MustGatherFetcher for the given directory.
func (*MustGatherFetcher) FetchResources ¶
func (f *MustGatherFetcher) FetchResources(ctx context.Context, spec *ResourceSpec) ([]*unstructured.Unstructured, error)
FetchResources fetches all resources matching the given specification from must-gather.
type Options ¶
type Options struct {
GenerateConfig string
OutputDir string
MustGatherDir string
Verbose bool
Factory kcmdutil.Factory
Streams genericiooptions.IOStreams
}
Options holds options for the generate command.
type RefgenConfig ¶
type RefgenConfig struct {
APIVersion string `json:"apiVersion"`
OutputDir string `json:"outputDir"`
// OmitAnnotations lists metadata.annotation keys stripped from captured manifests
// and added to generated metadata.yaml fieldsToOmit (in addition to built-in defaults).
OmitAnnotations []string `json:"omitAnnotations,omitempty"`
// OmitLabels lists metadata.labels keys stripped from captured manifests and
// added to fieldsToOmit defaults (in addition to built-in defaults).
OmitLabels []string `json:"omitLabels,omitempty"`
Resources []ResourceSpec `json:"resources"`
}
RefgenConfig is the root configuration for reference generation.
func LoadConfig ¶
func LoadConfig(configPath string) (*RefgenConfig, error)
LoadConfig loads and validates a refgen configuration file.