Skip to content

Commit 2ec0112

Browse files
committed
feat: send namespace annotations as part of workload metadata
These annotations can later be processed in Kubernetes Upstream. If a certain annotation is present then the workload can be auto-imported into Snyk.
1 parent 9d2e35b commit 2ec0112

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/transmitter/payload.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
IDependencyGraphPayload,
1414
IWorkloadEventsPolicyPayload,
1515
} from './types';
16+
import { state } from '../state';
1617

1718
export function constructDepGraph(
1819
scannedImages: IScanResult[],
@@ -99,6 +100,8 @@ export function constructWorkloadMetadata(
99100
specLabels: workload.specLabels,
100101
annotations: workload.annotations,
101102
specAnnotations: workload.specAnnotations,
103+
namespaceAnnotations:
104+
state.watchedNamespaces[workload.namespace]?.metadata?.annotations,
102105
revision: workload.revision,
103106
podSpec: workload.podSpec,
104107
};

src/transmitter/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface IWorkloadMetadata {
2222
specLabels: StringMap | undefined;
2323
annotations: StringMap | undefined;
2424
specAnnotations: StringMap | undefined;
25+
namespaceAnnotations: StringMap | undefined;
2526
revision: number | undefined;
2627
podSpec: V1PodSpec;
2728
}

0 commit comments

Comments
 (0)