Update the local volume name to be unique and more descriptive
This commit is contained in:
parent
41ac2992cb
commit
fbdf837f8c
1 changed files with 14 additions and 12 deletions
|
@ -10,7 +10,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -106,22 +106,24 @@ func (s *kubeScheduler) Schedule(ctx context.Context, stage *core.Stage) error {
|
||||||
name := fmt.Sprintf("drone-job-%d-%s", stage.ID, rand)
|
name := fmt.Sprintf("drone-job-%d-%s", stage.ID, rand)
|
||||||
|
|
||||||
var mounts []v1.VolumeMount
|
var mounts []v1.VolumeMount
|
||||||
mount := v1.VolumeMount{
|
mount := v1.VolumeMount{
|
||||||
Name: "local",
|
Name: name + "-local",
|
||||||
MountPath: filepath.Join("/tmp", "drone"),
|
MountPath: filepath.Join("/tmp", "drone"),
|
||||||
}
|
}
|
||||||
mounts = append(mounts, mount)
|
mounts = append(mounts, mount)
|
||||||
|
|
||||||
var volumes []v1.Volume
|
var volumes []v1.Volume
|
||||||
source := v1.HostPathDirectoryOrCreate
|
source := v1.HostPathDirectoryOrCreate
|
||||||
volume := v1.Volume{
|
volume := v1.Volume{
|
||||||
Name: "local",
|
Name: name + "-local",
|
||||||
|
VolumeSource: v1.VolumeSource{
|
||||||
|
HostPath: &v1.HostPathVolumeSource{
|
||||||
|
Path: filepath.Join("/tmp", "drone"),
|
||||||
|
Type: &source,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
volume.HostPath = &v1.HostPathVolumeSource{
|
volumes = append(volumes, volume)
|
||||||
Path: filepath.Join("/tmp", "drone"),
|
|
||||||
Type: &source,
|
|
||||||
}
|
|
||||||
volumes = append(volumes, volume)
|
|
||||||
|
|
||||||
job := &batchv1.Job{
|
job := &batchv1.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
|
Loading…
Reference in a new issue