Skip to content

Commit

Permalink
Support activeDeadlineSeconds for apprepository-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
rophy committed Oct 18, 2023
1 parent 2cb6c8a commit 2d22a00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/apprepository-controller/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down
4 changes: 4 additions & 0 deletions cmd/apprepository-controller/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestParseFlagsCorrect(t *testing.T) {
UserAgentComment: "",
Crontab: "*/10 * * * *",
TTLSecondsAfterFinished: "3600",
ActiveDeadlineSeconds: "",
CustomAnnotations: []string{""},
CustomLabels: []string{""},
ParsedCustomAnnotations: map[string]string{},
Expand Down Expand Up @@ -77,6 +78,7 @@ func TestParseFlagsCorrect(t *testing.T) {
UserAgentComment: "",
Crontab: "*/10 * * * *",
TTLSecondsAfterFinished: "3600",
ActiveDeadlineSeconds: "",
CustomAnnotations: []string{""},
CustomLabels: []string{""},
ParsedCustomAnnotations: map[string]string{},
Expand Down Expand Up @@ -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",
Expand All @@ -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"},
Expand Down
1 change: 1 addition & 0 deletions cmd/apprepository-controller/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Config struct {
UserAgentComment string
Crontab string
TTLSecondsAfterFinished string
ActiveDeadlineSeconds string
SuccessfulJobsHistoryLimit int32
FailedJobsHistoryLimit int32
ConcurrencyPolicy string
Expand Down

0 comments on commit 2d22a00

Please sign in to comment.