mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
add support for custom multiline redactors, add yaml redactors to spec
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
package v1beta1
|
||||
|
||||
type Redact struct {
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
File string `json:"file,omitempty" yaml:"file,omitempty"`
|
||||
Files []string `json:"files,omitempty" yaml:"files,omitempty"`
|
||||
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
|
||||
Regex []string `json:"regex,omitempty" yaml:"regex,omitempty"`
|
||||
type MultiLine struct {
|
||||
Selector string `json:"selector,omitempty" yaml:"selector,omitempty"`
|
||||
Redactor string `json:"redactor,omitempty" yaml:"redactor,omitempty"`
|
||||
}
|
||||
|
||||
type Redact struct {
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
File string `json:"file,omitempty" yaml:"file,omitempty"`
|
||||
Files []string `json:"files,omitempty" yaml:"files,omitempty"`
|
||||
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
|
||||
Regex []string `json:"regex,omitempty" yaml:"regex,omitempty"`
|
||||
MultiLine []MultiLine `json:"multiLine,omitempty" yaml:"multiLine,omitempty"`
|
||||
Yaml []string `json:"yaml,omitempty" yaml:"yaml,omitempty"`
|
||||
}
|
||||
|
||||
@@ -915,6 +915,21 @@ func (in *Logs) DeepCopy() *Logs {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MultiLine) DeepCopyInto(out *MultiLine) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiLine.
|
||||
func (in *MultiLine) DeepCopy() *MultiLine {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MultiLine)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeResourceFilters) DeepCopyInto(out *NodeResourceFilters) {
|
||||
*out = *in
|
||||
@@ -1165,6 +1180,16 @@ func (in *Redact) DeepCopyInto(out *Redact) {
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.MultiLine != nil {
|
||||
in, out := &in.MultiLine, &out.MultiLine
|
||||
*out = make([]MultiLine, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Yaml != nil {
|
||||
in, out := &in.Yaml, &out.Yaml
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redact.
|
||||
|
||||
@@ -65,7 +65,7 @@ func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta1.Redact
|
||||
for _, re := range redact.Regex {
|
||||
r, err := NewSingleLineRedactor(re, MASK_TEXT)
|
||||
if err != nil {
|
||||
return nil, err // maybe skip broken ones?
|
||||
return nil, errors.Wrapf(err, "redactor %q", re)
|
||||
}
|
||||
additionalRedactors = append(additionalRedactors, r)
|
||||
}
|
||||
@@ -73,6 +73,14 @@ func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta1.Redact
|
||||
for _, literal := range redact.Values {
|
||||
additionalRedactors = append(additionalRedactors, literalString(literal))
|
||||
}
|
||||
|
||||
for _, re := range redact.MultiLine {
|
||||
r, err := NewMultiLineRedactor(re.Selector, re.Redactor, MASK_TEXT)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "multiline redactor %+v", re)
|
||||
}
|
||||
additionalRedactors = append(additionalRedactors, r)
|
||||
}
|
||||
}
|
||||
return additionalRedactors, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user