namespace in all yaml samples

This commit is contained in:
Mark Chmarny 2020-04-30 10:07:14 -07:00
parent 5d2fc0470e
commit d08e5a829c
50 changed files with 134 additions and 54 deletions

View File

@ -9,7 +9,7 @@ First, check your Deployment or Pod YAML file, and check that you have the follo
Sample deployment:
<pre>
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
@ -36,7 +36,7 @@ spec:
ports:
- containerPort: 3000
imagePullPolicy: Always
</pre>
```
If your pod spec template is annotated correctly and you still don't see the sidecar injected, make sure Dapr was deployed to the cluster before your deployment or pod were deployed.

View File

@ -40,6 +40,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: oauth2
namespace: default
spec:
type: middleware.http.oauth2
metadata:
@ -68,6 +69,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: pipeline
namespace: default
spec:
httpPipeline:
handlers:

View File

@ -29,6 +29,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: kafkaevent
namespace: default
spec:
type: bindings.kafka
metadata:

View File

@ -17,7 +17,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: production
namespace: default
spec:
type: state.redis
metadata:
@ -65,7 +65,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: production
namespace: default
spec:
type: state.redis
metadata:

View File

@ -20,6 +20,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: default
namespace: default
spec:
mtls:
enabled: "true"
@ -169,6 +170,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: default
namespace: default
spec:
mtls:
enabled: "true"
@ -195,6 +197,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: default
namespace: default
spec:
mtls:
enabled: "true"

View File

@ -77,6 +77,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:
@ -95,6 +96,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -13,11 +13,12 @@ For this guide, we'll use Redis Streams, which is also installed by default on a
*Note: When running Dapr locally, a pub/sub component YAML will automatically be created if it doesn't exist in a directory called `components` in your current working directory.*
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -14,11 +14,12 @@ Using Dapr, there are no code changes needed to an app.
To set max-concurrency in Kubernetes, add the following annotation to your pod:
<pre>
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodesubscriber
namespace: default
labels:
app: nodesubscriber
spec:
@ -36,7 +37,7 @@ spec:
dapr.io/port: "3000"
<b>dapr.io/max-concurrency: "1"</b>
...
</pre>
```
### Setting max-concurrency using the Dapr CLI

View File

