Replace all deprecated cli, daprd options and k8s annotations (#737)

This commit is contained in:
Pruthvidhar R Dhodda 2020-08-20 09:59:45 -07:00 committed by GitHub
parent 93837dc2c5
commit 643cb41fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 65 additions and 65 deletions

View File

@ -28,8 +28,8 @@ spec:
app: node
annotations:
<b>dapr.io/enabled: "true"</b>
<b>dapr.io/id: "nodeapp"</b>
<b>dapr.io/port: "3000"</b>
<b>dapr.io/app-id: "nodeapp"</b>
<b>dapr.io/app-port: "3000"</b>
spec:
containers:
- name: node
@ -152,13 +152,13 @@ Look at the Dapr API reference [here](../../reference/api/README.md) and make su
### I don't see any incoming events or calls from other services
Have you specified the port your app is listening on?
In Kubernetes, make sure the `dapr.io/port` annotation is specified:
In Kubernetes, make sure the `dapr.io/app-port` annotation is specified:
<pre>
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodeapp"
<b>dapr.io/port: "3000"</b>
dapr.io/app-id: "nodeapp"
<b>dapr.io/app-port: "3000"</b>
</pre>
If using Dapr Standalone and the Dapr CLI, make sure you pass the `--app-port` flag to the `dapr run` command.

View File

@ -16,8 +16,8 @@ To enable profiling in Kubernetes, simply add the following annotation to your D
<pre>
annotations:
dapr.io/enabled: "true"
dapr.io/id: "rust-app"
<b>dapr.io/profiling: "true"</b>
dapr.io/app-id: "rust-app"
<b>dapr.io/enable-profiling: "true"</b>
</pre>
### Standalone

View File

@ -32,8 +32,8 @@ A Dapr sidecar can apply a specific configuration by using a ```dapr.io/config``
```yml
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodeapp"
dapr.io/port: "3000"
dapr.io/app-id: "nodeapp"
dapr.io/app-port: "3000"
dapr.io/config: "myappconfig"
```
Note: There are more [Kubernetes annotations](../../howto/configure-k8s/README.md) available to configure the Dapr sidecar on activation by sidecar Injector system service.

View File

@ -32,8 +32,8 @@ Deploying and running a Dapr enabled application into your Kubernetes cluster is
```yml
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodeapp"
dapr.io/port: "3000"
dapr.io/app-id: "nodeapp"
dapr.io/app-port: "3000"
dapr.io/config: "tracing"
```
You can see some examples [here](https://github.com/dapr/quickstarts/tree/master/hello-kubernetes/deploy) in the Kubernetes getting started sample.

View File

@ -73,7 +73,7 @@ spec:
app: python
annotations:
dapr.io/enabled: "true"
dapr.io/id: "pythonapp"
dapr.io/app-id: "pythonapp"
dapr.io/log-as-json: "true"
...
```

View File

@ -19,7 +19,7 @@ The burden of dealing with concepts like consumer groups and multiple instances
### App ID
Dapr has the concept of an `id`. This is specified in Kubernetes using the `dapr.io/id` annotation and with the `app-id` flag using the Dapr CLI. Dapr requires an ID to be assigned to every application.
Dapr has the concept of an `id`. This is specified in Kubernetes using the `dapr.io/app-id` annotation and with the `app-id` flag using the Dapr CLI. Dapr requires an ID to be assigned to every application.
When multiple instances of the same application ID subscribe to a topic, Dapr will make sure to deliver the message to only one instance. If two different applications with different IDs subscribe to a topic, at least one instance in each application receives a copy of the same message.

View File

@ -8,14 +8,14 @@ The following table shows all the supported pod Spec annotations supported by Da
| Annotation | Description
| ----------------------------------- | -------------- |
| `dapr.io/enabled` | Setting this paramater to `true` injects the Dapr sidecar into the pod
| `dapr.io/port` | This parameter tells Dapr which port your application is listening on
| `dapr.io/id` | The unique ID of the application. Used for service discovery, state encapsulation and the pub/sub consumer ID
| `dapr.io/app-port` | This parameter tells Dapr which port your application is listening on
| `dapr.io/app-id` | The unique ID of the application. Used for service discovery, state encapsulation and the pub/sub consumer ID
| `dapr.io/log-level` | Sets the log level for the Dapr sidecar. Allowed values are `debug`, `info`, `warn`, `error`. Default is `info`
| `dapr.io/config` | Tells Dapr which Configuration CRD to use
| `dapr.io/log-as-json` | Setting this parameter to `true` outputs logs in JSON format. Default is `false`
| `dapr.io/profiling` | Setting this paramater to `true` starts the Dapr profiling server on port `7777`. Default is `false`
| `dapr.io/protocol` | Tells Dapr which protocol your application is using. Valid options are `http` and `grpc`. Default is `http`
| `dapr.io/max-concurrency` | Limit the concurrency of your application. A valid value is any number larger than `0`
| `dapr.io/enable-profiling` | Setting this paramater to `true` starts the Dapr profiling server on port `7777`. Default is `false`
| `dapr.io/app-protocol` | Tells Dapr which protocol your application is using. Valid options are `http` and `grpc`. Default is `http`
| `dapr.io/app-max-concurrency` | Limit the concurrency of your application. A valid value is any number larger than `0`
| `dapr.io/metrics-port` | Sets the port for the sidecar metrics server. Default is `9090`
| `dapr.io/sidecar-cpu-limit` | Maximum amount of CPU that the Dapr sidecar can use. See valid values [here](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/). By default this is not set
| `dapr.io/sidecar-memory-limit` | Maximum amount of Memory that the Dapr sidecar can use. See valid values [here](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/). By default this is not set

View File

@ -5,14 +5,14 @@ Using Dapr, you can control how many requests and events will invoke your applic
*Note that this rate limiting is guaranteed for every event that's coming from Dapr, meaning Pub/Sub events, direct invocation from other services, bindings events etc. Dapr can't enforce the concurrency policy on requests that are coming to your app externally.*
## Setting max-concurrency
## Setting app-max-concurrency
Without using Dapr, a developer would need to create some sort of a semaphore in the application and take care of acquiring and releasing it.
Using Dapr, there are no code changes needed to an app.
### Setting max-concurrency in Kubernetes
### Setting app-max-concurrency in Kubernetes
To set max-concurrency in Kubernetes, add the following annotation to your pod:
To set app-max-concurrency in Kubernetes, add the following annotation to your pod:
```yaml
apiVersion: apps/v1
@ -33,18 +33,18 @@ spec:
app: nodesubscriber
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodesubscriber"
dapr.io/port: "3000"
<b>dapr.io/max-concurrency: "1"</b>
dapr.io/app-id: "nodesubscriber"
dapr.io/app-port: "3000"
<b>dapr.io/app-max-concurrency: "1"</b>
...
```
### Setting max-concurrency using the Dapr CLI
### Setting app-max-concurrency using the Dapr CLI
To set max-concurrency with the Dapr CLI for running on your local dev machine, add the `max-concurrency` flag:
To set app-max-concurrency with the Dapr CLI for running on your local dev machine, add the `app-max-concurrency` flag:
```bash
dapr run --max-concurrency 1 --app-port 5000 python ./app.py
dapr run --app-max-concurrency 1 --app-port 5000 python ./app.py
```
The above examples will effectively turn your app into a single concurrent service.

View File

@ -35,9 +35,9 @@ spec:
app: myapp
annotations:
dapr.io/enabled: "true"
dapr.io/id: "myapp"
dapr.io/protocol: "grpc"
dapr.io/port: "5005"
dapr.io/app-id: "myapp"
dapr.io/app-protocol: "grpc"
dapr.io/app-port: "5005"
...
```
@ -45,10 +45,10 @@ This tells Dapr to communicate with your app via gRPC over port `5005`.
### Standalone
When running in standalone mode, use the `--protocol` flag to tell Dapr to use gRPC to talk to the app:
When running in standalone mode, use the `--app-protocol` flag to tell Dapr to use gRPC to talk to the app:
```bash
dapr run --protocol grpc --app-port 5005 -- node app.js
dapr run --app-protocol grpc --app-port 5005 node app.js
```
## Invoking Dapr - Go example
@ -213,10 +213,10 @@ This creates a gRPC server for your app on port 4000.
To run locally, use the Dapr CLI:
```
dapr run --app-id goapp --app-port 4000 --protocol grpc -- go run main.go
dapr run --app-id goapp --app-port 4000 --app-protocol grpc go run main.go
```
On Kubernetes, set the required `dapr.io/protocol: "grpc"` and `dapr.io/port: "4000` annotations in your pod spec template as mentioned above.
On Kubernetes, set the required `dapr.io/app-protocol: "grpc"` and `dapr.io/app-port: "4000` annotations in your pod spec template as mentioned above.
## Other languages

View File

@ -149,8 +149,8 @@ spec:
...
annotations:
dapr.io/enabled: "true"
dapr.io/id: "calculator-front-end"
dapr.io/port: "8080"
dapr.io/app-id: "calculator-front-end"
dapr.io/app-port: "8080"
dapr.io/config: "tracing"
```

View File

@ -3,7 +3,7 @@
When developing Dapr applications, you typically use the Dapr CLI to start your 'Daprized' service similar to this:
```bash
dapr run --app-id nodeapp --app-port 3000 --port 3500 app.js
dapr run --app-id nodeapp --app-port 3000 --dapr-http-port 3500 app.js
```
This uses the default components yaml files (created on `dapr init`) so that your service can interact with the local Redis container. This is great when you are just getting started but what if you want to attach a debugger to your service and step through the code? This is where you can use the dapr cli without invoking an app.
@ -27,10 +27,10 @@ Create or edit the file in `$HOME/.IdeaIC2019.3/config/tools/External\ Tools.xml
<!-- 1. Each tool has its own app-id, so create one per application to be debugged -->
<tool name="dapr for DemoService in examples" description="Dapr sidecar" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="true" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
<!-- 2. For Linux or MacOS use: /usr/bin/dapr -->
<option name="COMMAND" value="c:\dapr\dapr.exe" />
<!-- 3. Choose app, http and grpc ports that do not conflict with other Dapr command entries. -->
<option name="PARAMETERS" value="run --app-id demoservice --app-port 3000 --dapr-http-port 3005 --dapr-grpc-port 52000" />
<!-- 2. For Linux or MacOS use: /usr/local/bin/daprd -->
<option name="COMMAND" value="C:\dapr\daprd.exe" />
<!-- 3. Choose app, http and grpc ports that do not conflict with other daprd command entries (placement address should not change). -->
<option name="PARAMETERS" value="-app-id demoservice -app-port 3000 -dapr-http-port 3005 -dapr-grpc-port 52000 -placement-host-address localhost:50005" />
<!-- 4. Use the folder where the `components` folder is located -->
<option name="WORKING_DIRECTORY" value="C:/Code/dapr/java-sdk/examples" />
</exec>

View File

@ -26,7 +26,7 @@ dapr run --app-id cart --app-port 5000 python app.py
### Setup an ID using Kubernetes
In Kubernetes, set the `dapr.io/id` annotation on your pod:
In Kubernetes, set the `dapr.io/app-id` annotation on your pod:
```yaml
apiVersion: apps/v1
@ -47,8 +47,8 @@ spec:
app: python-app
annotations:
dapr.io/enabled: "true"
dapr.io/id: "cart"
dapr.io/port: "5000"
dapr.io/app-id: "cart"
dapr.io/app-port: "5000"
...
```

View File

@ -112,7 +112,7 @@ services:
"./daprd",
"-app-id", "nodeapp",
"-app-port", "3000",
"-placement-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
"-placement-host-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
]
volumes:
- "./components/:/components" # Mount our components folder for the runtime to use

