runservice: pass arch to driver
k8s driver: use the provided arch and set the related nodeselector label (`kubernetes.io/arch`) when not empty.
This commit is contained in:
parent
6f88bd3d53
commit
8989bd0e8e
|
@ -75,6 +75,7 @@ type PodConfig struct {
|
|||
ID string
|
||||
TaskID string
|
||||
Containers []*ContainerConfig
|
||||
Arch common.Arch
|
||||
// The container dir where the init volume will be mounted
|
||||
InitVolumeDir string
|
||||
DockerConfig *registry.DockerConfig
|
||||
|
|
|
@ -362,6 +362,12 @@ func (d *K8sDriver) NewPod(ctx context.Context, podConfig *PodConfig, out io.Wri
|
|||
},
|
||||
}
|
||||
|
||||
if podConfig.Arch != "" {
|
||||
pod.Spec.NodeSelector = map[string]string{
|
||||
corev1.LabelArchStable: string(podConfig.Arch),
|
||||
}
|
||||
}
|
||||
|
||||
pod, err = podClient.Create(pod)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -835,6 +835,7 @@ func (e *Executor) setupTask(ctx context.Context, rt *runningTask) error {
|
|||
// tasks failed to start and don't clash with existing pods)
|
||||
ID: uuid.NewV4().String(),
|
||||
TaskID: et.ID,
|
||||
Arch: et.Arch,
|
||||
InitVolumeDir: toolboxContainerDir,
|
||||
DockerConfig: dockerConfig,
|
||||
Containers: []*driver.ContainerConfig{
|
||||
|
|
|
@ -329,6 +329,7 @@ func (s *Scheduler) genExecutorTask(ctx context.Context, r *types.Run, rt *types
|
|||
ID: rt.ID,
|
||||
RunID: r.ID,
|
||||
TaskName: rct.Name,
|
||||
Arch: rct.Runtime.Arch,
|
||||
Containers: rct.Runtime.Containers,
|
||||
Environment: environment,
|
||||
WorkingDir: rct.WorkingDir,
|
||||
|
|
|
@ -502,6 +502,7 @@ type ExecutorTask struct {
|
|||
ID string `json:"id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
TaskName string `json:"task_name,omitempty"`
|
||||
Arch common.Arch `json:"arch,omitempty"`
|
||||
Containers []*Container `json:"containers,omitempty"`
|
||||
Environment map[string]string `json:"environment,omitempty"`
|
||||
WorkingDir string `json:"working_dir,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue