diff --git a/pkg/standalone/standalone.go b/pkg/standalone/standalone.go index b7300eea3..344a70352 100644 --- a/pkg/standalone/standalone.go +++ b/pkg/standalone/standalone.go @@ -90,7 +90,8 @@ const ( schedulerMetricPort = 59091 schedulerEtcdPort = 52379 - daprVersionsWithScheduler = ">= 1.14.x" + daprVersionsWithScheduler = ">= 1.14.x" + schedulerVersionWithHostOverride = ">= 1.15.0-rc.6" ) var ( @@ -184,6 +185,22 @@ func isSchedulerIncluded(runtimeVersion string) (bool, error) { return c.Check(&vNoPrerelease), nil } +func isSchedulerHostOverrideSupported(runtimeVersion string) (bool, error) { + if runtimeVersion == "edge" || runtimeVersion == "dev" { + return true, nil + } + c, err := semver.NewConstraint(schedulerVersionWithHostOverride) + if err != nil { + return false, err + } + + v, err := semver.NewVersion(runtimeVersion) + if err != nil { + return false, err + } + return c.Check(v), nil +} + // Init installs Dapr on a local machine using the supplied runtimeVersion. func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMode bool, imageRegistryURL string, fromDir string, containerRuntime string, imageVariant string, daprInstallPath string, schedulerVolume *string) error { var err error @@ -683,6 +700,13 @@ func runSchedulerService(wg *sync.WaitGroup, errorChan chan<- error, info initIn args = append(args, image, "--etcd-data-dir=/var/lock/dapr/scheduler") } + hostOverrideSupported, err := isSchedulerHostOverrideSupported(info.runtimeVersion) + if err != nil { + errorChan <- err + } else if hostOverrideSupported { + args = append(args, "--override-broadcast-host", "localhost") + } + _, err = utils.RunCmdAndWait(runtimeCmd, args...) if err != nil { runError := isContainerRunError(err)