Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Docker client dependency from standalone run #1443

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 12 additions & 21 deletions pkg/standalone/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
package standalone

import (
"context"
"fmt"
"net"
"os"
Expand All @@ -24,8 +23,6 @@ import (
"strconv"
"strings"

dockerClient "github.com/docker/docker/client"

"github.com/Pallinder/sillyname-go"
"github.com/phayes/freeport"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -141,27 +138,21 @@ func (config *RunConfig) validatePlacementHostAddr() error {
}

func (config *RunConfig) validateSchedulerHostAddr() error {
// If the scheduler isn't running - don't add the flag to the runtime cmd.
docker, err := dockerClient.NewClientWithOpts()
if err != nil {
return err
schedulerHostAddr := config.SchedulerHostAddress
if len(schedulerHostAddr) == 0 {
return nil
}
_, err = docker.ContainerInspect(context.Background(), "dapr_scheduler")
if err == nil {
schedulerHostAddr := config.SchedulerHostAddress
if len(schedulerHostAddr) == 0 {
schedulerHostAddr = "localhost"
}
if indx := strings.Index(schedulerHostAddr, ":"); indx == -1 {
if runtime.GOOS == daprWindowsOS {
schedulerHostAddr = fmt.Sprintf("%s:6060", schedulerHostAddr)
} else {
schedulerHostAddr = fmt.Sprintf("%s:50006", schedulerHostAddr)
}

if indx := strings.Index(schedulerHostAddr, ":"); indx == -1 {
if runtime.GOOS == daprWindowsOS {
schedulerHostAddr = fmt.Sprintf("%s:6060", schedulerHostAddr)
} else {
schedulerHostAddr = fmt.Sprintf("%s:50006", schedulerHostAddr)
}
config.SchedulerHostAddress = schedulerHostAddr
return nil
}

config.SchedulerHostAddress = schedulerHostAddr

return nil
}

Expand Down
Loading