Skip to content

Commit

Permalink
Adjust container count for lack of system container
Browse files Browse the repository at this point in the history
  • Loading branch information
triarius committed Mar 14, 2024
1 parent ad9a597 commit 44c8310
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/controller/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ func (w *jobWrapper) Build(skipCheckout bool) (*batchv1.Job, error) {
volumeMounts := []corev1.VolumeMount{{Name: "workspace", MountPath: "/workspace"}}
volumeMounts = append(volumeMounts, w.k8sPlugin.ExtraVolumeMounts...)

const systemContainers = 1
systemContainerCount := 0
if !skipCheckout {
systemContainerCount = 1
}

ttl := int32(w.cfg.JobTTL.Seconds())
kjob.Spec.TTLSecondsAfterFinished = &ttl

Expand Down Expand Up @@ -261,7 +265,7 @@ func (w *jobWrapper) Build(skipCheckout bool) (*batchv1.Job, error) {
},
corev1.EnvVar{
Name: "BUILDKITE_CONTAINER_ID",
Value: strconv.Itoa(i + systemContainers),
Value: strconv.Itoa(i + systemContainerCount),
},
corev1.EnvVar{
Name: "BUILDKITE_PLUGINS_PATH",
Expand Down Expand Up @@ -294,7 +298,7 @@ func (w *jobWrapper) Build(skipCheckout bool) (*batchv1.Job, error) {
podSpec.Containers[i] = c
}

containerCount := len(podSpec.Containers) + systemContainers
containerCount := len(podSpec.Containers) + systemContainerCount

for i, c := range w.k8sPlugin.Sidecars {
if c.Name == "" {
Expand Down

0 comments on commit 44c8310

Please sign in to comment.