Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(printFlags *genericclioptions.PrintFlags, aesKey string, files ...string) error
- func Sort(resources []*GroupResource) func(int, int) bool
- func UpdateFrom(config *Config, path string) error
- type Config
- func (c *Config) EncryptFields(res *GroupResource, us unstructured.Unstructured)
- 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) MaxArchiveAge() time.Time
- func (c *Config) OutputFormat() string
- func (c *Config) RestConfig() (*rest.Config, error)
- func (c *Config) SortSliceFields(res *GroupResource, us unstructured.Unstructured)
- func (c *Config) Validate() error
- type Encrypted
- type Excluded
- type FieldValue
- type GroupResource
- type Included
- type KindFields
- type Masked
- type Progress
- type S3Config
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") // ProgressBarBubbles bubbles progress bar mode ProgressBarBubbles = Progress("bubbles") // ProgressSimple simple progress mode ProgressSimple = Progress("simple") // ProgressNone no progress ProgressNone = Progress("none") // DefaultMaskReplacement Default Mask Replacement DefaultMaskReplacement = "*****" )
const (
EnvAesKey = "KUBEXPORTER_AES_KEY"
)
Variables ¶
var ( // DefaultExcludedFields the default field to be excluded DefaultExcludedFields = [][]string{ {"status"}, {"metadata", "uid"}, {"metadata", "selfLink"}, {"metadata", "resourceVersion"}, {"metadata", "creationTimestamp"}, {"metadata", "deletionTimestamp"}, {"metadata", "deletionGracePeriodSeconds"}, {"metadata", "generation"}, {"metadata", "annotations", "kubectl.kubernetes.io/last-applied-configuration"}, } )
Functions ¶
func Decrypt ¶ added in v0.5.5
func Decrypt(printFlags *genericclioptions.PrintFlags, aesKey string, files ...string) error
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"` CreatedWithin time.Duration `json:"createdWithin" yaml:"createdWithin"` ConsiderOwnerReferences bool `json:"considerOwnerReferences" yaml:"considerOwnerReferences"` Masked *Masked `json:"masked" yaml:"masked"` Encrypted *Encrypted `json:"encrypted" 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"` S3Config *S3Config `json:"s3" yaml:"s3"` Quiet bool `json:"quiet" yaml:"quiet"` Verbose bool `json:"verbose" yaml:"verbose"` PrintFlags *genericclioptions.PrintFlags `json:"-" yaml:"-"` // 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) EncryptFields ¶ added in v0.5.5
func (c *Config) EncryptFields(res *GroupResource, us unstructured.Unstructured)
EncryptFields encrypts fields for a given resource
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) MaxArchiveAge ¶ added in v0.6.0
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 Encrypted ¶ added in v0.5.5
type Encrypted struct { AesKey string `json:"aesKey" yaml:"aesKey"` KindFields KindFields `json:"kindFields" yaml:"kindFields"` // contains filtered or unexported fields }
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
func (KindFields) Diff ¶ added in v0.5.5
func (f KindFields) Diff(other KindFields) KindFields
Diff returns new KindFields with values that are only in the provided argument and not in this
func (KindFields) String ¶ added in v0.5.5
func (f KindFields) String() string
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
type S3Config ¶ added in v0.6.0
type S3Config struct { Endpoint string `json:"endpoint" yaml:"endpoint"` AccessKeyID string `json:"accessKeyID" yaml:"accessKeyID"` SecretAccessKey string `json:"secretAccessKey" yaml:"secretAccessKey"` Token string `json:"token" yaml:"token"` Secure bool `json:"secure" yaml:"secure"` Bucket string `json:"bucket" yaml:"bucket"` }