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
|
ID string
|
||||||
TaskID string
|
TaskID string
|
||||||
Containers []*ContainerConfig
|
Containers []*ContainerConfig
|
||||||
|
Arch common.Arch
|
||||||
// The container dir where the init volume will be mounted
|
// The container dir where the init volume will be mounted
|
||||||
InitVolumeDir string
|
InitVolumeDir string
|
||||||
DockerConfig *registry.DockerConfig
|
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)
|
pod, err = podClient.Create(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
// tasks failed to start and don't clash with existing pods)
|
||||||
ID: uuid.NewV4().String(),
|
ID: uuid.NewV4().String(),
|
||||||
TaskID: et.ID,
|
TaskID: et.ID,
|
||||||
|
Arch: et.Arch,
|
||||||
InitVolumeDir: toolboxContainerDir,
|
InitVolumeDir: toolboxContainerDir,
|
||||||
DockerConfig: dockerConfig,
|
DockerConfig: dockerConfig,
|
||||||
Containers: []*driver.ContainerConfig{
|
Containers: []*driver.ContainerConfig{
|
||||||
|
|
|
@ -329,6 +329,7 @@ func (s *Scheduler) genExecutorTask(ctx context.Context, r *types.Run, rt *types
|
||||||
ID: rt.ID,
|
ID: rt.ID,
|
||||||
RunID: r.ID,
|
RunID: r.ID,
|
||||||
TaskName: rct.Name,
|
TaskName: rct.Name,
|
||||||
|
Arch: rct.Runtime.Arch,
|
||||||
Containers: rct.Runtime.Containers,
|
Containers: rct.Runtime.Containers,
|
||||||
Environment: environment,
|
Environment: environment,
|
||||||
WorkingDir: rct.WorkingDir,
|
WorkingDir: rct.WorkingDir,
|
||||||
|
|
|
@ -502,6 +502,7 @@ type ExecutorTask struct {
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"`
|
||||||
RunID string `json:"run_id,omitempty"`
|
RunID string `json:"run_id,omitempty"`
|
||||||
TaskName string `json:"task_name,omitempty"`
|
TaskName string `json:"task_name,omitempty"`
|
||||||
|
Arch common.Arch `json:"arch,omitempty"`
|
||||||
Containers []*Container `json:"containers,omitempty"`
|
Containers []*Container `json:"containers,omitempty"`
|
||||||
Environment map[string]string `json:"environment,omitempty"`
|
Environment map[string]string `json:"environment,omitempty"`
|
||||||
WorkingDir string `json:"working_dir,omitempty"`
|
WorkingDir string `json:"working_dir,omitempty"`
|
||||||
|
|
Loading…
Reference in New Issue