View File

@ -88,7 +88,7 @@ spec:
app: python
annotations:
dapr.io/enabled: "true"
dapr.io/id: "pythonapp"
dapr.io/app-id: "pythonapp"
dapr.io/log-as-json: "true"
prometheus.io/scrape: "true"
prometheus.io/port: "9090"

View File

@ -129,7 +129,7 @@ spec:
app: python
annotations:
dapr.io/enabled: "true"
dapr.io/id: "pythonapp"
dapr.io/app-id: "pythonapp"
dapr.io/log-as-json: "true"
...
```

View File

@ -35,7 +35,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
## Create consumer groups for each subscriber
For every Dapr app that wants to subscribe to events, create an Event Hubs consumer group with the name of the `dapr id`.
For example, a Dapr app running on Kubernetes with `dapr.io/id: "myapp"` will need an Event Hubs consumer group named `myapp`.
For example, a Dapr app running on Kubernetes with `dapr.io/app-id: "myapp"` will need an Event Hubs consumer group named `myapp`.
## Apply the configuration

View File

@ -228,8 +228,8 @@ In Kubernetes mode, you store the certificate for the service principal into the
aadpodidbinding: [you managed identity selector]
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodeapp"
dapr.io/port: "3000"
dapr.io/app-id: "nodeapp"
dapr.io/app-port: "3000"
spec:
containers:
- name: node

View File

@ -165,7 +165,7 @@ You can check that `secretstores.azure.keyvault` component is loaded and redis s
Here is the log when you run [HelloWorld sample](https://github.com/dapr/quickstarts/tree/master/hello-world) with Azure Key Vault secret store.
```bash
$ dapr run --app-id mynode --app-port 3000 --port 3500 node app.js
$ dapr run --app-id mynode --app-port 3000 --dapr-http-port 3500 node app.js
Starting Dapr with id mynode on port 3500
✅ You're up and running! Both Dapr and your app logs will appear here.

