Change cron syntax to standard format (#2678)

* Change cron syntax to standard format
* Add standard cron example in showschedule command

Signed-off-by: Shubham Nazare <shubham4443@gmail.com>
This commit is contained in:
Shubham Nazare
2023-01-02 20:05:58 +05:30
committed by GitHub
parent fcf4fd2e63
commit 922cb34243
8 changed files with 20 additions and 17 deletions
+3 -2
View File
@@ -25,7 +25,7 @@ import (
"strings"
"github.com/hashicorp/go-multierror"
"github.com/robfig/cron"
"github.com/robfig/cron/v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation"
@@ -170,7 +170,8 @@ func ValidateKubeReference(refName string, name string, namespace string) error
}
func IsValidCronSpec(spec string) error {
_, err := cron.Parse(spec)
cronSpecParser := cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)
_, err := cronSpecParser.Parse(spec)
return err
}