Skip to content

Commit b83417e

Browse files
committed
chore: specify imagelocator attributes
we are sending to homebase unnecessary fields that are being thrown away in homebase this fix makes sure that imagelocator attributes are only those that used to locate the image
1 parent 4f388f9 commit b83417e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/transmitter/payload.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import config = require('../common/config');
22
import { currentClusterName } from '../kube-scanner/cluster';
33
import { ScanResult } from '../kube-scanner/image-scanner';
4-
import { IDeleteWorkloadPayload, IDepGraphPayload, IKubeImage, ILocalWorkloadLocator } from './types';
4+
import { IDeleteWorkloadPayload, IDepGraphPayload, IKubeImage, ILocalWorkloadLocator, IImageLocator } from './types';
55

66
export function constructHomebaseWorkloadPayloads(
77
scannedImages: ScanResult[],
8-
imageMetadata: IKubeImage[],
8+
workloadMetadata: IKubeImage[],
99
): IDepGraphPayload[] {
1010
const results = scannedImages.map((scannedImage) => {
11-
const metadata = imageMetadata.find((meta) => meta.imageName === scannedImage.imageWithTag)!;
11+
const kubeImage: IKubeImage = workloadMetadata.find((meta) => meta.imageName === scannedImage.imageWithTag)!;
1212

13-
const { imageName: image, ...workloadLocator } = metadata;
13+
const { cluster, namespace, type, name } = kubeImage;
1414

15-
const imageLocator = {
16-
...workloadLocator,
15+
const imageLocator: IImageLocator = {
1716
userLocator: config.INTEGRATION_ID,
1817
imageId: scannedImage.image,
18+
cluster,
19+
namespace,
20+
type,
21+
name,
1922
};
2023

2124
return {

src/transmitter/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface IWorkloadMetadata extends IWorkloadLocator {
1717
uid: string;
1818
}
1919

20-
export interface IImageLocator extends IWorkloadMetadata {
20+
export interface IImageLocator extends IWorkloadLocator {
2121
imageId: string;
2222
}
2323

0 commit comments

Comments
 (0)