feat: expose concurrency policy to kubernetes jobs

This commit is contained in:
Jose Diaz-Gonzalez committed 2025-11-10 03:07:29 -05:00
1 parent f1e3c0764c
commit f38bc64119
3 files changed
+20 -9

No files matched your search

+13 -4
View File
@@ -299,12 +299,21 @@ const (
) )
type ProcessCron struct { type ProcessCron struct {
ID string `yaml:"id"` ID string `yaml:"id"`
Schedule string `yaml:"schedule"` Schedule string `yaml:"schedule"`
Suffix string `yaml:"suffix"` Suffix string `yaml:"suffix"`
Suspend bool `yaml:"suspend"` Suspend bool `yaml:"suspend"`
ConcurrencyPolicy ProcessCronConcurrencyPolicy `yaml:"concurrency_policy"`
} }
type ProcessCronConcurrencyPolicy string
const (
ProcessCronConcurrencyPolicy_Allow ProcessCronConcurrencyPolicy = "Allow"
ProcessCronConcurrencyPolicy_Forbid ProcessCronConcurrencyPolicy = "Forbid"
ProcessCronConcurrencyPolicy_Replace ProcessCronConcurrencyPolicy = "Replace"
)
type ProcessPortMap struct { type ProcessPortMap struct {
ContainerPort int32 `yaml:"container_port"` ContainerPort int32 `yaml:"container_port"`
HostPort int32 `yaml:"host_port"` HostPort int32 `yaml:"host_port"`
@@ -26,7 +26,7 @@ metadata:
name: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }} name: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
namespace: {{ $.Values.global.namespace }} namespace: {{ $.Values.global.namespace }}
spec: spec:
concurrencyPolicy: Allow concurrencyPolicy: {{ $config.cron.concurrency_policy }}
failedJobsHistoryLimit: 10 failedJobsHistoryLimit: 10
jobTemplate: jobTemplate:
metadata: metadata:
+6 -4
View File
@@ -699,14 +699,16 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
return fmt.Errorf("Error getting process labels: %w", err) return fmt.Errorf("Error getting process labels: %w", err)
} }
concurrencyPolicy := strings.ToUpper(cronTask.ConcurrencyPolicy)
processValues := ProcessValues{ processValues := ProcessValues{
Args: words, Args: words,
Annotations: annotations, Annotations: annotations,
Cron: ProcessCron{ Cron: ProcessCron{
ID: cronTask.ID, ID: cronTask.ID,
Schedule: cronTask.Schedule, Schedule: cronTask.Schedule,
Suffix: suffix, Suffix: suffix,
Suspend: cronTask.Maintenance, Suspend: cronTask.Maintenance,
ConcurrencyPolicy: ProcessCronConcurrencyPolicy(concurrencyPolicy),
}, },
Labels: labels, Labels: labels,
ProcessType: ProcessType_Cron, ProcessType: ProcessType_Cron,