Skip to content

Commit

Permalink
chore: inject zero resource limit for account jobs (#5867)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshanying authored Nov 20, 2023
1 parent 9ac4b98 commit 286eb56
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions controllers/apps/systemaccount_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1"
"github.com/apecloud/kubeblocks/pkg/constant"
componetutil "github.com/apecloud/kubeblocks/pkg/controller/component"
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

Expand Down Expand Up @@ -139,6 +140,17 @@ func renderJob(jobName string, engine *customizedEngine, key componentUniqueKey,
envs = append(envs, engine.getEnvs()...)
}

jobContainer := corev1.Container{
Name: jobName,
Image: engine.getImage(),
ImagePullPolicy: corev1.PullIfNotPresent,
Command: engine.getCommand(),
Args: engine.getArgs(),
Env: envs,
}

intctrlutil.InjectZeroResourcesLimitsIfEmpty(&jobContainer)

job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Namespace: key.namespace,
Expand All @@ -151,16 +163,7 @@ func renderJob(jobName string, engine *customizedEngine, key componentUniqueKey,
Name: jobName},
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyNever,
Containers: []corev1.Container{
{
Name: jobName,
Image: engine.getImage(),
ImagePullPolicy: corev1.PullIfNotPresent,
Command: engine.getCommand(),
Args: engine.getArgs(),
Env: envs,
},
},
Containers: []corev1.Container{jobContainer},
},
},
},
Expand Down

0 comments on commit 286eb56

Please sign in to comment.