Skip to content

Commit 239a39e

Browse files
authored
fix get docker host panic when dind replica is 0 (#4308)
Signed-off-by: Patrick Zhao <zhaoyu@koderover.com>
1 parent 1f523ee commit 239a39e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller

pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ func (c *FreestyleJobCtl) run(ctx context.Context) error {
150150

151151
// decide which docker host to use.
152152
// TODO: do not use code in warpdrive moudule, should move to a public place
153-
dockerhosts := dockerhost.NewDockerHosts(hubServerAddr, c.logger)
154-
c.jobTaskSpec.Properties.DockerHost = dockerhosts.GetBestHost(dockerhost.ClusterID(c.jobTaskSpec.Properties.ClusterID), fmt.Sprintf("%v", c.workflowCtx.TaskID))
153+
if !c.jobTaskSpec.Properties.UseHostDockerDaemon {
154+
dockerhosts := dockerhost.NewDockerHosts(hubServerAddr, c.logger)
155+
c.jobTaskSpec.Properties.DockerHost = dockerhosts.GetBestHost(dockerhost.ClusterID(c.jobTaskSpec.Properties.ClusterID), fmt.Sprintf("%v", c.workflowCtx.TaskID))
156+
}
155157

156158
// not local cluster
157159
var (

0 commit comments

Comments
 (0)