Skip to content

Commit bcf9be9

Browse files
authored
Merge pull request #282101 from ryanwinterms/release-aio-july-updates
Dapr component updates
2 parents 4a53539 + 3f6c495 commit bcf9be9

File tree

3 files changed

+55
-64
lines changed

3 files changed

+55
-64
lines changed

articles/iot-operations/create-edge-apps/howto-deploy-dapr.md

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ ms.date: 07/02/2024
1515

1616
The Distributed Application Runtime (Dapr) is a portable, serverless, event-driven runtime that simplifies the process of building distributed applications. Dapr lets you build stateful or stateless apps without worrying about how the building blocks function. Dapr provides several [building blocks](https://docs.dapr.io/developing-applications/building-blocks/): pub/sub, state management, service invocation, actors, and more.
1717

18-
MQTT broker supports two of these building blocks, powered by [MQTT broker](../manage-mqtt-broker/overview-iot-mq.md):
18+
Azure IoT Operations supports two of these building blocks, powered by [MQTT broker](../manage-mqtt-broker/overview-iot-mq.md):
1919

2020
- Publish and subscribe
2121
- State management
2222

23-
To use the MQTT broker Dapr pluggable components, define the component spec for each of the APIs and then [register this to the cluster](https://docs.dapr.io/operations/components/pluggable-components-registration/). The Dapr components listen to a Unix domain socket placed on the shared volume. The Dapr runtime connects with each socket and discovers all services from a given building block API that the component implements.
23+
To use the Dapr pluggable components, define the component spec for each of the APIs and then [register this to the cluster](https://docs.dapr.io/operations/components/pluggable-components-registration/). The Dapr components listen to a Unix domain socket placed on the shared volume. The Dapr runtime connects with each socket and discovers all services from a given building block API that the component implements.
2424

2525
## Install Dapr runtime
2626

@@ -37,94 +37,75 @@ helm upgrade --install dapr dapr/dapr --version=1.13 --namespace dapr-system --c
3737

3838
## Register MQTT broker pluggable components
3939

40-
To register MQTT broker's pluggable pub/sub and state management components, create the component manifest yaml, and apply it to your cluster.
40+
To register the pub/sub and state management pluggable components, create the component manifest yaml, and apply it to your cluster.
4141

4242
To create the yaml file, use the following component definitions:
4343

4444
> [!div class="mx-tdBreakAll"]
4545
> | Component | Description |
4646
> |-|-|
4747
> | `metadata.name` | The component name is important and is how a Dapr application references the component. |
48-
> | `metadata.annotations` | Component annotations used by the Dapr sidecar injector
49-
> | `spec.type` | [The type of the component](https://docs.dapr.io/operations/components/pluggable-components-registration/#define-the-component), which must be declared exactly as shown. It tells Dapr what kind of component (`pubsub` or `state`) it is and which Unix socket to use. |
50-
> | `spec.metadata.url` | The URL tells the component where the local MQTT broker endpoint is. Defaults to `8883` is MQTT broker's default MQTT port with TLS enabled. |
51-
> | `spec.metadata.satTokenPath` | The Service Account Token is used to authenticate the Dapr components with the MQTT broker |
52-
> | `spec.metadata.tlsEnabled` | Define if TLS is used by the MQTT broker. Defaults to `true` |
53-
> | `spec.metadata.caCertPath` | The certificate chain path for validating the broker, required if `tlsEnabled` is `true` |
54-
> | `spec.metadata.logLevel` | The logging level of the component. 'Debug', 'Info', 'Warn' and 'Error' |
48+
> | `metadata.annotations` | Component annotations used by Dapr sidecar injector, defining the image location and required volume mounts
49+
> | `spec.type` | [The type of the component](https://docs.dapr.io/operations/components/pluggable-components-registration/#define-the-component), which needs to be declared exactly as shown |
50+
> | `spec.metadata.keyPrefix` | Defines the key prefix used when communicating to the statestore backend. See the [Dapr documentation](https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state) for more information |
51+
> | `spec.metadata.hostname` | The MQTT broker hostname. Defaults to `aio-mq-dmqtt-frontend` |
52+
> | `spec.metadata.tcpPort` | The MQTT broker port number. Default is `8883` |
53+
> | `spec.metadata.useTls` | Define if TLS is used by the MQTT broker. Defaults to `true` |
54+
> | `spec.metadata.caFile` | The certificate chain path for validating the MQTT broker. Required if `useTls` is `true`. This file must be mounted in the pod with the specified volume name |
55+
> | `spec.metadata.satAuthFile ` | The Service Account Token (SAT) file is used to authenticate the Dapr components with the MQTT broker. This file must be mounted in the pod with the specified volume name |
5556
56-
1. Save the following yaml, which contains the component definitions, to a file named `components.yaml`:
57+
1. Save the following yaml, which contains the Azure IoT Operations component definitions, to a file named `components.yaml`:
5758

5859
```yml
59-
# Pub/sub component
6060
apiVersion: dapr.io/v1alpha1
6161
kind: Component
6262
metadata:
63-
name: aio-mq-pubsub
63+
name: iotoperations-pubsub
6464
namespace: azure-iot-operations
6565
annotations:
6666
dapr.io/component-container: >
6767
{
68-
"name": "aio-mq-components",
69-
"image": "ghcr.io/azure/iot-mq-dapr-components:latest",
68+
"name": "iot-operations-dapr-components",
69+
"image": "ghcr.io/azure/iot-operations-dapr-components:latest",
7070
"volumeMounts": [
71-
{
72-
"name": "mqtt-client-token",
73-
"mountPath": "/var/run/secrets/tokens"
74-
},
75-
{
76-
"name": "aio-ca-trust-bundle",
77-
"mountPath": "/var/run/certs/aio-mq-ca-cert"
78-
}
71+
{ "name": "mqtt-client-token", "mountPath": "/var/run/secrets/tokens" },
72+
{ "name": "aio-ca-trust-bundle", "mountPath": "/var/run/certs/aio-mq-ca-cert" }
7973
]
8074
}
8175
spec:
82-
type: pubsub.aio-mq-pubsub-pluggable # DO NOT CHANGE
76+
type: pubsub.azure.iotoperations
8377
version: v1
8478
metadata:
85-
- name: url
86-
value: "aio-mq-dmqtt-frontend:8883"
87-
- name: satTokenPath
88-
value: "/var/run/secrets/tokens/mqtt-client-token"
89-
- name: tlsEnabled
79+
- name: hostname
80+
value: aio-mq-dmqtt-frontend
81+
- name: tcpPort
82+
value: 8883
83+
- name: useTls
9084
value: true
91-
- name: caCertPath
92-
value: "/var/run/certs/aio-mq-ca-cert/ca.crt"
85+
- name: caFile
86+
value: /var/run/certs/aio-mq-ca-cert/ca.crt
87+
- name: satAuthFile
88+
value: /var/run/secrets/tokens/mqtt-client-token
9389
---
94-
# State Management component
9590
apiVersion: dapr.io/v1alpha1
9691
kind: Component
9792
metadata:
98-
name: aio-mq-statestore
93+
name: iotoperations-statestore
9994
namespace: azure-iot-operations
100-
annotations:
101-
dapr.io/component-container: >
102-
{
103-
"name": "aio-mq-components",
104-
"image": "ghcr.io/azure/iot-mq-dapr-components:latest",
105-
"volumeMounts": [
106-
{
107-
"name": "mqtt-client-token",
108-
"mountPath": "/var/run/secrets/tokens"
109-
},
110-
{
111-
"name": "aio-ca-trust-bundle",
112-
"mountPath": "/var/run/certs/aio-mq-ca-cert"
113-
}
114-
]
115-
}
11695
spec:
117-
type: state.aio-mq-statestore-pluggable # DO NOT CHANGE
96+
type: state.azure.iotoperations
11897
version: v1
11998
metadata:
120-
- name: url
121-
value: "aio-mq-dmqtt-frontend:8883"
122-
- name: satTokenPath
123-
value: "/var/run/secrets/tokens/mqtt-client-token"
124-
- name: tlsEnabled
99+
- name: hostname
100+
value: aio-mq-dmqtt-frontend
101+
- name: tcpPort
102+
value: 8883
103+
- name: useTls
125104
value: true
126-
- name: caCertPath
127-
value: "/var/run/certs/aio-mq-ca-cert/ca.crt"
105+
- name: caFile
106+
value: /var/run/certs/aio-mq-ca-cert/ca.crt
107+
- name: satAuthFile
108+
value: /var/run/secrets/tokens/mqtt-client-token
128109
```
129110
130111
1. Apply the component yaml to your cluster by running the following command:
@@ -136,8 +117,8 @@ To create the yaml file, use the following component definitions:
136117
Verify the following output:
137118

138119
```output
139-
component.dapr.io/aio-mq-pubsub created
140-
component.dapr.io/aio-mq-statestore created
120+
component.dapr.io/iotoperations-pubsub created
121+
component.dapr.io/iotoperations-statestore created
141122
```
142123

143124
## Create authorization policy for MQTT broker

articles/iot-operations/create-edge-apps/howto-develop-dapr-apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ To create the yaml file, use the following definitions:
9797
serviceAccountName: dapr-client
9898
9999
volumes:
100-
# SAT token used to authenticate between Dapr and the MQTT broker
100+
# SAT used to authenticate between Dapr and the MQTT broker
101101
- name: mqtt-client-token
102102
projected:
103103
sources:

articles/iot-operations/create-edge-apps/tutorial-event-driven-with-dapr.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ To start, create a yaml file that uses the following definitions:
6161
name: mq-event-driven-dapr
6262
namespace: azure-iot-operations
6363
spec:
64-
replicas: 1
6564
selector:
6665
matchLabels:
6766
app: mq-event-driven-dapr
@@ -118,11 +117,16 @@ To start, create a yaml file that uses the following definitions:
118117
mq-event-driven-dapr 3/3 Running 0 30s
119118
```
120119

121-
122120
## Deploy the simulator
123121

124122
Simulate test data by deploying a Kubernetes workload. It simulates a sensor by sending sample temperature, vibration, and pressure readings periodically to the MQTT broker using an MQTT client on the `sensor/data` topic.
125123

124+
1. Patch BrokerListener to allow unauthenticated connection, to simplify injection of simulated data:
125+
126+
```bash
127+
kubectl patch BrokerListener listener -n azure-iot-operations --type=json -p='[{ "op": "add", "path": "/spec/ports/1", "value": {"port":1883} }]'
128+
```
129+
126130
1. Deploy the simulator from the Explore IoT Operations repository:
127131

128132
```bash
@@ -159,6 +163,12 @@ To verify the MQTT bridge is working, deploy an MQTT client to the cluster.
159163

160164
```yaml
161165
apiVersion: v1
166+
kind: ServiceAccount
167+
metadata:
168+
name: mqtt-client
169+
namespace: azure-iot-operations
170+
---
171+
apiVersion: v1
162172
kind: Pod
163173
metadata:
164174
name: mqtt-client
@@ -188,7 +198,7 @@ To verify the MQTT bridge is working, deploy an MQTT client to the cluster.
188198
name: aio-ca-trust-bundle-test-only
189199
```
190200

191-
1. Apply the deployment file with kubectl.
201+
1. Apply the deployment file with kubectl:
192202

193203
```bash
194204
kubectl apply -f client.yaml
@@ -211,7 +221,7 @@ To verify the MQTT bridge is working, deploy an MQTT client to the cluster.
211221
1. Subscribe to the `sensor/window_data` topic to observe the published output from the Dapr application:
212222

213223
```bash
214-
mosquitto_sub -L mqtts://aio-mq-dmqtt-frontend/sensor/window_data -u 'K8S-SAT' -P $(cat /var/run/secrets/tokens/mqtt-client-token) --cafile /var/run/certs/aio-mq-ca-cert/ca.crt
224+
mosquitto_sub -L mqtt://aio-mq-dmqtt-frontend/sensor/window_data
215225
```
216226

217227
1. Verify the application is outputting a sliding windows calculation for the various sensors every 10 seconds:

0 commit comments

Comments
 (0)