Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scenarios/AksOpenAiTerraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ms.custom: innovation-engine, linux-related-content
Run terraform to provision all the Azure resources required to setup your new OpenAI website.
```bash
# Terraform parses TF_VAR_* as vars (Ex: TF_VAR_name -> name)
export TF_VAR_location="westus3"
export TF_VAR_location=$REGION
export TF_VAR_kubernetes_version="1.30.9"
export TF_VAR_model_name="gpt-4o-mini"
export TF_VAR_model_version="2024-07-18"
Expand All @@ -27,7 +27,8 @@ terraform -chdir=terraform apply -auto-approve
In order to use the kubectl to run commands on the newly created cluster, you must first login.
```bash
RESOURCE_GROUP=$(terraform -chdir=terraform output -raw resource_group_name)
az aks get-credentials --admin --name AksCluster --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID
AKS_CLUSTER_NAME=$(terraform -chdir=terraform output -raw aks_cluster_name)
az aks get-credentials --admin --name $AKS_CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID
```

# Install Helm Charts
Expand Down Expand Up @@ -55,8 +56,9 @@ helm upgrade --install cert-manager jetstack/cert-manager \
Apply/Deploy Manifest File
```bash
export IMAGE="aamini8/magic8ball:latest"
# Uncomment below to manually build docker image yourself instead of using pre-built image.
# (Uncomment below to manually build docker image yourself instead of using pre-built image.)
# docker build -t <YOUR IMAGE NAME> ./magic8ball --push

export HOSTNAME=$(terraform -chdir=terraform output -raw hostname)
export WORKLOAD_IDENTITY_CLIENT_ID=$(terraform -chdir=terraform output -raw workload_identity_client_id)
export AZURE_OPENAI_DEPLOYMENT=$(terraform -chdir=terraform output -raw openai_deployment)
Expand All @@ -66,6 +68,6 @@ envsubst < quickstart-app.yml | kubectl apply -f -

## Wait for host to be ready
```bash
kubectl wait --for=condition=Ready certificate/tls-secret
kubectl wait --for=condition=Ready --timeout=5m certificate/tls-secret
echo "Visit: https://$HOSTNAME"
```
4 changes: 2 additions & 2 deletions scenarios/AksOpenAiTerraform/magic8ball/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
streamlit~=1.40.1
azure-identity~=1.20.0
openai~=1.65.2
azure-identity~=1.21.0
openai~=1.66.2
2 changes: 1 addition & 1 deletion scenarios/AksOpenAiTerraform/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ resource "azurerm_resource_group" "main" {
# Kubernetes
###############################################################################
resource "azurerm_kubernetes_cluster" "main" {
name = "AksCluster"
name = "AksCluster-${local.random_id}"
location = var.location
resource_group_name = azurerm_resource_group.main.name

Expand Down
4 changes: 4 additions & 0 deletions scenarios/AksOpenAiTerraform/terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ output "resource_group_name" {
value = azurerm_resource_group.main.name
}

output "aks_cluster_name" {
value = azurerm_kubernetes_cluster.main.name
}

output "workload_identity_client_id" {
value = azurerm_user_assigned_identity.workload.client_id
}
Expand Down
2 changes: 1 addition & 1 deletion scenarios/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@
}
},
{
"status": "inactive",
"status": "active",
"key": "AksOpenAiTerraform/README.md",
"title": "How to deploy and run an Azure OpenAI ChatGPT application on AKS via Terraform",
"description": "This article shows how to deploy an AKS cluster and Azure OpenAI Service via Terraform and how to deploy a ChatGPT-like application in Python.",
Expand Down
Loading