Skip to content

Commit bb0670f

Browse files
authored
Merge pull request #142 from pauldotyu/main
Demo updates
2 parents dce52c8 + 7e0bd6d commit bb0670f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2041
-417
lines changed

ai-service.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
nodeSelector:
1616
"kubernetes.io/os": linux
1717
containers:
18-
- name: order-service
18+
- name: ai-service
1919
image: ghcr.io/azure-samples/aks-store-demo/ai-service:latest
2020
ports:
2121
- containerPort: 5001
@@ -35,8 +35,8 @@ spec:
3535
cpu: 20m
3636
memory: 50Mi
3737
limits:
38-
cpu: 30m
39-
memory: 85Mi
38+
cpu: 50m
39+
memory: 128Mi
4040
startupProbe:
4141
httpGet:
4242
path: /health
@@ -49,15 +49,15 @@ spec:
4949
path: /health
5050
port: 5001
5151
initialDelaySeconds: 3
52-
failureThreshold: 3
53-
periodSeconds: 5
52+
failureThreshold: 10
53+
periodSeconds: 10
5454
livenessProbe:
5555
httpGet:
5656
path: /health
5757
port: 5001
5858
initialDelaySeconds: 3
59-
failureThreshold: 5
60-
periodSeconds: 3
59+
failureThreshold: 10
60+
periodSeconds: 10
6161
---
6262
apiVersion: v1
6363
kind: Service

aks-store-all-in-one.yaml

+11-5
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ spec:
160160
cpu: 1m
161161
memory: 50Mi
162162
limits:
163-
cpu: 75m
164-
memory: 128Mi
163+
cpu: 100m
164+
memory: 256Mi
165165
startupProbe:
166166
httpGet:
167167
path: /health
@@ -192,8 +192,8 @@ spec:
192192
cpu: 1m
193193
memory: 50Mi
194194
limits:
195-
cpu: 75m
196-
memory: 128Mi
195+
cpu: 100m
196+
memory: 256Mi
197197
---
198198
apiVersion: v1
199199
kind: Service
@@ -251,6 +251,12 @@ spec:
251251
limits:
252252
cpu: 5m
253253
memory: 20Mi
254+
startupProbe:
255+
httpGet:
256+
path: /health
257+
port: 3001
258+
failureThreshold: 10
259+
periodSeconds: 5
254260
readinessProbe:
255261
httpGet:
256262
path: /health
@@ -536,4 +542,4 @@ spec:
536542
memory: 1Mi
537543
limits:
538544
cpu: 1m
539-
memory: 7Mi
545+
memory: 7Mi

azd-hooks/predeploy.ps1

+42-11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,26 @@
33
az aks get-credentials --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_AKS_CLUSTER_NAME} --overwrite-existing
44

55
###########################################################
6-
# Create the custom-values.yaml file with base images
6+
# Create the custom-values.yaml file
77
###########################################################
8+
@"
9+
namespace: ${env:AZURE_AKS_NAMESPACE}
10+
"@ | Out-File -FilePath custom-values.yaml -Encoding utf8
11+
12+
###########################################################
13+
# Add Azure Managed Identity and set to use AzureAD auth
14+
###########################################################
15+
if (![string]::IsNullOrEmpty($env:AZURE_IDENTITY_CLIENT_ID) -and ![string]::IsNullOrEmpty($env:AZURE_IDENTITY_NAME)) {
16+
@"
17+
useAzureAd: true
18+
managedIdentityName: $($env:AZURE_IDENTITY_NAME)
19+
managedIdentityClientId: $($env:AZURE_IDENTITY_CLIENT_ID)
20+
"@ | Out-File -Append custom-values.yaml
21+
}
822

23+
###########################################################
24+
# Add base images
25+
###########################################################
926
@"
1027
namespace: ${env:AZURE_AKS_NAMESPACE}
1128
productService:
@@ -23,7 +40,7 @@ virtualCustomer:
2340
virtualWorker:
2441
image:
2542
repository: ${env:AZURE_REGISTRY_URI}/aks-store-demo/virtual-worker
26-
"@ | Out-File -FilePath custom-values.yaml -Encoding utf8
43+
"@ | Out-File -Append custom-values.yaml
2744

2845
###########################################################
2946
# Add ai-service if Azure OpenAI endpoint is provided
@@ -40,13 +57,8 @@ aiService:
4057
useAzureOpenAi: if ($env:AZURE_OPENAI_ENDPOINT) { 'true' }
4158
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
4259

