Skip to content

Commit 6e87448

Browse files
committed
update yaml key name, fixup example troubleshoot
1 parent afd2ee9 commit 6e87448

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

pkg/apis/troubleshoot/v1beta1/redact_shared.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ type FileSelector struct {
1111
}
1212

1313
type Removals struct {
14-
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
15-
Regex []Regex `json:"regex,omitempty" yaml:"regex,omitempty"`
16-
Yaml []string `json:"yaml,omitempty" yaml:"yaml,omitempty"`
14+
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
15+
Regex []Regex `json:"regex,omitempty" yaml:"regex,omitempty"`
16+
YamlPath []string `json:"yamlPath,omitempty" yaml:"yamlPath,omitempty"`
1717
}
1818

1919
type Redact struct {

pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/collect/collector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ another line here`,
211211
Redactors: []*troubleshootv1beta1.Redact{
212212
{
213213
Removals: troubleshootv1beta1.Removals{
214-
Yaml: []string{
214+
YamlPath: []string{
215215
`abc`,
216216
},
217217
},

pkg/redact/redact.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta1.Redact
124124
additionalRedactors = append(additionalRedactors, newRedactor)
125125
}
126126

127-
for j, yaml := range redact.Removals.Yaml {
127+
for j, yaml := range redact.Removals.YamlPath {
128128
r := NewYamlRedactor(yaml, path, redactorName(i, j, redact.Name, "yaml"))
129129
additionalRedactors = append(additionalRedactors, r)
130130
}

sample-troubleshoot.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ metadata:
3939
spec:
4040
redactors:
4141
- name: replace password # names are not used internally, but are useful for recordkeeping
42-
file: data/my-password-dump # this targets a single file
43-
values:
44-
- abc123 # this is a very good password, and I don't want it to be exposed
42+
fileSelector:
43+
file: data/my-password-dump # this targets a single file
44+
removals:
45+
values:
46+
- abc123 # this is a very good password, and I don't want it to be exposed
4547
- name: all files # as no file is specified, this redactor will run against all files
46-
regex:
47-
- (another)(?P<mask>.*)(here) # this will replace anything between the strings `another` and `here` with `***HIDDEN***`
48-
multiLine:
49-
- selector: 'S3_ENDPOINT' # remove the value in lines following those that contain the string S3_ENDPOINT
50-
redactor: '("value": ").*(")'
51-
yaml:
52-
- "abc.xyz.*" # redact all items in the array at key xyz within key abc in yaml documents
48+
removals:
49+
regex:
50+
- redactor: (another)(?P<mask>.*)(here) # this will replace anything between the strings `another` and `here` with `***HIDDEN***`
51+
- selector: 'S3_ENDPOINT' # remove the value in lines following those that contain the string S3_ENDPOINT
52+
redactor: '("value": ").*(")'
53+
yamlPath:
54+
- "abc.xyz.*" # redact all items in the array at key xyz within key abc in yaml documents

0 commit comments

Comments
 (0)