Skip to content

Commit 764414b

Browse files
Jonathan S. Katzjkatz
authored andcommitted
Updated robig/cron.v2 to robig/cron.v3, i.e. v3.0.1
Several race conditions and other things have been updated between the the different versions. Per various issues being reported in deleting PostgreSQL Operator schedules, it seemed appropriate to attempt to fix them by updating the library, as we have had mixed success reproducing the issue (evident of a race). Issue: [ch6933]
1 parent 08e2b05 commit 764414b

30 files changed

+2910
-1090
lines changed

Gopkg.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ version = "6.0.0"
1010
name = "k8s.io/api"
1111
version = "kubernetes-1.9.0"
1212

13-
[[constraint]]
14-
branch = "v2"
15-
name = "gopkg.in/robfig/cron.v2"
16-
1713
[[constraint]]
1814
name = "github.com/nsqio/go-nsq"
1915
version = "v1.0.7"
@@ -26,3 +22,6 @@ name = "gopkg.in/robfig/cron.v2"
2622
name = "gopkg.in/yaml.v2"
2723
version = ">=v2.2.3" # < 2.2.3 has a DoS vuln
2824

25+
[[constraint]]
26+
name = "gopkg.in/robfig/cron.v3"
27+
version = "3.0.1"

pgo-scheduler/scheduler/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/crunchydata/postgres-operator/apiserver"
2626
log "github.com/sirupsen/logrus"
2727

28-
cv2 "gopkg.in/robfig/cron.v2"
28+
cv2 "gopkg.in/robfig/cron.v3"
2929
"k8s.io/api/core/v1"
3030
"k8s.io/client-go/kubernetes"
3131
)

pgo-scheduler/scheduler/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"k8s.io/client-go/kubernetes"
2222
"k8s.io/client-go/rest"
2323

24-
cv2 "gopkg.in/robfig/cron.v2"
24+
cv2 "gopkg.in/robfig/cron.v3"
2525
)
2626

2727
var kubeClient *kubernetes.Clientset

pgo-scheduler/scheduler/validate.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121
"strings"
2222

23-
cv2 "gopkg.in/robfig/cron.v2"
23+
cv3 "gopkg.in/robfig/cron.v3"
2424
)
2525

2626
func validate(s ScheduleTemplate) error {
@@ -44,8 +44,12 @@ func validate(s ScheduleTemplate) error {
4444
return nil
4545
}
4646

47+
// ValidateSchedule validates that the cron syntax is valid
48+
// We use the standard format here...
4749
func ValidateSchedule(schedule string) error {
48-
if _, err := cv2.Parse(schedule); err != nil {
50+
parser := cv3.NewParser(cv3.Minute | cv3.Hour | cv3.Dom | cv3.Month | cv3.Dow)
51+
52+
if _, err := parser.Parse(schedule); err != nil {
4953
return fmt.Errorf("%s is not a valid schedule: ", schedule)
5054
}
5155
return nil

vendor/gopkg.in/robfig/cron.v2/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/gopkg.in/robfig/cron.v2/cron.go

Lines changed: 0 additions & 236 deletions
This file was deleted.

0 commit comments

Comments
 (0)