Skip to content

Commit

Permalink
Enable TmpFS when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
koct9i authored and l0kix2 committed Apr 17, 2024
1 parent fe77418 commit 6dabb21
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
type=porto;
"start_uid"=19500;
};
"enable_tmpfs"=%true;
};
"gpu_manager"={
"gpu_info_source"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"use_job_proxy_from_image"=%false;
};
"do_not_set_user_id"=%true;
"enable_tmpfs"=%false;
};
"gpu_manager"={
"gpu_info_source"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
type=simple;
"start_uid"=19500;
};
"enable_tmpfs"=%false;
};
"gpu_manager"={
"gpu_info_source"={
Expand Down
2 changes: 1 addition & 1 deletion pkg/ytconfig/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ func (g *Generator) getControllerAgentConfigImpl(spec *ytv1.ControllerAgentsSpec
return ControllerAgentServer{}, err
}

c.ControllerAgent.EnableTmpfs = g.ytsaurus.Spec.UsePorto
c.ControllerAgent.EnableTmpfs = true
c.ControllerAgent.UseColumnarStatisticsDefault = true

g.fillCommonService(&c.CommonServer, &spec.InstanceSpec)
Expand Down
18 changes: 18 additions & 0 deletions pkg/ytconfig/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,29 @@ func fillJobEnvironment(execNode *ExecNode, spec *ytv1.ExecNodesSpec, commonSpec
// FIXME(khlebnikov): For now running jobs as non-root is more likely broken.
execNode.SlotManager.DoNotSetUserId = ptr.Bool(ptr.BoolDeref(envSpec.DoNotSetUserId, true))

// Enable tmpfs if exec node can mount and propagate into job container.
execNode.SlotManager.EnableTmpfs = ptr.Bool(func() bool {
if !spec.Privileged {
return false
}
if !ptr.BoolDeref(envSpec.Isolated, true) {
return true
}
for _, location := range ytv1.FindAllLocations(spec.Locations, ytv1.LocationTypeSlots) {
mount := findVolumeMountForPath(location.Path, spec.InstanceSpec)
if mount == nil || mount.MountPropagation == nil || *mount.MountPropagation != corev1.MountPropagationBidirectional {
return false
}
}
return true
}())
} else if commonSpec.UsePorto {
jobEnv.Type = JobEnvironmentTypePorto
execNode.SlotManager.EnableTmpfs = ptr.Bool(true)
// TODO(psushin): volume locations, root fs binds, etc.
} else {
jobEnv.Type = JobEnvironmentTypeSimple
execNode.SlotManager.EnableTmpfs = ptr.Bool(spec.Privileged)
}

return nil
Expand Down

0 comments on commit 6dabb21

Please sign in to comment.