-
Notifications
You must be signed in to change notification settings - Fork 26
/
installation_script.tftpl
77 lines (74 loc) · 1.92 KB
/
installation_script.tftpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
az aks get-credentials --resource-group ${resourceGroup} --name ${aksName} --overwrite-existing
az acr build --registry ${registry} --image chatbot:latest ./../sample-application
az identity federated-credential create --name chatbotfederatedidentity --identity-name chatbot --resource-group ${resourceGroup} --issuer ${oidc_url} --subject system:serviceaccount:chatbot:chatbot
# Install Grafana and Grafana Tempo in the default namespace
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm upgrade -f microservices-tempo-values.yaml --install tempo grafana/tempo-distributed
helm upgrade -f microservices-grafana-values.yaml --install grafana grafana/grafana
kubectl create namespace chatbot --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f - <<EOF
---
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
azure.workload.identity/client-id: "${clientid}"
labels:
azure.workload.identity/use: "true"
name: chatbot
namespace: chatbot
---
apiVersion: v1
kind: ConfigMap
metadata:
name: chatbot-config
namespace: chatbot
data:
.env: |
OPENAI_API_TYPE=azuread
OPENAI_API_VERSION=2023-05-15
OPENAI_API_BASE=${endpoint}
CHAT_MODEL_NAME=${chat_model_name}
---
apiVersion: v1
kind: Pod
metadata:
labels:
run: chatbot
azure.workload.identity/use: "true"
name: chatbot
namespace: chatbot
spec:
serviceAccountName: chatbot
containers:
- image: ${registry}.azurecr.io/chatbot:latest
imagePullPolicy: Always
name: chatbot
ports:
- containerPort: 8501
protocol: TCP
volumeMounts:
- mountPath: /app/.env
name: chatbot-config
subPath: .env
volumes:
- name: chatbot-config
configMap:
name: chatbot-config
---
apiVersion: v1
kind: Service
metadata:
name: chatbot
namespace: chatbot
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8501
selector:
run: chatbot
type: LoadBalancer
EOF