From 87f9dae368d2e18c199cf41bc38e36db8ecfc363 Mon Sep 17 00:00:00 2001 From: Daniel Pacak Date: Mon, 27 Jul 2020 14:52:49 +0200 Subject: [PATCH] fix: Schedule Aqua scan jobs to the specified node (#24) Resolves: #23 Signed-off-by: Daniel Pacak --- pkg/aqua/scanner/scanner.go | 1 + pkg/aqua/scanner/scanner_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pkg/aqua/scanner/scanner.go b/pkg/aqua/scanner/scanner.go index 5f7c178..e434755 100644 --- a/pkg/aqua/scanner/scanner.go +++ b/pkg/aqua/scanner/scanner.go @@ -89,6 +89,7 @@ func (s *scanner) PrepareScanJob(_ context.Context, resource kube.Object, spec c Spec: core.PodSpec{ RestartPolicy: core.RestartPolicyNever, ServiceAccountName: serviceAccountName, + NodeName: spec.NodeName, Volumes: []core.Volume{ { Name: "scannercli", diff --git a/pkg/aqua/scanner/scanner_test.go b/pkg/aqua/scanner/scanner_test.go index 28c3902..2025f76 100644 --- a/pkg/aqua/scanner/scanner_test.go +++ b/pkg/aqua/scanner/scanner_test.go @@ -63,6 +63,7 @@ func TestScanner_PrepareScanJob(t *testing.T) { Name: "nginx", Namespace: "dev", }, core.PodSpec{ + NodeName: "worker-node", Containers: []core.Container{ { Name: "nginx", @@ -95,6 +96,7 @@ func TestScanner_PrepareScanJob(t *testing.T) { Spec: core.PodSpec{ RestartPolicy: core.RestartPolicyNever, ServiceAccountName: "starboard-scanner-aqua", + NodeName: "worker-node", Volumes: []core.Volume{ { Name: "scannercli",