Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 41d9e64

Browse files
committed
Inline ownerReference
1 parent 31630c3 commit 41d9e64

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

hooks/imperative-subsequent-scans/scan-helpers.js

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,31 @@ async function startSubsequentSecureCodeBoxScan({
1717
kind: "Scan",
1818
metadata: {
1919
name: name,
20-
namespace: process.env['NAMESPACE'],
20+
namespace: process.env["NAMESPACE"],
2121
labels: {
2222
...parentScan.metadata.labels,
2323
},
2424
annotations: {
25-
'securecodebox.io/hook': 'nmap-subsequent-scans',
26-
'securecodebox.io/parent-scan': parentScan.metadata.name,
25+
"securecodebox.io/hook": "nmap-subsequent-scans",
26+
"securecodebox.io/parent-scan": parentScan.metadata.name,
2727
},
28-
...(await getOwnerReference(parentScan)),
28+
ownerReferences: [
29+
{
30+
apiVersion: "execution.experimental.securecodebox.io/v1",
31+
blockOwnerDeletion: true,
32+
controller: true,
33+
kind: "Scan",
34+
name: parentScan.metadata.name,
35+
uid: parentScan.metadata.uid,
36+
},
37+
],
2938
},
3039
spec: {
3140
scanType,
3241
parameters,
3342
},
3443
};
3544

36-
3745
try {
3846
// Starting another subsequent sslyze scan based on the nmap results
3947
// found at: https://github.com/kubernetes-client/javascript/blob/79736b9a608c18d818de61a6b44503a08ea3a78f/src/gen/api/customObjectsApi.ts#L209
@@ -51,19 +59,4 @@ async function startSubsequentSecureCodeBoxScan({
5159
}
5260
}
5361

54-
async function getOwnerReference(parentScan) {
55-
return {
56-
ownerReferences: [
57-
{
58-
apiVersion: 'execution.experimental.securecodebox.io/v1',
59-
blockOwnerDeletion: true,
60-
controller: true,
61-
kind: 'Scan',
62-
name: parentScan.metadata.name,
63-
uid: parentScan.metadata.uid,
64-
},
65-
],
66-
};
67-
}
68-
6962
module.exports.startSubsequentSecureCodeBoxScan = startSubsequentSecureCodeBoxScan;

0 commit comments

Comments
 (0)