Skip to content

Commit

Permalink
enhance topic space and permission binding for maestro server.
Browse files Browse the repository at this point in the history
Signed-off-by: morvencao <[email protected]>
  • Loading branch information
morvencao committed Jun 5, 2024
1 parent 003a6c8 commit 617cd28
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dev-infrastructure/docs/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ To setup broker access for a maestro consumer on a mgmt-cluster, set the `deploy

```sh
cd dev-infrastructure
AKSCONFIG=mgmt-cluster make mgmt-cluster
AKSCONFIG=mgmt-cluster make cluster
AKSCONFIG=mgmt-cluster make aks.kubeconfig
KUBECONFIG=mgmt-cluster.kubeconfig scripts/maestro-consumer.sh
```
Expand Down
37 changes: 25 additions & 12 deletions dev-infrastructure/modules/maestro/maestro-infra.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -153,34 +153,47 @@ resource maestroServerMqttClientGroup 'Microsoft.EventGrid/namespaces/clientGrou
}
}

// create a topic space for the maestro server
resource maestroServerTopicspace 'Microsoft.EventGrid/namespaces/topicSpaces@2023-12-15-preview' = {
name: 'maestro-server'
// create a topic space for the maestro server to subscribe to
resource maestroServerSubscribeTopicspace 'Microsoft.EventGrid/namespaces/topicSpaces@2023-12-15-preview' = {
name: 'maestro-server-subscribe'
parent: eventGridNamespace
properties: {
topicTemplates: [
'sources/#'
'sources/maestro/consumers/+/agentevents'
]
}
}

resource maestroServerPermissionBindingPublish 'Microsoft.EventGrid/namespaces/permissionBindings@2023-12-15-preview' = {
name: 'maestro-server-publish'
// ... and grant the maestro server client permission to subscribe to the topic space
resource maestroServerPermissionBindingSubscribe 'Microsoft.EventGrid/namespaces/permissionBindings@2023-12-15-preview' = {
name: 'maestro-server-subscribe-binding'
parent: eventGridNamespace
properties: {
clientGroupName: maestroServerMqttClientGroup.name
permission: 'Publisher'
topicSpaceName: maestroServerTopicspace.name
permission: 'Subscriber'
topicSpaceName: maestroServerSubscribeTopicspace.name
}
}

resource maestroServerPermissionBindingSubscribe 'Microsoft.EventGrid/namespaces/permissionBindings@2023-12-15-preview' = {
name: 'maestro-server-subscribe'
// create a topic space for the maestro server to publish to
resource maestroServerPublishTopicspace 'Microsoft.EventGrid/namespaces/topicSpaces@2023-12-15-preview' = {
name: 'maestro-server-publish'
parent: eventGridNamespace
properties: {
topicTemplates: [
'sources/maestro/consumers/+/sourceevents'
]
}
}

// ... and grant the maestro server client permission to publish to the topic space
resource maestroServerPermissionBindingPublish 'Microsoft.EventGrid/namespaces/permissionBindings@2023-12-15-preview' = {
name: 'maestro-server-publish-binding'
parent: eventGridNamespace
properties: {
clientGroupName: maestroServerMqttClientGroup.name
permission: 'Subscriber'
topicSpaceName: maestroServerTopicspace.name
permission: 'Publisher'
topicSpaceName: maestroServerPublishTopicspace.name
}
}

Expand Down

0 comments on commit 617cd28

Please sign in to comment.