Skip to content

Commit f4e92b1

Browse files
committed
add support for override-broadcast-host scheduler flag
Signed-off-by: Anton Troshin <anton@diagrid.io>
1 parent fd465d5 commit f4e92b1

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

pkg/standalone/standalone.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const (
9090
schedulerMetricPort = 59091
9191
schedulerEtcdPort = 52379
9292

93-
daprVersionsWithScheduler = ">= 1.14.x"
93+
daprVersionsWithScheduler = ">= 1.14.x"
94+
schedulerVersionWithHostOverride = ">= 1.15.0-rc.6"
9495
)
9596

9697
var (
@@ -184,6 +185,22 @@ func isSchedulerIncluded(runtimeVersion string) (bool, error) {
184185
return c.Check(&vNoPrerelease), nil
185186
}
186187

188+
func isSchedulerHostOverrideSupported(runtimeVersion string) (bool, error) {
189+
if runtimeVersion == "edge" || runtimeVersion == "dev" {
190+
return true, nil
191+
}
192+
c, err := semver.NewConstraint(schedulerVersionWithHostOverride)
193+
if err != nil {
194+
return false, err
195+
}
196+
197+
v, err := semver.NewVersion(runtimeVersion)
198+
if err != nil {
199+
return false, err
200+
}
201+
return c.Check(v), nil
202+
}
203+
187204
// Init installs Dapr on a local machine using the supplied runtimeVersion.
188205
func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMode bool, imageRegistryURL string, fromDir string, containerRuntime string, imageVariant string, daprInstallPath string, schedulerVolume *string) error {
189206
var err error
@@ -683,6 +700,13 @@ func runSchedulerService(wg *sync.WaitGroup, errorChan chan<- error, info initIn
683700
args = append(args, image, "--etcd-data-dir=/var/lock/dapr/scheduler")
684701
}
685702

703+
hostOverrideSupported, err := isSchedulerHostOverrideSupported(info.runtimeVersion)
704+
if err != nil {
705+
errorChan <- err
706+
} else if hostOverrideSupported {
707+
args = append(args, "--override-broadcast-host", "localhost")
708+
}
709+
686710
_, err = utils.RunCmdAndWait(runtimeCmd, args...)
687711
if err != nil {
688712
runError := isContainerRunError(err)

0 commit comments

Comments
 (0)