Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const SysdigVMRuntimeFetchComponent = () => {

let uri = backendUrl + API_PROXY_BASE_PATH + API_VULN_RUNTIME;
let filter = '?filter=';
var name;
var names;

const annotations = entity.metadata.annotations;
if (annotations) {
Expand All @@ -170,28 +170,28 @@ export const SysdigVMRuntimeFetchComponent = () => {
var filters = []

if (SYSDIG_CLUSTER_NAME_ANNOTATION in annotations) {
name = annotations[SYSDIG_CLUSTER_NAME_ANNOTATION]
filters.push('kubernetes.cluster.name="' + name + '"');
names = annotations[SYSDIG_CLUSTER_NAME_ANNOTATION].split(',').map(w => `"${w.trim()}"`).join(', ');
filters.push(`kubernetes.cluster.name in (${names})`);
}

if (SYSDIG_NAMESPACE_ANNOTATION in annotations) {
name = annotations[SYSDIG_NAMESPACE_ANNOTATION]
filters.push('kubernetes.namespace.name="' + name + '"');
names = annotations[SYSDIG_NAMESPACE_ANNOTATION].split(',').map(w => `"${w.trim()}"`).join(', ');
filters.push(`kubernetes.namespace.name in (${names})`);
}

if (SYSDIG_WORKLOAD_ANNOTATION in annotations) {
name = annotations[SYSDIG_WORKLOAD_ANNOTATION]
filters.push('kubernetes.workload.name="' + name + '"');
names = annotations[SYSDIG_WORKLOAD_ANNOTATION].split(',').map(w => `"${w.trim()}"`).join(', ');
filters.push(`kubernetes.workload.name in (${names})`);
}

if (SYSDIG_WORKLOAD_TYPE_ANNOTATION in annotations) {
name = annotations[SYSDIG_WORKLOAD_TYPE_ANNOTATION]
filters.push('kubernetes.workload.type="' + name + '"');
names = annotations[SYSDIG_WORKLOAD_TYPE_ANNOTATION].split(',').map(w => `"${w.trim()}"`).join(', ');
filters.push(`kubernetes.workload.type in (${names})`);
}

if (SYSDIG_CONTAINER_ANNOTATION in annotations) {
name = annotations[SYSDIG_CONTAINER_ANNOTATION]
filters.push('kubernetes.pod.container.name="' + name + '"');
names = annotations[SYSDIG_CONTAINER_ANNOTATION].split(',').map(w => `"${w.trim()}"`).join(', ');
filters.push(`kubernetes.pod.container.name in (${names})`);
}

if (filters.length == 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export const SYSDIG_SOURCE_TYPE_ANNOTATION = "sysdigcloud.com/source-type";
* Runtime
*/

// Runtime annotation values also support comma separated values. Example "prod-gke,prod-eks"

// The cluster that will be included in the results. Example: "prod-gke"
export const SYSDIG_CLUSTER_NAME_ANNOTATION = "sysdigcloud.com/kubernetes-cluster-name";

Expand Down