Skip to content

Commit 7986973

Browse files
authored
Merge pull request #263 from jetstack/send-secret-annotations
Send secret annotations to platform
2 parents 2ae7e2c + 8cffbd9 commit 7986973

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

pkg/datagatherer/k8s/dynamic_test.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,17 @@ func getSecret(name, namespace string, data map[string]interface{}, isTLS bool,
6161
}
6262

6363
metadata, _ := object.Object["metadata"].(map[string]interface{})
64+
annotations := make(map[string]interface{})
6465

6566
// if we're creating a 'raw' secret as scraped that was applied by kubectl
6667
if withLastApplied {
6768
jsonData, _ := json.Marshal(data)
68-
metadata["annotations"] = map[string]interface{}{
69-
"kubectl.kubernetes.io/last-applied-configuration": string(jsonData),
70-
}
69+
annotations["kubectl.kubernetes.io/last-applied-configuration"] = string(jsonData)
7170
}
7271

73-
return object
74-
}
72+
metadata["annotations"] = annotations
7573

76-
func asUnstructuredList(items ...*unstructured.Unstructured) *unstructured.UnstructuredList {
77-
itemsNonPtr := make([]unstructured.Unstructured, len(items))
78-
for i, u := range items {
79-
itemsNonPtr[i] = *u
80-
}
81-
return &unstructured.UnstructuredList{
82-
Object: map[string]interface{}{
83-
"metadata": map[string]interface{}{
84-
"resourceVersion": "",
85-
},
86-
},
87-
Items: itemsNonPtr,
88-
}
74+
return object
8975
}
9076

9177
func sortGatheredResources(list []*api.GatheredResource) {

pkg/datagatherer/k8s/fieldfilter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
var SecretSelectedFields = []string{
1515
"kind",
1616
"apiVersion",
17+
"metadata.annotations",
1718
"metadata.name",
1819
"metadata.namespace",
1920
"metadata.ownerReferences",

0 commit comments

Comments
 (0)