Documentation ¶
Index ¶
- Constants
- Variables
- func Sort(resources []*GroupResource) func(int, int) bool
- func UpdateFrom(config *Config, path string) error
- type Config
- func (c *Config) FileName(res *GroupResource, us *unstructured.Unstructured, index int) (string, error)
- func (c *Config) FilterFields(res *GroupResource, us unstructured.Unstructured)
- func (c *Config) IsExcluded(gr *GroupResource) bool
- func (c *Config) IsInstanceExcluded(res *GroupResource, us unstructured.Unstructured) bool
- func (c *Config) ListFileName(res *GroupResource, namespace string) (string, error)
- func (c *Config) Logger() log.YALI
- func (c *Config) MaskFields(res *GroupResource, us unstructured.Unstructured)
- func (c *Config) OutputFormat() string
- func (c *Config) PrintObj(ro runtime.Object, out io.Writer) error
- func (c *Config) RestConfig() (*rest.Config, error)
- func (c *Config) SortSliceFields(res *GroupResource, us unstructured.Unstructured)
- func (c *Config) Validate() error
- type Excluded
- type FieldValue
- type GroupResource
- type Included
- type KindFields
- type Masked
- type Progress
Constants ¶
const ( // DefaultFileNameTemplate default file name template DefaultFileNameTemplate = `{{default "_cluster_" .Namespace}}/{{if .Group}}{{printf "%s." .Group }}{{end}}{{.Kind}}.{{.Name}}.{{.Extension}}` // DefaultListFileNameTemplate default list file name template DefaultListFileNameTemplate = `{{default "_cluster_" .Namespace}}/{{if .Group}}{{printf "%s." .Group }}{{end}}{{.Kind}}.{{.Extension}}` // DefaultFormat default output format DefaultFormat = "yaml" // DefaultTarget default export target dir DefaultTarget = "exports" // ProgressBar progress bar mode ProgressBar = Progress("bar") // ProgressSimple simple progress mode ProgressSimple = Progress("simple") // ProgressNone no progress ProgressNone = Progress("none") // DefaultMaskReplacement Default Mask Replacement DefaultMaskReplacement = "*****" )
Variables ¶
var ( // DefaultExcludedFields the default field to be excluded DefaultExcludedFields = [][]string{ {"status"}, {"metadata", "uid"}, {"metadata", "selfLink"}, {"metadata", "resourceVersion"}, {"metadata", "creationTimestamp"}, {"metadata", "generation"}, {"metadata", "annotations", "kubectl.kubernetes.io/last-applied-configuration"}, } )
Functions ¶
func Sort ¶ added in v0.0.2
func Sort(resources []*GroupResource) func(int, int) bool
Sort GroupResource
func UpdateFrom ¶ added in v0.4.1
UpdateFrom the config from the file with given path
Types ¶
type Config ¶
type Config struct { Excluded Excluded `json:"excluded" yaml:"excluded"` Included Included `json:"included" yaml:"included"` Masked *Masked `json:"masked" yaml:"masked"` SortSlices KindFields `json:"sortSlices" yaml:"sortSlices"` FileNameTemplate string `json:"fileNameTemplate" yaml:"fileNameTemplate"` ListFileNameTemplate string `json:"listFileNameTemplate" yaml:"listFileNameTemplate"` AsLists bool `json:"asLists" yaml:"asLists"` QueryPageSize int `json:"queryPageSize" yaml:"queryPageSize"` Target string `json:"target" yaml:"target"` ClearTarget bool `json:"clearTarget" yaml:"clearTarget"` Summary bool `json:"summary" yaml:"summary"` Progress Progress `json:"progress" yaml:"progress"` Namespace string `json:"namespace" yaml:"namespace"` Worker int `json:"worker" yaml:"worker"` Archive bool `json:"archive" yaml:"archive"` ArchiveRetentionDays int `json:"archiveRetentionDays" yaml:"archiveRetentionDays"` ArchiveTarget string `json:"archiveTarget" yaml:"archiveTarget"` Quiet bool `json:"quiet" yaml:"quiet"` Verbose bool `json:"verbose" yaml:"verbose"` // contains filtered or unexported fields }
Config export config
func NewConfig ¶ added in v0.2.0
func NewConfig(configFlags *genericclioptions.ConfigFlags, printFlags *genericclioptions.PrintFlags) *Config
NewConfig create a new config
func (*Config) FileName ¶
func (c *Config) FileName(res *GroupResource, us *unstructured.Unstructured, index int) (string, error)
FileName generate export file name
func (*Config) FilterFields ¶ added in v0.1.0
func (c *Config) FilterFields(res *GroupResource, us unstructured.Unstructured)
FilterFields filter fields for a given resource
func (*Config) IsExcluded ¶
func (c *Config) IsExcluded(gr *GroupResource) bool
IsExcluded check if the group resource is excluded
func (*Config) IsInstanceExcluded ¶ added in v0.4.0
func (c *Config) IsInstanceExcluded(res *GroupResource, us unstructured.Unstructured) bool
IsInstanceExcluded check if the kind instance is excluded
func (*Config) ListFileName ¶ added in v0.1.0
func (c *Config) ListFileName(res *GroupResource, namespace string) (string, error)
ListFileName generate export list file name
func (*Config) MaskFields ¶ added in v0.3.0
func (c *Config) MaskFields(res *GroupResource, us unstructured.Unstructured)
MaskFields mask fields for a given resource
func (*Config) OutputFormat ¶
OutputFormat get the current output format
func (*Config) RestConfig ¶ added in v0.2.0
RestConfig get the current rest config
func (*Config) SortSliceFields ¶ added in v0.4.0
func (c *Config) SortSliceFields(res *GroupResource, us unstructured.Unstructured)
SortSliceFields sort fields for a given resource
type Excluded ¶
type Excluded struct { Kinds []string `json:"kinds" yaml:"kinds"` Fields [][]string `json:"fields" yaml:"fields"` KindFields KindFields `json:"kindFields" yaml:"kindFields"` KindsByField map[string][]FieldValue `json:"kindByField" yaml:"kindByField"` }
Excluded exclusion params
type FieldValue ¶ added in v0.4.0
type FieldValue struct { Field []string `json:"field" yaml:"field"` Values []string `json:"values" yaml:"values" ` }
FieldValue field with value
type GroupResource ¶
type GroupResource struct { APIGroup string APIGroupVersion string APIResource metav1.APIResource APIVersion string Instances int ExportedInstances int Pages int Error string QueryDuration time.Duration ExportDuration time.Duration }
GroupResource group resource information
func (GroupResource) GroupKind ¶
func (r GroupResource) GroupKind() string
GroupKind get concatenated group and kind
type Included ¶ added in v0.1.0
type Included struct {
Kinds []string `json:"kinds" yaml:"kinds"`
}
Included inclusion params
type KindFields ¶ added in v0.4.0
KindFields map kinds to fields
type Masked ¶ added in v0.3.0
type Masked struct { Replacement string `json:"replacement" yaml:"replacement"` Checksum string `json:"checksum" yaml:"checksum"` KindFields KindFields `json:"kindFields" yaml:"kindFields"` // contains filtered or unexported fields }
Masked masking params