43-
# If Azure identity exists, use it, otherwise use the Azure OpenAI API key
44-
if ($env:AZURE_IDENTITY_CLIENT_ID) {
45-
@"
46-
managedIdentityClientId: ${env:AZURE_IDENTITY_CLIENT_ID}
47-
useAzureAd: true
48-
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
49-
} else {
60+
# If Azure identity does not exist, use the Azure OpenAI API key
61+
if (($env:AZURE_IDENTITY_CLIENT_ID -eq $null) -and ($env:AZURE_IDENTITY_NAME -eq $null)) {
5062
$openAiKey = az keyvault secret show --name $env:AZURE_OPENAI_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv
5163
@"
5264
openAiKey: $openAiKey
@@ -68,6 +80,13 @@ if ($env:AZURE_SERVICE_BUS_HOST) {
6880
$queuePassword = az keyvault secret show --name $env:AZURE_SERVICE_BUS_SENDER_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv
6981
@"
7082
queueHost: ${env:AZURE_SERVICE_BUS_HOST}
83+
"@ | Out-File -Append custom-values.yaml
84+
85+
86+
# If Azure identity does not exists, use the Azure Service Bus credentials
87+
if (-not $env:AZURE_IDENTITY_CLIENT_ID -and -not $env:AZURE_IDENTITY_NAME) {
88+
$queuePassword = az keyvault secret show --name $env:AZURE_SERVICE_BUS_SENDER_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv
89+
@"
7190
queuePort: "5671"
7291
queueTransport: "tls"
7392
queueUsername: ${env:AZURE_SERVICE_BUS_SENDER_NAME}
@@ -86,12 +105,19 @@ makelineService:
86105

87106
# Add Azure Service Bus to makeline-service if provided
88107
if ($env:AZURE_SERVICE_BUS_URI) {
108+
# If Azure identity exists just set the Azure Service Bus Hostname
109+
if ($env:AZURE_IDENTITY_CLIENT_ID -and $env:AZURE_IDENTITY_NAME) {
110+
@"
111+
orderQueueHost: $($env:AZURE_SERVICE_BUS_HOST)
112+
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
113+
} else {
89114
$orderQueuePassword = az keyvault secret show --name $env:AZURE_SERVICE_BUS_LISTENER_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv
90115
@"
91116
orderQueueUri: ${env:AZURE_SERVICE_BUS_URI}
92117
orderQueueUsername: ${env:AZURE_SERVICE_BUS_LISTENER_NAME}
93118
orderQueuePassword: $orderQueuePassword
94119
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
120+
}
95121
}
96122

97123
# Add Azure Cosmos DB to makeline-service if provided
@@ -100,13 +126,18 @@ if ($env:AZURE_COSMOS_DATABASE_URI) {
100126
@"
101127
orderDBApi: ${env:AZURE_DATABASE_API}
102128
orderDBUri: ${env:AZURE_COSMOS_DATABASE_URI}
129+
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
130+
131+
# If Azure identity does not exists, use the Azure Cosmos DB credentials
132+
if (-not $env:AZURE_IDENTITY_CLIENT_ID -and -not $env:AZURE_IDENTITY_NAME) {
133+
$orderDBPassword = az keyvault secret show --name $env:AZURE_COSMOS_DATABASE_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv
134+
@"
103135
orderDBUsername: ${env:AZURE_COSMOS_DATABASE_NAME}
104136
orderDBPassword: $orderDBPassword
105137
"@ | Out-File -Path custom-values.yaml -Append -Encoding utf8
138+
}
106139
}
107140

108-
109-
110141
###########################################################
111142
# Do not deploy RabbitMQ when using Azure Service Bus
112143
###########################################################

azd-hooks/predeploy.sh

+49-10
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,28 @@
33
az aks get-credentials --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_AKS_CLUSTER_NAME} --overwrite-existing
44

55
##########################################################
6-
# Create the custom-values.yaml file with base images
6+
# Create the custom-values.yaml file
77
##########################################################
8-
98
cat << EOF > custom-values.yaml
109
namespace: ${AZURE_AKS_NAMESPACE}
10+
EOF
11+
12+
###########################################################
13+
# Add Azure Managed Identity and set to use AzureAD auth
14+
###########################################################
15+
if [ -n "${AZURE_IDENTITY_CLIENT_ID}" ] && [ -n "${AZURE_IDENTITY_NAME}" ]; then
16+
cat << EOF >> custom-values.yaml
17+
useAzureAd: true
18+
managedIdentityName: ${AZURE_IDENTITY_NAME}
19+
managedIdentityClientId: ${AZURE_IDENTITY_CLIENT_ID}
20+
EOF
21+
fi
22+
23+
##########################################################
24+
# Add base images
25+
##########################################################
26+
cat << EOF >> custom-values.yaml
27+
namespace: ${AZURE_AKS_NAMESPACE}
1128
productService:
1229
image:
1330
repository: ${AZURE_REGISTRY_URI}/aks-store-demo/product-service
@@ -40,15 +57,18 @@ aiService:
4057
useAzureOpenAi: true
4158
EOF
4259

43-
# If Azure identity exists, use it, otherwise use the Azure OpenAI API key
44-
if [ -n "${AZURE_IDENTITY_CLIENT_ID}" ]; then
60+
# If Azure identity does not exists, use the Azure OpenAI API key
61+
if [ -z "${AZURE_IDENTITY_CLIENT_ID}" ] && [ -z "${AZURE_IDENTITY_NAME}" ]; then
4562
cat << EOF >> custom-values.yaml
46-
useAzureAd: true
47-
managedIdentityClientId: ${AZURE_IDENTITY_CLIENT_ID}
63+
openAiKey: $(az keyvault secret show --name ${AZURE_OPENAI_KEY} --vault-name ${AZURE_KEY_VAULT_NAME} --query value -o tsv)
4864
EOF
49-
else
65+
fi
66+
67+
# If DALL-E model endpoint and name exists
68+
if [ -n "${AZURE_OPENAI_DALL_E_ENDPOINT}" ] && [ -n "${AZURE_OPENAI_DALL_E_MODEL_NAME}" ]; then
5069
cat << EOF >> custom-values.yaml
51-
openAiKey: $(az keyvault secret show --name ${AZURE_OPENAI_KEY} --vault-name ${AZURE_KEY_VAULT_NAME} --query value -o tsv)
70+
openAiDalleEndpoint: ${AZURE_OPENAI_DALL_E_ENDPOINT}
71+
openAiDalleModelName: ${AZURE_OPENAI_DALL_E_MODEL_NAME}
5272
EOF
5373
fi
5474
fi
@@ -67,11 +87,17 @@ EOF
6787
if [ -n "${AZURE_SERVICE_BUS_HOST}" ]; then
6888
cat << EOF >> custom-values.yaml
6989
queueHost: ${AZURE_SERVICE_BUS_HOST}
90+
EOF
91+
92+
# If Azure identity does not exists, use the Azure Service Bus credentials
93+
if [ -z "${AZURE_IDENTITY_CLIENT_ID}" ] && [ -z "${AZURE_IDENTITY_NAME}" ]; then
94+
cat << EOF >> custom-values.yaml
7095
queuePort: "5671"
7196
queueTransport: "tls"
7297
queueUsername: ${AZURE_SERVICE_BUS_SENDER_NAME}
7398
queuePassword: $(az keyvault secret show --name ${AZURE_SERVICE_BUS_SENDER_KEY} --vault-name ${AZURE_KEY_VAULT_NAME} --query value -o tsv)
7499
EOF
100+
fi
75101
fi
76102

77103
###########################################################
@@ -86,21 +112,34 @@ EOF
86112

87113
# Add Azure Service Bus to makeline-service if provided
88114
if [ -n "${AZURE_SERVICE_BUS_URI}" ]; then
89-
cat << EOF >> custom-values.yaml
115+
# If Azure identity exists just set the Azure Service Bus Hostname
116+
if [ -n "${AZURE_IDENTITY_CLIENT_ID}" ] && [ -n "${AZURE_IDENTITY_NAME}" ]; then
117+
cat << EOF >> custom-values.yaml
118+
orderQueueHost: ${AZURE_SERVICE_BUS_HOST}
119+
EOF
120+
else
121+
cat << EOF >> custom-values.yaml
90122
orderQueueUri: ${AZURE_SERVICE_BUS_URI}
91123
orderQueueUsername: ${AZURE_SERVICE_BUS_LISTENER_NAME}
92124
orderQueuePassword: $(az keyvault secret show --name ${AZURE_SERVICE_BUS_LISTENER_KEY} --vault-name ${AZURE_KEY_VAULT_NAME} --query value -o tsv)
93125
EOF
126+
fi
94127
fi
95128

96129
# Add Azure Cosmos DB to makeline-service if provided
97130
if [ -n "${AZURE_COSMOS_DATABASE_URI}" ]; then
98131
cat << EOF >> custom-values.yaml
99132
orderDBApi: ${AZURE_DATABASE_API}
100133
orderDBUri: ${AZURE_COSMOS_DATABASE_URI}
134+
EOF
135+
136+
# If Azure identity does not exists, use the Azure Cosmos DB credentials
137+
if [ -z "${AZURE_IDENTITY_CLIENT_ID}" ] && [ -z "${AZURE_IDENTITY_NAME}" ]; then
138+
cat << EOF >> custom-values.yaml
101139
orderDBUsername: ${AZURE_COSMOS_DATABASE_NAME}
102140
orderDBPassword: $(az keyvault secret show --name ${AZURE_COSMOS_DATABASE_KEY} --vault-name ${AZURE_KEY_VAULT_NAME} --query value -o tsv)
103141
EOF
142+
fi
104143
fi
105144

106145
###########################################################
@@ -119,4 +158,4 @@ if [ -n "${AZURE_COSMOS_DATABASE_URI}" ]; then
119158
cat << EOF >> custom-values.yaml
120159
useMongoDB: false
121160
EOF
122-
fi
161+
fi

azd-hooks/preprovision.ps1

-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ while ((az provider show --namespace "Microsoft.ContainerService" --query "regis
88
Start-Sleep -Seconds 3
99
}
1010

11-
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
12-
while ((az feature show --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview" --query "properties.state" -o tsv) -ne "Registered") {
13-
Write-Host "Waiting for AKS-KedaPreview feature registration..."
14-
Start-Sleep -Seconds 3
15-
}
16-
17-
az feature register --namespace "Microsoft.ContainerService" --name "AKS-PrometheusAddonPreview"
18-
while ((az feature show --namespace "Microsoft.ContainerService" --name "AKS-PrometheusAddonPreview" --query "properties.state" -o tsv) -ne "Registered") {
19-
Write-Host "Waiting for AKS-PrometheusAddonPreview feature registration..."
20-
Start-Sleep -Seconds 3
21-
}
22-
2311
az feature register --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview"
2412
while ((az feature show --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview" --query "properties.state" -o tsv) -ne "Registered") {
2513
Write-Host "Waiting for NetworkObservabilityPreview feature registration..."

azd-hooks/preprovision.sh

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
22

3+
if ${AZURE_COSMOSDB_ACCOUNT_KIND} == "MongoDB" && ${DEPLOY_AZURE_WORKLOAD_IDENTITY} == "true"; then
4+
echo "Azure CosmosDB account kind cannot be MongoDB when deploying Azure Workload Identity"
5+
exit 1
6+
fi
7+
38
echo "Ensuring Azure CLI extensions and dependencies are installed"
49

510
az provider register --namespace "Microsoft.ContainerService"
@@ -8,19 +13,6 @@ while [[ $(az provider show --namespace "Microsoft.ContainerService" --query "re
813
sleep 3
914
done
1015

11-
12-
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
13-
while [[ $(az feature show --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview" --query "properties.state" -o tsv) != "Registered" ]]; do
14-
echo "Waiting for AKS-KedaPreview feature registration..."
15-
sleep 3
16-
done
17-
18-
az feature register --namespace "Microsoft.ContainerService" --name "AKS-PrometheusAddonPreview"
19-
while [[ $(az feature show --namespace "Microsoft.ContainerService" --name "AKS-PrometheusAddonPreview" --query "properties.state" -o tsv) != "Registered" ]]; do
20-
echo "Waiting for AKS-PrometheusAddonPreview feature registration..."
21-
sleep 3
22-
done
23-
2416
az feature register --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview"
2517
while [[ $(az feature show --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview" --query "properties.state" -o tsv) != "Registered" ]]; do
2618
echo "Waiting for NetworkObservabilityPreview feature registration..."

azure.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ services:
6565
releases:
6666
- name: demo
6767
chart: aks-store-demo/aks-store-demo-chart
68-
version: 1.1.0
68+
version: 1.2.0
6969
values: custom-values.yaml # This file is created by the predeploy hook

charts/aks-store-demo/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.1.0
18+
version: 1.2.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

0 commit comments

Comments
 (0)