Skip to content

Commit 625b16e

Browse files
committed
fix: allow gRPC connection from container apps
1 parent 397b2dd commit 625b16e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

infra/core/host/container-app.bicep

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ param keyVaultName string = ''
1313
param managedIdentity bool = !empty(keyVaultName)
1414
param targetPort int = 80
1515
param allowedOrigins array = []
16+
param transport string = 'auto'
17+
param allowInsecure bool = false
1618

1719
@description('CPU cores allocated to a single container instance, e.g. 0.5')
1820
param containerCpuCoreCount string = '0.5'
@@ -32,7 +34,8 @@ resource app 'Microsoft.App/containerApps@2023-05-01' = {
3234
ingress: {
3335
external: external
3436
targetPort: targetPort
35-
transport: 'auto'
37+
transport: transport
38+
allowInsecure: allowInsecure
3639
corsPolicy: {
3740
allowedOrigins: empty(allowedOrigins) ? ['*'] : allowedOrigins
3841
}

infra/main.bicep

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var tags = { 'azd-env-name': environmentName }
7474
var finalOpenAiUrl = empty(openAiUrl) ? 'https://${openAi.outputs.name}.openai.azure.com' : openAiUrl
7575
var useAzureAISearch = !useQdrant
7676
var azureSearchService = useAzureAISearch ? searchService.outputs.name : ''
77-
var qdrantUrl = useQdrant ? '${qdrant.outputs.uri}:443' : ''
77+
var qdrantUrl = useQdrant ? (qdrantPort == 6334 ? replace('${qdrant.outputs.uri}:80', 'https', 'http') : '${qdrant.outputs.uri}:443') : ''
7878

7979
// Organize resources in a resource group
8080
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
@@ -322,6 +322,9 @@ module qdrant './core/host/container-app.bicep' = if (useQdrant) {
322322
}] : [])
323323
imageName: !empty(qdrantImageName) ? qdrantImageName : 'docker.io/qdrant/qdrant'
324324
targetPort: qdrantPort
325+
allowInsecure: (qdrantPort == 6334 ? true : false)
326+
// gRPC needs to be explicitly set for HTTP2
327+
transport: (qdrantPort == 6334 ? 'HTTP2' : 'auto')
325328
}
326329
}
327330

0 commit comments

Comments
 (0)