Skip to content

Commit 8972f45

Browse files
authored
Correct JSONPointer for redacting last-applied (#206)
This will only make a difference for non-secret resources. Secret resources lose this annotation via selection. Also use the Redact fields package var Signed-off-by: Charlie Egan <[email protected]>
1 parent 97440f3 commit 8972f45

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/Azure/go-autorest/autorest v0.11.8 // indirect
99
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
1010
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
11-
github.com/Jeffail/gabs v1.1.1
1211
github.com/Jeffail/gabs/v2 v2.6.0
1312
github.com/aws/aws-sdk-go v1.34.10
1413
github.com/cenkalti/backoff v2.0.0+incompatible

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
9090
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
9191
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
9292
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
93-
github.com/Jeffail/gabs v1.4.0 h1://5fYRRTq1edjfIrQGvdkcd22pkYUrHZ5YC/H2GJVAo=
9493
github.com/Jeffail/gabs/v2 v2.6.0 h1:WdCnGaDhNa4LSRTMwhLZzJ7SRDXjABNP13SOKvCpL5w=
9594
github.com/Jeffail/gabs/v2 v2.6.0/go.mod h1:xCn81vdHKxFUuWWAaD5jCTQDNPBMh5pPs9IJ+NcziBI=
9695
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=

pkg/agent/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func gatherAndOutputData(ctx context.Context, config Config, preflightClient *cl
156156
}
157157

158158
if OutputPath != "" {
159-
data, err := json.MarshalIndent(readings, " ", " ")
159+
data, err := json.MarshalIndent(readings, "", " ")
160160
err = ioutil.WriteFile(OutputPath, data, 0644)
161161
if err != nil {
162162
log.Fatal(err)

pkg/datagatherer/k8s/dynamic.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,11 @@ func redactList(list *unstructured.UnstructuredList) error {
183183
break
184184
}
185185

186-
// remove managedFields from all resources
187-
Redact([]string{
188-
"metadata.managedFields",
189-
}, &resource)
190186
}
191187

188+
// remove managedFields from all resources
189+
Redact(RedactFields, &resource)
190+
192191
// update the object in the list
193192
list.Items[i] = resource
194193
}

pkg/datagatherer/k8s/fieldfilter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var SecretSelectedFields = []string{
2424
// RedactFields are removed from all objects
2525
var RedactFields = []string{
2626
"metadata.managedFields",
27-
"/metadata.annotations/kubectl.kubernetes.io~1last-applied-configuration",
27+
"/metadata/annotations/kubectl.kubernetes.io~1last-applied-configuration",
2828
}
2929

3030
// Select removes all but the supplied fields from the resource

0 commit comments

Comments
 (0)