-
Notifications
You must be signed in to change notification settings - Fork 179
Added a crontab configuration option to scheduledScans #1722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
677b39c
#150 added schedule and cronjob logic to scheduledscan controller
Ilyesbdlala 609a946
#150 WIP Added tests for scheduled scans with cron config
Ilyesbdlala 4b48d06
#150 Added auto-gen files and config
Ilyesbdlala 0fe8e47
fix newline in makefile of operator
Ilyesbdlala d83c5f0
#180 Added "Schedule" print column to ScheduledScan CRD
Ilyesbdlala f8e4a1d
#180 Regenerated CRD yaml files
Ilyesbdlala b3afdd4
Fixed earliest time logic in getNextSchedule for ScheduledScans
Ilyesbdlala ba35756
#180 Fix to generated scheduledScan yaml file
Ilyesbdlala 1e4ea5c
#150 Added a fake Clock that allows for testing crontab ScheduledScans
Ilyesbdlala 779db14
#150 Commented out the test for cronjob scheduled scan until a solut…
Ilyesbdlala f95bd32
#150 replaced fakeClock with active waiting
Ilyesbdlala 1e8f7ec
#150 Replaced tests of active waiting with polling for scheduledSca…
Ilyesbdlala 185482f
#150 Increased the timeout for the scheduledScan Cronjob test
Ilyesbdlala 9c4fa1c
#150 Added a go tag to seperate between slow tests and fast tests
Ilyesbdlala ede2c2d
#150 Removed fakeClock definition since it's no longer used
Ilyesbdlala 2ddcfc1
#150 removed unused library in operator test suite `time`
Ilyesbdlala 4ae1326
#150 Added k8s events to the parsing and handling schedule/interval …
Ilyesbdlala 21fc70b
#150 Added missing rbac permissions create and patch k8s events
Ilyesbdlala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "makefileMagic", | ||
| "command": "bash", | ||
| "args": ["-c", "source ${workspaceFolder}/testbin/setup-envtest.sh && fetch_envtest_tools ${workspaceFolder}/testbin && setup_envtest_env ${workspaceFolder}/testbin"], | ||
| "type": "shell" | ||
| }, | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
operator/controllers/execution/scheduledscan_controller_slow_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // SPDX-FileCopyrightText: the secureCodeBox authors | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| //go:build slow | ||
| // +build slow | ||
|
|
||
| package controllers | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| . "github.com/onsi/ginkgo" | ||
| . "github.com/onsi/gomega" | ||
| executionv1 "github.com/secureCodeBox/secureCodeBox/operator/apis/execution/v1" | ||
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| //+kubebuilder:scaffold:imports | ||
| ) | ||
|
|
||
| var _ = Describe("ScheduledScan controller", func() { | ||
| Context("A Scan is triggred due to a Scheduled Scan with Schedule in Spec", func() { | ||
| It("The ScheduledScan's should be triggered according to the Schedule", func() { | ||
| ctx := context.Background() | ||
| namespace := "scantype-multiple-scheduled-scan-triggerd-test-schedule" | ||
|
|
||
| createNamespace(ctx, namespace) | ||
| createScanType(ctx, namespace) | ||
| scheduledScan := createScheduledScanWithSchedule(ctx, namespace, true) | ||
|
|
||
| var scanlist executionv1.ScanList | ||
|
|
||
| // ensure that the ScheduledScan has been triggered | ||
| waitForScheduledScanToBeTriggered(ctx, namespace, 90*time.Second) | ||
| k8sClient.List(ctx, &scanlist, client.InNamespace(namespace)) | ||
|
|
||
| Expect(scheduledScan.Spec.Schedule).Should(Equal("*/1 * * * *")) | ||
| Expect(scanlist.Items).Should(HaveLen(1)) | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.