diff --git a/cmd/apprepository-controller/cmd/root.go b/cmd/apprepository-controller/cmd/root.go index 1f87b0e64f2c..5de6b8d0dd38 100644 --- a/cmd/apprepository-controller/cmd/root.go +++ b/cmd/apprepository-controller/cmd/root.go @@ -90,6 +90,7 @@ func setFlags(c *cobra.Command) { c.Flags().StringVar(&serveOpts.UserAgentComment, "user-agent-comment", "", "UserAgent comment used during outbound requests") c.Flags().StringVar(&serveOpts.Crontab, "crontab", "*/10 * * * *", "CronTab to specify schedule") c.Flags().StringVar(&serveOpts.TTLSecondsAfterFinished, "ttl-lifetime-afterfinished-job", "3600", "Lifetime limit after which the resource Jobs are deleted expressed in seconds by default is 3600 (1h)") + c.Flags().StringVar(&serveOpts.ActiveDeadlineSeconds, "active-deadline-seconds", "", "Seconds after which running pods of the resource Jobs will be terminated.") c.Flags().Int32Var(&serveOpts.SuccessfulJobsHistoryLimit, "successful-jobs-history-limit", 3, "Number of successful finished jobs to retain") c.Flags().Int32Var(&serveOpts.FailedJobsHistoryLimit, "failed-jobs-history-limit", 1, "Number of failed finished jobs to retain") c.Flags().StringVar(&serveOpts.ConcurrencyPolicy, "concurrency-policy", "Replace", "How to treat concurrent executions of a Job. Valid values are: 'Allow', 'Forbid' and 'Replace'") diff --git a/cmd/apprepository-controller/cmd/root_test.go b/cmd/apprepository-controller/cmd/root_test.go index 74065433169a..efa7a31c8329 100644 --- a/cmd/apprepository-controller/cmd/root_test.go +++ b/cmd/apprepository-controller/cmd/root_test.go @@ -41,6 +41,7 @@ func TestParseFlagsCorrect(t *testing.T) { UserAgentComment: "", Crontab: "*/10 * * * *", TTLSecondsAfterFinished: "3600", + ActiveDeadlineSeconds: "", CustomAnnotations: []string{""}, CustomLabels: []string{""}, ParsedCustomAnnotations: map[string]string{}, @@ -77,6 +78,7 @@ func TestParseFlagsCorrect(t *testing.T) { UserAgentComment: "", Crontab: "*/10 * * * *", TTLSecondsAfterFinished: "3600", + ActiveDeadlineSeconds: "", CustomAnnotations: []string{""}, CustomLabels: []string{""}, ParsedCustomAnnotations: map[string]string{}, @@ -111,6 +113,7 @@ func TestParseFlagsCorrect(t *testing.T) { "--custom-annotations", "extra13=extra13", "--custom-labels", "foo14=bar14,foo14x=bar14x", "--ttl-lifetime-afterfinished-job", "1200", + "--active-deadline-seconds", "300", "--v1-beta1-cron-jobs", "true", "--successful-jobs-history-limit", "33", "--failed-jobs-history-limit", "11", @@ -134,6 +137,7 @@ func TestParseFlagsCorrect(t *testing.T) { UserAgentComment: "foo11", Crontab: "foo12", TTLSecondsAfterFinished: "1200", + ActiveDeadlineSeconds: "300", CustomAnnotations: []string{"foo13=bar13", "foo13x=bar13x", "extra13=extra13"}, CustomLabels: []string{"foo14=bar14", "foo14x=bar14x"}, ParsedCustomAnnotations: map[string]string{"foo13": "bar13", "foo13x": "bar13x", "extra13": "extra13"}, diff --git a/cmd/apprepository-controller/server/server.go b/cmd/apprepository-controller/server/server.go index a728cfb53338..7344c91a3c45 100644 --- a/cmd/apprepository-controller/server/server.go +++ b/cmd/apprepository-controller/server/server.go @@ -32,6 +32,7 @@ type Config struct { UserAgentComment string Crontab string TTLSecondsAfterFinished string + ActiveDeadlineSeconds string SuccessfulJobsHistoryLimit int32 FailedJobsHistoryLimit int32 ConcurrencyPolicy string