Skip to content

Commit

Permalink
Merge pull request #39 from bernerhat/fix-bz-2247748
Browse files Browse the repository at this point in the history
Bug 2247748: A storage-client CronJob create too many jobs and pods causing maxPod limit to be reached
  • Loading branch information
nb-ohad authored Nov 20, 2023
2 parents 1969a71 + 7fb2735 commit 3a8f949
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions controllers/storageclient_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,24 @@ func (s *StorageClientReconciler) reconcileClientStatusReporterJob(instance *v1a
cronJob.Namespace = s.OperatorNamespace
addLabel(cronJob, storageClientNameLabel, instance.Name)
addLabel(cronJob, storageClientNamespaceLabel, instance.Namespace)
var podDeadLineSeconds int64 = 120
jobDeadLineSeconds := podDeadLineSeconds + 35
var keepJobResourceSeconds int32 = 600
var reducedKeptSuccecsful int32 = 1


_, err := controllerutil.CreateOrUpdate(s.ctx, s.Client, cronJob, func() error {
cronJob.Spec = batchv1.CronJobSpec{
Schedule: "* * * * *",
ConcurrencyPolicy: batchv1.ForbidConcurrent,
SuccessfulJobsHistoryLimit: &reducedKeptSuccecsful,
JobTemplate: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
ActiveDeadlineSeconds: &jobDeadLineSeconds,
TTLSecondsAfterFinished: &keepJobResourceSeconds,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
ActiveDeadlineSeconds: &podDeadLineSeconds,
Containers: []corev1.Container{
{
Name: "heartbeat",
Expand Down

0 comments on commit 3a8f949

Please sign in to comment.