Skip to content

Commit

Permalink
try to fix e2e (dapr#34)
Browse files Browse the repository at this point in the history
* try to fix e2e

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* rm test changes since env var now

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

---------

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
  • Loading branch information
cicoyle committed May 29, 2024
1 parent 627914b commit 1dce5b9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
8 changes: 8 additions & 0 deletions cmd/daprd/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"math"
"os"
"strconv"
"strings"
"time"

"github.com/spf13/pflag"
Expand Down Expand Up @@ -250,6 +251,13 @@ func New(origArgs []string) (*Options, error) {
opts.DaprBlockShutdownDuration = nil
}

if !fs.Changed("scheduler-host-address") {
addr, ok := os.LookupEnv(consts.SchedulerHostAddressEnvVar)
if ok {
opts.SchedulerAddress = strings.Split(addr, ",")
}
}

return &opts, nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/injector/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
ComponentsUDSVolumeName = "dapr-components-unix-domain-socket" // Name of the Unix domain socket volume for components.
ComponentsUDSMountPathEnvVar = "DAPR_COMPONENT_SOCKETS_FOLDER"
ComponentsUDSDefaultFolder = "/tmp/dapr-components-sockets"
SchedulerHostAddressEnvVar = "DAPR_SCHEDULER_HOST_ADDRESS"

ModeKubernetes = modes.KubernetesMode // KubernetesMode is a Kubernetes Dapr mode.
ModeStandalone = modes.StandaloneMode // StandaloneMode is a Standalone Dapr mode.
Expand Down
16 changes: 11 additions & 5 deletions pkg/injector/patcher/sidecar_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ func (c *SidecarConfig) getSidecarContainer(opts getSidecarContainerOpts) (*core
args = append(args, "--reminders-service", c.RemindersService)
}

// Scheduler address could be empty if scheduler service is disabled
if c.SchedulerAddress != "" {
args = append(args, "--scheduler-host-address", c.SchedulerAddress)
}

// --enable-api-logging is set if and only if there's an explicit value (true or false) for that
// This is set explicitly even if "false"
// This is because if this CLI flag is missing, the default specified in the Config CRD is used
Expand Down Expand Up @@ -271,6 +266,17 @@ func (c *SidecarConfig) getSidecarContainer(opts getSidecarContainerOpts) (*core
},
)
}

// Scheduler address could be empty if scheduler service is disabled
if c.SchedulerAddress != "" {
env = append(env,
corev1.EnvVar{
Name: injectorConsts.SchedulerHostAddressEnvVar,
Value: c.SchedulerAddress,
},
)
}

container := &corev1.Container{
Name: injectorConsts.SidecarContainerName,
Image: c.SidecarImage,
Expand Down
3 changes: 3 additions & 0 deletions pkg/security/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ const (

// ControlPlaneDefaultTrustAnchorsPath is the default path where the trust anchors are placed for control plane services.
ControlPlaneDefaultTrustAnchorsPath = "/var/run/secrets/dapr.io/tls/ca.crt"

// SchedulerAddressEnvVar is the env var for the scheduler addresses
SchedulerHostAddressEnvVar = "DAPR_SCHEDULER_HOST_ADDRESS"
)

0 comments on commit 1dce5b9

Please sign in to comment.