Skip to content

Commit fd1d8e8

Browse files
cicoyleartursouza
andauthored
Distributed Scheduler CLI Changes (#1405)
* wip Signed-off-by: Cassandra Coyle <[email protected]> * rm scheduleJob logic. keep only init/uninstall logic Signed-off-by: Cassandra Coyle <[email protected]> * Fixes install and uninstall of scheduler in standalone mode. Signed-off-by: Artur Souza <[email protected]> * Fixing path for Go tools in Darwin. Signed-off-by: Artur Souza <[email protected]> * Fix Go bin location for MacOS. Signed-off-by: Artur Souza <[email protected]> * Fix min scheduler version to be 1.14.x Signed-off-by: Artur Souza <[email protected]> * Use env var to pass scheduler host. Signed-off-by: Artur Souza <[email protected]> * Fix CLI build to work with latest MacOS runners from GH Signed-off-by: Artur Souza <[email protected]> --------- Signed-off-by: Cassandra Coyle <[email protected]> Signed-off-by: Artur Souza <[email protected]> Co-authored-by: Artur Souza <[email protected]>
1 parent 4881ca1 commit fd1d8e8

File tree

17 files changed

+279
-36
lines changed

17 files changed

+279
-36
lines changed

.github/workflows/dapr_cli.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
WIX_BIN_PATH: 'C:/Program Files (x86)/WiX Toolset v3.11/bin'
4040
strategy:
4141
matrix:
42-
os: [ubuntu-latest, windows-latest, macOS-latest]
42+
os: [ubuntu-latest, windows-latest, macOS-latest, macOS-latest-large]
4343
target_arch: [arm, arm64, amd64]
4444
include:
4545
- os: ubuntu-latest
@@ -48,14 +48,30 @@ jobs:
4848
target_os: windows
4949
- os: macOS-latest
5050
target_os: darwin
51+
- os: macOS-latest-large
52+
target_os: darwin
5153
exclude:
5254
- os: windows-latest
5355
target_arch: arm
5456
- os: windows-latest
5557
target_arch: arm64
5658
- os: macOS-latest
5759
target_arch: arm
60+
- os: macOS-latest
61+
target_arch: amd64
62+
- os: macOS-latest-large
63+
target_arch: arm
64+
- os: macOS-latest-large
65+
target_arch: arm64
5866
steps:
67+
- name: Prepare Go's bin location - MacOS
68+
if: matrix.target_os == 'darwin'
69+
run: |
70+
export PATH=$HOME/bin:$PATH
71+
echo "$HOME/bin" >> $GITHUB_PATH
72+
73+
echo "GOBIN=$HOME/bin" >> $GITHUB_ENV
74+
mkdir -p $HOME/bin
5975
- name: Check out code into the Go module directory
6076
uses: actions/checkout@v3
6177
- name: Set up Go

.github/workflows/self_hosted_e2e.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,29 @@ jobs:
4848
# TODO: Remove this when our E2E tests are stable for podman on MacOS.
4949
fail-fast: false # Keep running if one leg fails.
5050
matrix:
51-
os: [macos-latest, ubuntu-latest, windows-latest]
51+
# See https://github.com/actions/runner-images
52+
os: [macos-latest-large, ubuntu-latest, windows-latest]
5253
target_arch: [amd64]
5354
dapr_install_mode: [slim, complete]
5455
include:
5556
- os: ubuntu-latest
5657
target_os: linux
57-
- os: macOS-latest
58+
- os: macos-latest-large
5859
target_os: darwin
5960
- os: windows-latest
6061
target_os: windows
6162
exclude:
6263
- os: windows-latest
6364
dapr_install_mode: complete
6465
steps:
66+
- name: Prepare Go's bin location - MacOS
67+
if: matrix.os == 'macos-latest-large'
68+
run: |
69+
export PATH=$HOME/bin:$PATH
70+
echo "$HOME/bin" >> $GITHUB_PATH
71+
72+
echo "GOBIN=$HOME/bin" >> $GITHUB_ENV
73+
mkdir -p $HOME/bin
6574
- name: Check out code into the Go module directory
6675
uses: actions/checkout@v3
6776
- name: Set up Go
@@ -101,7 +110,7 @@ jobs:
101110
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
102111
- name: Install podman - MacOS
103112
timeout-minutes: 15
104-
if: matrix.os == 'macos-latest' && matrix.dapr_install_mode == 'complete'
113+
if: matrix.os == 'macos-latest-large' && matrix.dapr_install_mode == 'complete'
105114
run: |
106115
# Install podman
107116
curl -sL -o podman.pkg https://github.com/containers/podman/releases/download/v${{ env.PODMAN_VERSION }}/podman-installer-macos-amd64.pkg
@@ -149,7 +158,7 @@ jobs:
149158
echo "DAPR_DASHBOARD_LATEST_STABLE_VERSION=$LATEST_STABLE_DASHBOARD_VERSION" >> $GITHUB_ENV
150159
shell: bash
151160
- name: Set the test timeout - MacOS
152-
if: matrix.os == 'macos-latest'
161+
if: matrix.os == 'macos-latest-large'
153162
run: echo "E2E_SH_TEST_TIMEOUT=30m" >> $GITHUB_ENV
154163
- name: Run E2E tests with GHCR
155164
# runs every 6hrs

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*.dylib
77
cli
88

9+
# Handy directory to keep local scripts and help files.
10+
.local/
11+
912
# Mac's metadata folder
1013
.DS_Store
1114

@@ -37,4 +40,4 @@ go.work
3740
#Wix files
3841
*.wixobj
3942
*.wixpdb
40-
*.msi
43+
*.msi

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Before you file an issue, make sure you've checked the following:
4040
- 👎 down-vote
4141
1. For bugs
4242
- Check it's not an environment issue. For example, if running on Kubernetes, make sure prerequisites are in place. (state stores, bindings, etc.)
43-
- You have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Dapr services (runtime, operator, placement service). More details on how to get logs can be found [here](https://docs.dapr.io/operations/troubleshooting/logs-troubleshooting/).
43+
- You have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Dapr services (runtime, operator, placement, scheduler service). More details on how to get logs can be found [here](https://docs.dapr.io/operations/troubleshooting/logs-troubleshooting/).
4444
1. For proposals
4545
- Many changes to the Dapr runtime may require changes to the API. In that case, the best place to discuss the potential feature is the main [Dapr repo](https://github.com/dapr/dapr).
4646
- Other examples could include bindings, state stores or entirely new components.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ ifeq ($(LOCAL_OS),Linux)
5959
else ifeq ($(LOCAL_OS),Darwin)
6060
TARGET_OS_LOCAL = darwin
6161
GOLANGCI_LINT:=golangci-lint
62+
PATH := $(PATH):$(HOME)/go/bin/darwin_$(GOARCH)
6263
export ARCHIVE_EXT = .tar.gz
6364
else
6465
TARGET_OS_LOCAL ?= windows

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Install windows Dapr CLI using MSI package.
6868
6969
### Install Dapr on your local machine (self-hosted)
7070

71-
In self-hosted mode, dapr can be initialized using the CLI with the placement, redis and zipkin containers enabled by default(recommended) or without them which also does not require docker to be available in the environment.
71+
In self-hosted mode, dapr can be initialized using the CLI with the placement, scheduler, redis, and zipkin containers enabled by default(recommended) or without them which also does not require docker to be available in the environment.
7272

7373
#### Initialize Dapr
7474

@@ -89,6 +89,7 @@ Output should look like so:
8989
✅ Downloaded binaries and completed components set up.
9090
ℹ️ daprd binary has been installed to $HOME/.dapr/bin.
9191
ℹ️ dapr_placement container is running.
92+
ℹ️ dapr_scheduler container is running.
9293
ℹ️ dapr_redis container is running.
9394
ℹ️ dapr_zipkin container is running.
9495
ℹ️ Use `docker ps` to check running containers.
@@ -118,10 +119,11 @@ Output should look like so:
118119
✅ Downloaded binaries and completed components set up.
119120
ℹ️ daprd binary has been installed to $HOME/.dapr/bin.
120121
ℹ️ placement binary has been installed.
122+
ℹ️ scheduler binary has been installed.
121123
✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started
122124
```
123125

124-
>Note: When initializing Dapr with the `--slim` flag only the Dapr runtime binary and the placement service binary are installed. An empty default components folder is created with no default configuration files. During `dapr run` user should use `--resources-path` (`--components-path` is deprecated and will be removed in future releases) to point to a components directory with custom configurations files or alternatively place these files in the default directory. For Linux/MacOS, the default components directory path is `$HOME/.dapr/components` and for Windows it is `%USERPROFILE%\.dapr\components`.
126+
>Note: When initializing Dapr with the `--slim` flag only the Dapr runtime, placement, and scheduler service binaries are installed. An empty default components folder is created with no default configuration files. During `dapr run` user should use `--resources-path` (`--components-path` is deprecated and will be removed in future releases) to point to a components directory with custom configurations files or alternatively place these files in the default directory. For Linux/MacOS, the default components directory path is `$HOME/.dapr/components` and for Windows it is `%USERPROFILE%\.dapr\components`.
125127
126128
#### Install a specific runtime version
127129

@@ -171,7 +173,7 @@ Move to the bundle directory and run the following command:
171173
172174
> If you are not running the above command from the bundle directory, provide the full path to bundle directory as input. For example, assuming the bundle directory path is $HOME/daprbundle, run `$HOME/daprbundle/dapr init --from-dir $HOME/daprbundle` to have the same behavior.
173175
174-
> Note: Dapr Installer bundle just contains the placement container apart from the binaries and so `zipkin` and `redis` are not enabled by default. You can pull the images locally either from network or private registry and run as follows:
176+
> Note: Dapr Installer bundle just contains the placement and scheduler containers apart from the binaries and so `zipkin` and `redis` are not enabled by default. You can pull the images locally either from network or private registry and run as follows:
175177
176178
```bash
177179
docker run --name "dapr_zipkin" --restart always -d -p 9411:9411 openzipkin/zipkin
@@ -199,6 +201,9 @@ dapr init --network dapr-network
199201
> Note: When installed to a specific Docker network, you will need to add the `--placement-host-address` arguments to `dapr run` commands run in any containers within that network.
200202
> The format of `--placement-host-address` argument is either `<hostname>` or `<hostname>:<port>`. If the port is omitted, the default port `6050` for Windows and `50005` for Linux/MacOS applies.
201203
204+
> Note: When installed to a specific Docker network, you will need to add the `--scheduler-host-address` arguments to `dapr run` commands run in any containers within that network.
205+
> The format of `--scheduler-host-address` argument is either `<hostname>` or `<hostname>:<port>`. If the port is omitted, the default port `6060` for Windows and `50006` for Linux/MacOS applies.
206+
202207
#### Install with a specific container runtime
203208

204209
You can install the Dapr runtime using a specific container runtime
@@ -228,7 +233,7 @@ For more details, see the docs for dev containers with [Visual Studio Code](http
228233

229234
### Uninstall Dapr in a standalone mode
230235

231-
Uninstalling will remove daprd binary and the placement container (if installed with Docker or the placement binary if not).
236+
Uninstalling will remove daprd binary along with the placement and scheduler containers (if installed with Docker or the placement and scheduler binaries if not).
232237

233238

234239
```bash
@@ -237,15 +242,15 @@ dapr uninstall
237242

238243
> For Linux users, if you run your docker cmds with sudo, you need to use "**sudo dapr uninstall**" to remove the containers.
239244
240-
The command above won't remove the redis or zipkin containers by default in case you were using it for other purposes. It will also not remove the default dapr folder that was created on `dapr init`. To remove all the containers (placement, redis, zipkin) and also the default dapr folder created on init run:
245+
The command above won't remove the redis or zipkin containers by default in case you were using it for other purposes. It will also not remove the default dapr folder that was created on `dapr init`. To remove all the containers (placement, scheduler, redis, zipkin) and also the default dapr folder created on init run:
241246

242247
```bash
243248
dapr uninstall --all
244249
```
245250

246251
The above command can also be run when Dapr has been installed in a non-docker environment, it will only remove the installed binaries and the default dapr folder in that case.
247252

248-
> NB: The `dapr uninstall` command will always try to remove the placement binary/service and will throw an error is not able to.
253+
> NB: The `dapr uninstall` command will always try to remove the placement and scheduler binaries/services and will throw an error is not able to.
249254
250255
**You should always run a `dapr uninstall` before running another `dapr init`.**
251256

@@ -407,7 +412,7 @@ dapr init --network dapr-network
407412
dapr run --app-id nodeapp --placement-host-address dapr_placement node app.js
408413
```
409414

410-
> Note: When in a specific Docker network, the Redis, Zipkin and placement service containers are given specific network aliases, `dapr_redis`, `dapr_zipkin` and `dapr_placement`, respectively. The default configuration files reflect the network alias rather than `localhost` when a docker network is specified.
415+
> Note: When in a specific Docker network, the Redis, Zipkin and placement and scheduler service containers are given specific network aliases, `dapr_redis`, `dapr_zipkin`, `dapr_placement`, and `dapr_scheduler`, respectively. The default configuration files reflect the network alias rather than `localhost` when a docker network is specified.
411416
412417
### Use gRPC
413418

cmd/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func init() {
210210
InitCmd.Flags().BoolVarP(&devMode, "dev", "", false, "Use Dev mode. Deploy Redis, Zipkin also in the Kubernetes cluster")
211211
InitCmd.Flags().BoolVarP(&wait, "wait", "", false, "Wait for Kubernetes initialization to complete")
212212
InitCmd.Flags().UintVarP(&timeout, "timeout", "", 300, "The wait timeout for the Kubernetes installation")
213-
InitCmd.Flags().BoolVarP(&slimMode, "slim", "s", false, "Exclude placement service, Redis and Zipkin containers from self-hosted installation")
213+
InitCmd.Flags().BoolVarP(&slimMode, "slim", "s", false, "Exclude placement service, scheduler service, Redis and Zipkin containers from self-hosted installation")
214214
InitCmd.Flags().StringVarP(&runtimeVersion, "runtime-version", "", defaultRuntimeVersion, "The version of the Dapr runtime to install, for example: 1.0.0")
215215
InitCmd.Flags().StringVarP(&dashboardVersion, "dashboard-version", "", defaultDashboardVersion, "The version of the Dapr dashboard to install, for example: 0.13.0")
216216
InitCmd.Flags().StringVarP(&initNamespace, "namespace", "n", "dapr-system", "The Kubernetes namespace to install Dapr in")

cmd/run.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ dapr run --run-file /path/to/directory -k
120120
Args: cobra.MinimumNArgs(0),
121121
PreRun: func(cmd *cobra.Command, args []string) {
122122
viper.BindPFlag("placement-host-address", cmd.Flags().Lookup("placement-host-address"))
123+
viper.BindPFlag("scheduler-host-address", cmd.Flags().Lookup("scheduler-host-address"))
123124
},
124125
Run: func(cmd *cobra.Command, args []string) {
125126
if len(runFilePath) > 0 {
@@ -171,6 +172,7 @@ dapr run --run-file /path/to/directory -k
171172
MaxConcurrency: maxConcurrency,
172173
AppProtocol: protocol,
173174
PlacementHostAddr: viper.GetString("placement-host-address"),
175+
SchedulerHostAddr: viper.GetString("scheduler-host-address"),
174176
ComponentsPath: componentsPath,
175177
ResourcesPaths: resourcesPaths,
176178
AppSSL: appSSL,
@@ -454,6 +456,7 @@ func init() {
454456
// By marking this as deprecated, the flag will be hidden from the help menu, but will continue to work. It will show a warning message when used.
455457
RunCmd.Flags().MarkDeprecated("components-path", "This flag is deprecated and will be removed in the future releases. Use \"resources-path\" flag instead")
456458
RunCmd.Flags().String("placement-host-address", "localhost", "The address of the placement service. Format is either <hostname> for default port or <hostname>:<port> for custom port")
459+
RunCmd.Flags().String("scheduler-host-address", "localhost", "The address of the scheduler service. Format is either <hostname> for default port or <hostname>:<port> for custom port")
457460
// TODO: Remove below flag once the flag is removed in runtime in future release.
458461
RunCmd.Flags().BoolVar(&appSSL, "app-ssl", false, "Enable https when Dapr invokes the application")
459462
RunCmd.Flags().MarkDeprecated("app-ssl", "This flag is deprecated and will be removed in the future releases. Use \"app-protocol\" flag with https or grpcs values instead")

cmd/uninstall.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var UninstallCmd = &cobra.Command{
4343
# Uninstall from self-hosted mode
4444
dapr uninstall
4545
46-
# Uninstall from self-hosted mode and remove .dapr directory, Redis, Placement and Zipkin containers
46+
# Uninstall from self-hosted mode and remove .dapr directory, Redis, Placement, Scheduler, and Zipkin containers
4747
dapr uninstall --all
4848
4949
# Uninstall from Kubernetes
@@ -99,7 +99,7 @@ func init() {
9999
UninstallCmd.Flags().BoolVarP(&uninstallKubernetes, "kubernetes", "k", false, "Uninstall Dapr from a Kubernetes cluster")
100100
UninstallCmd.Flags().BoolVarP(&uninstallDev, "dev", "", false, "Uninstall Dapr Redis and Zipking installations from Kubernetes cluster")
101101
UninstallCmd.Flags().UintVarP(&timeout, "timeout", "", 300, "The timeout for the Kubernetes uninstall")
102-
UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove .dapr directory, Redis, Placement and Zipkin containers on local machine, and CRDs on a Kubernetes cluster")
102+
UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove .dapr directory, Redis, Placement, Scheduler, and Zipkin containers on local machine, and CRDs on a Kubernetes cluster")
103103
UninstallCmd.Flags().String("network", "", "The Docker network from which to remove the Dapr runtime")
104104
UninstallCmd.Flags().StringVarP(&uninstallNamespace, "namespace", "n", "dapr-system", "The Kubernetes namespace to uninstall Dapr from")
105105
UninstallCmd.Flags().BoolP("help", "h", false, "Print this help message")

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ require (
7979
github.com/BurntSushi/toml v1.2.1 // indirect
8080
github.com/MakeNowJust/heredoc v1.0.0 // indirect
8181
github.com/Masterminds/goutils v1.1.1 // indirect
82+
github.com/Masterminds/semver v1.5.0
8283
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
8384
github.com/Masterminds/squirrel v1.5.3 // indirect
8485
github.com/Microsoft/go-winio v0.6.0 // indirect

0 commit comments

Comments
 (0)