View File

@ -100,7 +100,7 @@ You can check that `secretstores.local.localsecretstore` component is loaded and
Here is the log when you run [HelloWorld sample](https://github.com/dapr/quickstarts/tree/master/hello-world) with Local Secret secret store.
```bash
$ dapr run --app-id mynode --app-port 3000 --port 3500 node app.js
$ dapr run --app-id mynode --app-port 3000 --dapr-http-port 3500 node app.js
Starting Dapr with id mynode on port 3500
✅ You're up and running! Both Dapr and your app logs will appear here.

View File

@ -74,7 +74,7 @@ spec:
metadata:
annotations:
dapr.io/enabled: "true"
dapr.io/id: "testapp"
dapr.io/app-id: "testapp"
labels:
app: test-dapr-app
spec:

View File

@ -15,7 +15,7 @@ If instead of using the Dapr VS Code extension you wish to configure a project t
When developing Dapr applications, you typically use the dapr cli to start your daprized service similar to this:
```bash
dapr run --app-id nodeapp --app-port 3000 --port 3500 app.js
dapr run --app-id nodeapp --app-port 3000 --dapr-http-port 3500 app.js
```
This will generate the components yaml files (if they don't exist) so that your service can interact with the local redis container. This is great when you are just getting started but what if you want to attach a debugger to your service and step through the code? This is where you can use the dapr runtime (daprd) to help facilitate this.
@ -80,7 +80,7 @@ Let's take a quick look at the args that are being passed to the daprd command.
* -app-port -- the port number that your application code is listening on
* -dapr-http-port -- the http port for the dapr api
* -dapr-grpc-port -- the grpc port for the dapr api
* -placement-address -- the location of the placement service (this should be running in docker as it was created when you installed dapr and ran ```dapr init```)
* -placement-host-address -- the location of the placement service (this should be running in docker as it was created when you installed dapr and ran ```dapr init```)
>Note: You will need to ensure that you specify different http/grpc (-dapr-http-port and -dapr-grpc-port) ports for each daprd task that you create, otherwise you will run into port conflicts when you attempt to launch the second configuration.
@ -112,7 +112,7 @@ Let's take a quick look at the args that are being passed to the daprd command.
"51000",
"-dapr-grpc-port",
"52000",
"-placement-address",
"-placement-host-address",
"localhost:50005"
],
"isBackground": true,
@ -143,7 +143,7 @@ Let's take a quick look at the args that are being passed to the daprd command.
"51001",
"-dapr-grpc-port",
"52001",
"-placement-address",
"-placement-host-address",
"localhost:50005"
],
"isBackground": true,

View File

@ -99,7 +99,7 @@ ngrok http -host-header=localhost 9000
```bash
# Using default ports for .NET core web api and Dapr as an example
dapr run --app-id dotnetwebapi --app-port 5000 --port 3500 dotnet run
dapr run --app-id dotnetwebapi --app-port 5000 --dapr-http-port 3500 dotnet run
```
### Testing from Kubernetes cluster
@ -112,8 +112,8 @@ To get started, first create `dapr-annotations.yaml` for Dapr annotations
controller:
podAnnotations:
dapr.io/enabled: "true"
dapr.io/id: "nginx-ingress"
dapr.io/port: "80"
dapr.io/app-id: "nginx-ingress"
dapr.io/app-port: "80"
```
Then install NGINX ingress controller to your Kubernetes cluster with Helm 3 using the annotations
@ -194,8 +194,8 @@ spec:
app: dotnetwebapi
annotations:
dapr.io/enabled: "true"
dapr.io/id: "dotnetwebapi"
dapr.io/port: "5000"
dapr.io/app-id: "dotnetwebapi"
dapr.io/app-port: "5000"
spec:
containers:
- name: webapi

View File

@ -12,7 +12,7 @@ In self hosting mode, running `dapr init` copies the Dapr runtime onto your mach
What happens when `dapr run` is executed?
```bash
dapr run --app-id nodeapp --app-port 3000 --port 3500 node app.js
dapr run --app-id nodeapp --app-port 3000 --dapr-http-port 3500 node app.js
```
First, the Dapr CLI loads the components from the default directory (specified above) for the state store and pub/sub: `statestore.yaml` and `pubsub.yaml`, respectively. [Code](https://github.com/dapr/cli/blob/51b99a988c4d1545fdc04909d6308be121a7fe0c/pkg/standalone/run.go#L196-L266).
@ -27,7 +27,7 @@ Then, the Dapr CLI [launches](https://github.com/dapr/cli/blob/d585612185a4a525c
If you inspect the command line of the Dapr runtime and the app, observe that the Dapr runtime has these args:
```bash
daprd.exe --app-id mynode --dapr-http-port 3500 --dapr-grpc-port 43693 --log-level info --max-concurrency -1 --protocol http --app-port 3000 --placement-address localhost:50005
daprd.exe --app-id mynode --dapr-http-port 3500 --dapr-grpc-port 43693 --log-level info --app-max-concurrency -1 --app-protocol http --app-port 3000 --placement-host-address localhost:50005
```
And the app has these args, which are not modified from what was passed in via the CLI:
@ -41,7 +41,7 @@ node app.js
The daprd process is started with the args above. `--app-id`, "nodeapp", which is the Dapr app id, is forwarded from the Dapr CLI into `daprd` as the `--app-id` arg. Similarly:
- the `--app-port` from the CLI, which represents the port on the app that `daprd` will use to communicate with it has been passed into the `--app-port` arg.
- the `--port` arg from the CLI, which represents the http port that daprd is listening on is passed into the `--dapr-http-port` arg. (Note to specify grpc instead you can use `--grpc-port`). If it's not specified, it will be -1 which means the Dapr CLI will chose a random free port. Below, it's 43693, yours will vary.
- the `--dapr-http-port` arg from the CLI, which represents the http port that daprd is listening on is passed into the `--dapr-http-port` arg. (Note to specify grpc instead you can use `--dapr-grpc-port`). If it's not specified, it will be -1 which means the Dapr CLI will chose a random free port. Below, it's 43693, yours will vary.
### The app