Skip to content

ScheduledScan requires interval even though a cron schedule is configured #1993

@moxli

Description

@moxli

🐞 Bug report

Describe the bug

Using the crontab schedule introduced in release 4.1.0 I am trying to run a scan based on a schedule.
In the configuration the interval value was not set.
During deployment Kubernetes prevents the deployment with the following error message:

LT100144 ~/code/shorts/securecodebox: kubectl apply -f scheduled-nikto-scan.yaml
error: error validating "scheduled-nikto-scan.yaml": error validating data: ValidationError(ScheduledScan.spec): missing required field "interval" in io.securecodebox.execution.v1.ScheduledScan.spec; if you choose to ignore these errors, turn validation off with --validate=false

After adding the interval the apply works and it seems like the scheduledscan will be triggered based on the schedule.
Please find the working yaml also below.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install SecureCodeBox 4.1.0
  2. apply the ScheduledScan configuration I provided below
  3. See error

Expected behavior

I expect the schedule setting to replace the interval since both define WHEN a scan shall be triggered.

System (please complete the following information):

  • secureCodeBox Version: 4.1.0
  • OS: Linux
  • Kubernetes Version: 1.24.14-gke.2700
  • Docker Version: N/A
  • Install Method: Helm with Terraform

Additional context

Not working ScheduledScan yaml configuration without spec.interval:

apiVersion: "execution.securecodebox.io/v1"
kind: ScheduledScan
metadata:
  name: "nikto-schedule-1h"
spec:
  schedule: "5 4 * * *"
  scanSpec:
    scanType: "nikto"
    parameters:
      - "-h"
      - "REDACTED"
      - "-Tuning"
      - "1,2,3,5,7,b"
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 5

Working ScheduledScan yaml configuration with spec.interval:

apiVersion: "execution.securecodebox.io/v1"
kind: ScheduledScan
metadata:
  name: "nikto-schedule-1h"
spec:
  schedule: "5 4 * * *"
  interval: "12h"
  scanSpec:
    scanType: "nikto"
    parameters:
      - "-h"
      - "REDACTED"
      - "-Tuning"
      - "1,2,3,5,7,b"
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 5

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions