Skip to content

Commit

Permalink
Merge pull request #4140 from hhunter-ms/issue_3039
Browse files Browse the repository at this point in the history
[State stores] Add `actorStateStore` metadata to applicable specs
  • Loading branch information
hhunter-ms authored May 9, 2024
2 parents b9025f6 + 06ff779 commit e2ea14d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
value: <REPLACE-WITH-DATABASE>
- name: collection
value: <REPLACE-WITH-COLLECTION>
# Uncomment this if you wish to use Azure Cosmos DB as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand All @@ -49,7 +52,7 @@ If you wish to use Cosmos DB as an actor store, append the following to the yam
| masterKey | Y* | The key to authenticate to the Cosmos DB account. Only required when not using Microsoft Entra ID authentication. | `"key"`
| database | Y | The name of the database | `"db"`
| collection | Y | The name of the collection (container) | `"collection"`
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`
### Microsoft Entra ID authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ spec:
value: "expiresAt" # Optional
- name: partitionKey
value: "ContractID" # Optional
# Uncomment this if you wish to use AWS DynamoDB as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand All @@ -58,6 +61,7 @@ In order to use DynamoDB as a Dapr state store, the table must have a primary ke
| sessionToken | N |AWS session token to use. A session token is only required if you are using temporary security credentials. | `"TOKEN"`
| ttlAttributeName | N |The table attribute name which should be used for TTL. | `"expiresAt"`
| partitionKey | N |The table primary key or partition key attribute name. This field is used to replace the default primary key attribute name `"key"`. See the section [Partition Keys]({{< ref "setup-dynamodb.md#partition-keys" >}}). | `"ContractID"`
| actorStateStore | N | Consider this state store for actors. Defaults to "false" | `"true"`, `"false"`

{{% alert title="Important" color="warning" %}}
When running the Dapr sidecar (daprd) with your application on EKS (AWS Kubernetes), if you're using a node/pod that has already been attached to an IAM policy defining access to AWS resources, you **must not** provide AWS access-key, secret-key, and tokens in the definition of the component spec you're using.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
value: <CERT> # Optional. Required if tlsEnable is `true`.
- name: key
value: <KEY> # Optional. Required if tlsEnable is `true`.
# Uncomment this if you wish to use Etcd as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand All @@ -59,6 +62,7 @@ If you are using `v1`, you should continue to use `v1` until you create a new Et
| `ca` | N | CA certificate for connecting to Etcd, PEM-encoded. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN CERTIFICATE-----\nMIIC9TCCA..."`
| `cert` | N | TLS certificate for connecting to Etcd, PEM-encoded. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN CERTIFICATE-----\nMIIDUTCC..."`
| `key` | N | TLS key for connecting to Etcd, PEM-encoded. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN PRIVATE KEY-----\nMIIEpAIB..."`
| `actorStateStore` | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`

## Setup Etcd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ metadata:
spec:
type: state.in-memory
version: v1
metadata: []
metadata:
# Uncomment this if you wish to use In-memory as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

> Note: While in-memory does not require any specific metadata for the component to work, `spec.metadata` is a required field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
value: <REPLACE-WITH-OPERATION-TIMEOUT> # Optional. default: "5s"
- name: params
value: <REPLACE-WITH-ADDITIONAL-PARAMETERS> # Optional. Example: "?authSource=daprStore&ssl=true"
# Uncomment this if you wish to use MongoDB as a state store for actors (optional)
#- name: actorStateStore
# value: "true"

```

{{% alert title="Warning" color="warning" %}}
Expand Down Expand Up @@ -72,6 +76,7 @@ If you wish to use MongoDB as an actor store, add this metadata option to your C
| readConcern | N | The read concern to use | `"majority"`, `"local"`,`"available"`, `"linearizable"`, `"snapshot"`
| operationTimeout | N | The timeout for the operation. Defaults to `"5s"` | `"5s"`
| params | N<sup>2</sup> | Additional parameters to use | `"?authSource=daprStore&ssl=true"`
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`

> <sup>[1]</sup> The `server` and `host` fields are mutually exclusive. If neither or both are set, Dapr returns an error.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
value: "<PEM PATH>"
- name: pemContents # Required if pemPath not provided. Pem value.
value: "<PEM CONTENTS>"
# Uncomment this if you wish to use MySQL & MariaDB as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand All @@ -59,6 +62,7 @@ If you wish to use MySQL as an actor store, append the following to the yaml.
| `pemPath` | N | Full path to the PEM file to use for [enforced SSL Connection](#enforced-ssl-connection) required if pemContents is not provided. Cannot be used in K8s environment | `"/path/to/file.pem"`, `"C:\path\to\file.pem"` |
| `pemContents` | N | Contents of PEM file to use for [enforced SSL Connection](#enforced-ssl-connection) required if pemPath is not provided. Can be used in K8s environment | `"pem value"` |
| `cleanupIntervalInSeconds` | N | Interval, in seconds, to clean up rows with an expired TTL. Default: `3600` (that is 1 hour). Setting this to values <=0 disables the periodic cleanup. | `1800`, `-1`
| `actorStateStore` | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`

## Setup MySQL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
value: "<FULL PATH TO DIRECTORY WITH ORACLE WALLET CONTENTS >" # Optional, no default
- name: tableName
value: "<NAME OF DATABASE TABLE TO STORE STATE IN >" # Optional, defaults to STATE
# Uncomment this if you wish to use Oracle Database as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```
{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
Expand All @@ -40,6 +43,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
| connectionString | Y | The connection string for Oracle Database | `"oracle://user/password@host:port/servicename"` for example `"oracle://demo:demo@localhost:1521/xe"` or for Autonomous Database `"oracle://states_schema:[email protected]:1522/k8j2agsqjsw_daprdb_low.adb.oraclecloud.com"`
| oracleWalletLocation | N | Location of the contents of an Oracle Wallet file (required to connect to Autonomous Database on OCI)| `"/home/app/state/Wallet_daprDB/"`
| tableName | N | Name of the database table in which this instance of the state store records the data default `"STATE"`| `"MY_APP_STATE_STORE"`
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`

## What Happens at Runtime?
When the state store component initializes, it connects to the Oracle Database and checks if a table with the name specified with `tableName` exists. If it does not, it creates this table (with columns Key, Value, Binary_YN, ETag, Creation_Time, Update_Time, Expiration_time).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spec:
value: <int> # Optional
- name: queryIndexes
value: <string> # Optional
# Uncomment this if you wish to use Redis as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand Down Expand Up @@ -119,6 +122,7 @@ If you wish to use Redis as an actor store, append the following to the yaml.
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`
| ttlInSeconds | N | Allows specifying a default Time-to-live (TTL) in seconds that will be applied to every state store request unless TTL is explicitly defined via the [request metadata]({{< ref "state-store-ttl.md" >}}). | `600`
| queryIndexes | N | Indexing schemas for querying JSON objects | see [Querying JSON objects](#querying-json-objects)
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`

## Setup Redis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ spec:
value: ""
- name: cleanupIntervalInSeconds
value: "3600"
# Uncomment this if you wish to use Microsoft SQL Server as a state store for actors (optional)
#- name: actorStateStore
# value: "true"
```

{{% alert title="Warning" color="warning" %}}
Expand Down

0 comments on commit e2ea14d

Please sign in to comment.