Skip to content

Commit 9db3d38

Browse files
committed
added regex validation to check cron format of dbBackup.schedule
Signed-off-by: Danny Zaken <dannyzaken@gmail.com>
1 parent 3b3c4f1 commit 9db3d38

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

deploy/crds/noobaa.io_noobaas.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,9 @@ spec:
12151215
schedule:
12161216
description: Schedule the schedule for the database backup
12171217
in cron format.
1218+
pattern: ^((((\d+,)+\d+|(\d+(\/|-|#)\d+)|\d+L?|\*(\/\d+)?|L(-\d+)?|\?|[A-Z]{3}(-[A-Z]{3})?)
1219+
?){5,7})|(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every
1220+
(\d+(ns|us|µs|ms|s|m|h))+)$
12181221
type: string
12191222
volumeSnapshot:
12201223
description: |-

pkg/apis/noobaa/v1alpha1/noobaa_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ type NooBaaDBSpec struct {
383383
type DBBackupSpec struct {
384384
// Schedule the schedule for the database backup in cron format.
385385
// +kubebuilder:validation:Required
386+
// +kubebuilder:validation:Pattern=`^((((\d+,)+\d+|(\d+(\/|-|#)\d+)|\d+L?|\*(\/\d+)?|L(-\d+)?|\?|[A-Z]{3}(-[A-Z]{3})?) ?){5,7})|(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)$`
386387
Schedule string `json:"schedule"`
387388

388389
// VolumeSnapshot the volume snapshot backup configuration.

pkg/bundle/deploy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ spec:
14251425
status: {}
14261426
`
14271427

1428-
const Sha256_deploy_crds_noobaa_io_noobaas_yaml = "38de565d60a559d52856d009eac5596b13fc2aa42ab12a4663c0a9a6ae2b5a5f"
1428+
const Sha256_deploy_crds_noobaa_io_noobaas_yaml = "6cdd4f5aaa21ba8c450c5e00d6f8c38f43357b4dc2c22f786dedeaebf3c69618"
14291429

14301430
const File_deploy_crds_noobaa_io_noobaas_yaml = `---
14311431
apiVersion: apiextensions.k8s.io/v1
@@ -2644,6 +2644,9 @@ spec:
26442644
schedule:
26452645
description: Schedule the schedule for the database backup
26462646
in cron format.
2647+
pattern: ^((((\d+,)+\d+|(\d+(\/|-|#)\d+)|\d+L?|\*(\/\d+)?|L(-\d+)?|\?|[A-Z]{3}(-[A-Z]{3})?)
2648+
?){5,7})|(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every
2649+
(\d+(ns|us|µs|ms|s|m|h))+)$
26472650
type: string
26482651
volumeSnapshot:
26492652
description: |-

0 commit comments

Comments
 (0)