@ -16,11 +16,12 @@ To do that, the app simply needs to host a gRPC server and implement the [Dapr c
On Kubernetes, set the following annotations in your deployment YAML:
<pre>
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
namespace: default
labels:
app: myapp
spec:
@ -38,7 +39,7 @@ spec:
<b>dapr.io/protocol: "grpc"
dapr.io/port: "5005"</b>
...
</pre>
```
This tells Dapr to communicate with your app via gRPC over port `5005`.

View File

@ -47,6 +47,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: native
namespace: default
spec:
type: exporters.native
metadata:
@ -63,6 +64,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
samplingRate: "1"
@ -101,6 +103,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: native
namespace: default
spec:
type: exporters.native
metadata:
@ -117,6 +120,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
samplingRate: "1"

View File

@ -3,6 +3,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
enabled: true
@ -13,6 +14,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: native
namespace: default
spec:
type: exporters.native
metadata:

View File

@ -2,6 +2,7 @@ kind: Service
apiVersion: v1
metadata:
name: dapr-localforwarder
namespace: default
labels:
app: dapr-localforwarder
spec:
@ -17,6 +18,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: dapr-localforwarder
namespace: default
labels:
app: dapr-localforwarder
spec:

View File

@ -18,6 +18,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: zipkin
namespace: default
spec:
type: exporters.zipkin
metadata:
@ -34,6 +35,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
samplingRate: "1"
@ -82,6 +84,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: zipkin
namespace: default
spec:
type: exporters.zipkin
metadata:
@ -98,6 +101,7 @@ apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
samplingRate: "1"

View File

@ -28,11 +28,12 @@ dapr run --app-id cart --app-port 5000 python app.py
In Kubernetes, set the `dapr.io/id` annotation on your pod:
<pre>
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: python-app
namespace: default
labels:
app: python-app
spec:
@ -49,7 +50,7 @@ spec:
<b>dapr.io/id: "cart"</b>
dapr.io/port: "5000"
...
</pre>
```
## Invoke a service in code

View File

@ -13,11 +13,12 @@ For this guide, we'll use Redis Streams, which is also installed by default on a
*Note: When running Dapr locally, a pub/sub component YAML will automatically be created if it doesn't exist in a directory called `components` in your current working directory.*
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -31,11 +31,12 @@ Install Redis (master and slave) on `namespace-a`, following [these instructions
Now, configure `deploy/redis.yaml`, paying attention to the hostname containing `namespace-a`.
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -28,6 +28,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:
@ -71,6 +72,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:
@ -94,6 +96,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -13,11 +13,12 @@ Create the following YAML file, named binding.yaml, and save this to the /compon
*Note: When running in Kubernetes, apply this file to your cluster using `kubectl apply -f binding.yaml`*
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: myEvent
namespace: default
spec:
type: bindings.kafka
metadata:

View File

@ -27,6 +27,7 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fluentd
namespace: default
roleRef:
kind: ClusterRole
name: fluentd

View File

@ -74,6 +74,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: pythonapp
namespace: default
labels:
app: python
spec:

View File

@ -115,6 +115,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: pythonapp
namespace: default
labels:
app: python
spec:

View File

@ -7,11 +7,12 @@ Pub/Sub message buses are extensible and can be found in the [components-contrib
A pub/sub in Dapr is described using a `Component` file:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.<NAME>
metadata:

View File

@ -8,11 +8,12 @@ The next step is to create a Dapr component for Azure Service Bus.
Create the following YAML file named `azuresb.yaml`:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
namespace: <namespace>
spec:
type: pubsub.azure.servicebus
metadata:

View File

@ -8,11 +8,12 @@ The next step is to create a Dapr component for Google Cloud Pub/Sub
Create the following YAML file named `messagebus.yaml`:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <NAME>
namespace: <NAMESPACE>
spec:
type: pubsub.gcp.pubsub
metadata:

View File

@ -20,11 +20,12 @@ The next step is to create a Dapr component for Hazelcast.
Create the following YAML file named `hazelcast.yaml`:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: pubsub.hazelcast
metadata:

View File

@ -31,11 +31,12 @@ The next step is to create a Dapr component for NATS.
Create the following YAML file named `nats.yaml`:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: pubsub.nats
metadata:

View File

@ -33,11 +33,12 @@ The next step is to create a Dapr component for RabbitMQ.
Create the following YAML file named `rabbitmq.yaml`:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: pubsub.rabbitmq
metadata:

View File

@ -60,6 +60,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
namespace: default
spec:
type: pubsub.redis
metadata:

View File

@ -13,6 +13,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: awssecretmanager
namespace: default
spec:
type: secretstores.aws.secretmanager
metadata:
@ -44,6 +45,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:

View File

@ -106,6 +106,7 @@ In Kubernetes mode, you store the certificate for the service principal into the
kind: Component
metadata:
name: azurekeyvault
namespace: default
spec:
type: secretstores.azure.keyvault
metadata:
@ -138,6 +139,7 @@ In Kubernetes mode, you store the certificate for the service principal into the
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:
@ -163,6 +165,7 @@ In Kubernetes mode, you store the certificate for the service principal into the
apiVersion: v1
metadata:
name: nodeapp
namespace: default
labels:
app: node
spec:
@ -179,6 +182,7 @@ In Kubernetes mode, you store the certificate for the service principal into the
kind: Deployment
metadata:
name: nodeapp
namespace: default
labels:
app: node
spec:

View File

@ -115,6 +115,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: azurekeyvault
namespace: default
spec:
type: secretstores.azure.keyvault
metadata:
@ -143,6 +144,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:
@ -202,6 +204,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: azurekeyvault
namespace: default
spec:
type: secretstores.azure.keyvault
metadata:
@ -241,6 +244,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:

View File

@ -13,6 +13,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: gcpsecretmanager
namespace: default
spec:
type: secretstores.gcp.secretmanager
metadata:
@ -56,6 +57,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:

View File

@ -15,6 +15,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: vault
namespace: default
spec:
type: secretstores.hashicorp.vault
metadata:
@ -53,6 +54,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:

View File

@ -7,11 +7,12 @@ State stores are extensible and can be found in the [components-contrib repo](ht
A state store in Dapr is described using a `Component` file:
```yml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.<DATABASE>
metadata:

View File

@ -32,11 +32,12 @@ The next step is to create a Dapr component for Aerospike.
Create the following YAML file named `aerospike.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.Aerospike
metadata:

View File

@ -23,7 +23,8 @@ Create the following YAML file named `cosmos.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.azure.cosmosdb
metadata:
@ -41,11 +42,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
The following example uses the Kubernetes secret store to retrieve the secrets:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <store_name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.azure.cosmosdb
metadata:

View File

@ -22,7 +22,8 @@ Create the following YAML file named `azuretable.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.azure.tablestorage
metadata:
@ -38,11 +39,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
The following example uses the Kubernetes secret store to retrieve the secrets:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.azure.tablestorage
metadata:

View File

@ -36,7 +36,8 @@ Create the following YAML file named `cassandra.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.cassandra
metadata:
@ -62,11 +63,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
The following example uses the Kubernetes secret store to retrieve the username and password:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.cassandra
metadata:

View File

@ -26,6 +26,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: cloudstate
namespace: default
spec:
type: state.cloudstate
metadata:
@ -61,6 +62,7 @@ kind: Deployment
metadata:
annotations:
name: test-dapr-app
namespace: default
labels:
app: test-dapr-app
spec:
@ -125,6 +127,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cloudstate-pod-reader
namespace: default
rules:
- apiGroups:
- ""
@ -140,6 +143,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cloudstate-read-pods-default
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role

View File

@ -35,7 +35,8 @@ Create the following YAML file named `consul.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.consul
metadata:
@ -55,11 +56,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
The following example uses the Kubernetes secret store to retrieve the acl token:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.consul
metadata:

View File

@ -26,11 +26,12 @@ The next step is to create a Dapr component for Couchbase.
Create the following YAML file named `couchbase.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.couchbase
metadata:

View File

@ -32,11 +32,12 @@ The next step is to create a Dapr component for etcd.
Create the following YAML file named `etcd.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.etcd
metadata:

View File

@ -16,11 +16,12 @@ The next step is to create a Dapr component for Firestore.
Create the following YAML file named `firestore.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.gcp.firestore
metadata:

View File

@ -20,11 +20,12 @@ The next step is to create a Dapr component for Hazelcast.
Create the following YAML file named `hazelcast.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.hazelcast
metadata:

View File

@ -31,11 +31,12 @@ The next step is to create a Dapr component for Memcached.
Create the following YAML file named `memcached.yaml`:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.memcached
metadata:

View File

@ -39,7 +39,8 @@ Create the following YAML file named `mongodb.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.mongodb
metadata:
@ -65,11 +66,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
The following example uses the Kubernetes secret store to retrieve the username and password:
```
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.mondodb
metadata:

View File

@ -67,6 +67,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
namespace: default
spec:
type: state.redis
metadata:

View File

@ -23,7 +23,8 @@ Create the following YAML file named `sqlserver.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.sqlserver
metadata:
@ -41,7 +42,8 @@ The following example uses the Kubernetes secret store to retrieve the secrets:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.sqlserver
metadata:

View File

@ -36,7 +36,8 @@ Create the following YAML file named `zookeeper.yaml`:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
name: <NAME>
namespace: <NAMESPACE>
spec:
type: state.zookeeper
metadata:

View File

@ -29,6 +29,7 @@ apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: myEvent
namespace: default
spec:
type: bindings.kafka
metadata: