Documentation ¶
Index ¶
- Constants
- Variables
- func FuncMap() template.FuncMap
- func NewCmd(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
- type Component
- type ComponentType
- type Corelator
- type CorrelationSettings
- type DiffSum
- type ExactMatchCorelator
- type GroupCorelator
- type HTTPFS
- type HTTPFile
- type HTTPFileInfo
- type InfoObject
- type ManualCorrelation
- type MetricsCorelatorDecorator
- type MultiCorelator
- type MultipleMatches
- type Options
- type Output
- type Part
- type Reference
- type Summary
- type UnknownMatch
- type UserConfig
Constants ¶
const ( ReferenceFileName = "metadata.yaml" DiffSeparator = "**********************************" )
const ( Json string = "json" Yaml = "yaml" )
Variables ¶
var OutputFormats = []string{Json, Yaml}
Functions ¶
func FuncMap ¶
FuncMap returns a mapping of all of the functions that Engine has.
Because some functions are late-bound (e.g. contain context-sensitive data), the functions may not all perform identically outside of an Engine as they will inside of an Engine.
Known late-bound functions:
- "include"
- "tpl"
These are late-bound in Engine.Render(). The version included in the FuncMap is a placeholder.
Types ¶
type Component ¶
type Component struct { Name string `json:"name"` Type ComponentType `json:"type,omitempty"` RequiredTemplates []string `json:"requiredTemplates,omitempty"` OptionalTemplates []string `json:"optionalTemplates,omitempty"` }
type ComponentType ¶
type ComponentType string
const ( Required ComponentType = "Required" Optional = "Optional" )
type Corelator ¶
type Corelator interface {
Match(*unstructured.Unstructured) (*template.Template, error)
}
Corelator provides an abstraction that allow the usage of different Resource correlation logics in the kubectl cluster-compare. The correlation process Matches for each Resource a template.
type CorrelationSettings ¶
type CorrelationSettings struct {
ManualCorrelation ManualCorrelation `json:"manualCorrelation"`
}
type ExactMatchCorelator ¶
type ExactMatchCorelator struct {
// contains filtered or unexported fields
}
ExactMatchCorelator Matches templates by exact match between a predefined config including pairs of Resource names and there equivalent template. The names of the resources are in the apiVersion-kind-namespace-name format. For fields that are not namespaced apiVersion-kind-name format will be used.
func NewExactMatchCorelator ¶
func (ExactMatchCorelator) Match ¶
func (c ExactMatchCorelator) Match(object *unstructured.Unstructured) (*template.Template, error)
type GroupCorelator ¶
type GroupCorelator struct { //List of Hash functions for groups of fields organized in same order of fieldGroups GroupFunctions []func(unstructured2 *unstructured.Unstructured) (group string, err error) // contains filtered or unexported fields }
GroupCorelator Matches templates by hashing predefined fields. All The templates are indexed by hashing groups of `indexed` fields. The `indexed` fields can be nested. Resources will be attempted to be matched with hashing by the group with the largest amount of `indexed` fields. In case a Resource Matches by a hash a group of templates the group corelator will continue looking for a match (with groups with less `indexed fields`) until it finds a distinct match, in case it doesn't, MultipleMatches error will be returned. Templates will be only indexed by a group of fields only if all fields in group are not templated.
func NewGroupCorelator ¶
func NewGroupCorelator(fieldGroups [][][]string, templates []*template.Template) (*GroupCorelator, error)
NewGroupCorelator creates a new GroupCorelator using inputted fieldGroups and generated GroupFunctions and templatesByGroups. The templates will be divided into different kinds of groups based on the fields that are templated. Templates will be added to the kind of group that contains the biggest amount of fully defined `indexed` fields. For fieldsGroups = {{{"metadata", "namespace"}, {"kind"}}, {{"kind"}}} and the following templates: [fixedKindTemplate, fixedNamespaceKindTemplate] the fixedNamespaceKindTemplate will be added to a mapping where the keys are in the format of `namespace_kind`. The fixedKindTemplate will be added to a mapping where the keys are in the format of `kind`.
func (*GroupCorelator) Match ¶
func (c *GroupCorelator) Match(object *unstructured.Unstructured) (*template.Template, error)
type HTTPFS ¶
type HTTPFS struct {
// contains filtered or unexported fields
}
HTTPFS represents a file system that retrieves files from a http server by returning the http response body, ideal for http servers that return raw files
type HTTPFile ¶
type HTTPFile struct {
// contains filtered or unexported fields
}
HTTPFile represents a file obtained from an HTTP response body.
type HTTPFileInfo ¶
type HTTPFileInfo struct {
// contains filtered or unexported fields
}
HTTPFileInfo represents information about the http raw resource
func (HTTPFileInfo) IsDir ¶
func (f HTTPFileInfo) IsDir() bool
IsDir abbreviation for Mode().IsDir()
func (HTTPFileInfo) ModTime ¶
func (f HTTPFileInfo) ModTime() time.Time
ModTime returns the time of the http response
func (HTTPFileInfo) Mode ¶
func (f HTTPFileInfo) Mode() fs.FileMode
Mode returns the file mode bits - always returns fs.ModeTemporary because file isn't in local file system and is a http resource
func (HTTPFileInfo) Name ¶
func (f HTTPFileInfo) Name() string
Name returns the uri of the file from the requested base URL
func (HTTPFileInfo) Size ¶
func (f HTTPFileInfo) Size() int64
Size returns the length of the http body
type InfoObject ¶
type InfoObject struct { FieldsToOmit [][]string // contains filtered or unexported fields }
InfoObject matches the diff.Object interface, it contains the objects that shall be compared.
func (InfoObject) Live ¶
func (obj InfoObject) Live() runtime.Object
Live Returns the cluster version of the object
func (InfoObject) Merged ¶
func (obj InfoObject) Merged() (runtime.Object, error)
Merged Returns the Injected Reference Version of the Resource
func (InfoObject) Name ¶
func (obj InfoObject) Name() string
type ManualCorrelation ¶
type MetricsCorelatorDecorator ¶
type MetricsCorelatorDecorator struct { UnMatchedCRs []*unstructured.Unstructured MatchedTemplatesNames map[string]bool // contains filtered or unexported fields }
MetricsCorelatorDecorator Matches templates by using an existing correlator and gathers summary info related the correlation.
func NewMetricsCorelatorDecorator ¶
func NewMetricsCorelatorDecorator(corelator Corelator, parts []Part, errsToIgnore []error) *MetricsCorelatorDecorator
func (*MetricsCorelatorDecorator) Match ¶
func (c *MetricsCorelatorDecorator) Match(object *unstructured.Unstructured) (*template.Template, error)
type MultiCorelator ¶
type MultiCorelator struct {
// contains filtered or unexported fields
}
MultiCorelator Matches templates by attempting to find a match with one of its predefined Corelators.
func NewMultiCorealtor ¶
func NewMultiCorealtor(corelators []Corelator) *MultiCorelator
func (MultiCorelator) Match ¶
func (c MultiCorelator) Match(object *unstructured.Unstructured) (*template.Template, error)
type MultipleMatches ¶
type MultipleMatches struct { Resource *unstructured.Unstructured Matches []*template.Template }
MultipleMatches an error that can be returned by a Corelator in a case multiple template Matches were found for a Resource.
func (MultipleMatches) Error ¶
func (e MultipleMatches) Error() string
type Options ¶
type Options struct { CRs resource.FilenameOptions ShowManagedFields bool OutputFormat string Concurrency int genericiooptions.IOStreams // contains filtered or unexported fields }
func NewOptions ¶
func NewOptions(ioStreams genericiooptions.IOStreams) *Options
type Summary ¶
type Summary struct { RequiredCRS map[string]map[string][]string `json:"RequiredCRS"` NumMissing int `json:"NumMissing"` UnmatchedCRS []string `json:"UnmatchedCRS"` NumDiffCRs int `json:"NumDiffCRs"` }
Summary Contains all info included in the Summary output of the compare command
type UnknownMatch ¶
type UnknownMatch struct {
Resource *unstructured.Unstructured
}
UnknownMatch an error that can be returned by a Corelator in a case no template was matched for a Resource.
func (UnknownMatch) Error ¶
func (e UnknownMatch) Error() string
type UserConfig ¶
type UserConfig struct {
CorrelationSettings CorrelationSettings `json:"correlationSettings"`
}