Commit 32e5996d authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #28447 from k82/k8s-26930-km-local-path

Automatic merge from submit-queue MESOS: Support a pre-installed km binary at a well known, agent-local path fixes #26930
parents 05cbaa99 b361f400
...@@ -344,7 +344,7 @@ func (s *SchedulerServer) AddStandaloneFlags(fs *pflag.FlagSet) { ...@@ -344,7 +344,7 @@ func (s *SchedulerServer) AddStandaloneFlags(fs *pflag.FlagSet) {
func (s *SchedulerServer) AddHyperkubeFlags(fs *pflag.FlagSet) { func (s *SchedulerServer) AddHyperkubeFlags(fs *pflag.FlagSet) {
s.addCoreFlags(fs) s.addCoreFlags(fs)
fs.StringVar(&s.kmPath, "km-path", s.kmPath, "Location of the km executable, may be a URI or an absolute file path.") fs.StringVar(&s.kmPath, "km-path", s.kmPath, "Location of the km executable, may be a URI or an absolute file path; may be prefixed with 'file://' to specify the path to a pre-installed, agent-local km binary.")
} }
// returns (downloadURI, basename(path)) // returns (downloadURI, basename(path))
...@@ -390,11 +390,16 @@ func (s *SchedulerServer) prepareExecutorInfo(hks hyperkube.Interface) (*mesos.E ...@@ -390,11 +390,16 @@ func (s *SchedulerServer) prepareExecutorInfo(hks hyperkube.Interface) (*mesos.E
return nil, fmt.Errorf("either run this scheduler via km or else --executor-path is required") return nil, fmt.Errorf("either run this scheduler via km or else --executor-path is required")
} else { } else {
if strings.Index(s.kmPath, "://") > 0 { if strings.Index(s.kmPath, "://") > 0 {
// URI could point directly to executable, e.g. hdfs:///km if strings.HasPrefix(s.kmPath, "file://") {
// or else indirectly, e.g. http://acmestorage/tarball.tgz // If `kmPath` started with "file://", `km` in agent local path was used.
// so we assume that for this case the command will always "km" ci.Value = proto.String(strings.TrimPrefix(s.kmPath, "file://"))
ci.Uris = append(ci.Uris, &mesos.CommandInfo_URI{Value: proto.String(s.kmPath), Executable: proto.Bool(true)}) } else {
ci.Value = proto.String("./km") // TODO(jdef) extract constant // URI could point directly to executable, e.g. hdfs:///km
// or else indirectly, e.g. http://acmestorage/tarball.tgz
// so we assume that for this case the command will always "km"
ci.Uris = append(ci.Uris, &mesos.CommandInfo_URI{Value: proto.String(s.kmPath), Executable: proto.Bool(true)})
ci.Value = proto.String("./km") // TODO(jdef) extract constant
}
} else if s.kmPath != "" { } else if s.kmPath != "" {
uri, kmCmd := s.serveFrameworkArtifact(s.kmPath) uri, kmCmd := s.serveFrameworkArtifact(s.kmPath)
ci.Uris = append(ci.Uris, &mesos.CommandInfo_URI{Value: proto.String(uri), Executable: proto.Bool(true)}) ci.Uris = append(ci.Uris, &mesos.CommandInfo_URI{Value: proto.String(uri), Executable: proto.Bool(true)})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment