Skip to content

Commit 62a8bd9

Browse files
committed
Federated credentials
1 parent 75ee507 commit 62a8bd9

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

deploy/helm/tlm/Chart.yaml

Lines changed: 1 addition & 1 deletion
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: 0.1.35
18+
version: 0.1.36
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

deploy/helm/tlm/templates/chat/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ spec:
1414
labels:
1515
{{- include "tlm.selectorLabels" . | nindent 8 }}
1616
tlm.chat-backend: "true"
17+
{{- if .Values.chat_backend.azure_service_principal.enabled }}
18+
azure.workload.identity/use: "true"
19+
{{- end }}
1720
spec:
1821
serviceAccountName: {{ .Release.Name }}-chat-backend
1922
containers:

deploy/helm/tlm/templates/chat/service_account.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ metadata:
55
labels:
66
{{- include "tlm.labels" . | nindent 4 }}
77
annotations:
8-
{{- if .Values.chat_backend.azure_service_principal.client_id }}
8+
{{- if .Values.chat_backend.azure_service_principal.enabled }}
99
azure.workload.identity/client-id: {{ .Values.chat_backend.azure_service_principal.client_id }}
1010
{{- end }}
11-
{{- if .Values.chat_backend.azure_service_principal.tenant_id }}
12-
azure.workload.identity/tenant-id: {{ .Values.chat_backend.azure_service_principal.tenant_id }}
13-
{{- end }}

deploy/helm/tlm/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ imagePullSecret:
1212
chat_backend:
1313
secret_name: ""
1414
azure_service_principal:
15+
enabled: false
1516
client_id: ""
16-
tenant_id: ""
1717

1818
image:
1919
repository: 043170249292.dkr.ecr.us-east-1.amazonaws.com/tlm/chat-backend

installation/aks.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ az identity create --name cleanlabtlm-openai-sp-identity --resource-group <resou
125125
openai_sp_identity_id=$(az identity show --name cleanlabtlm-openai-sp-identity --resource-group <resource_group_name> --query id -o tsv)
126126
openai_sp_identity_client_id=$(az identity show --name cleanlabtlm-openai-sp-identity --resource-group <resource_group_name> --query clientId -o tsv)
127127
openai_sp_identity_principal_id=$(az identity show --name cleanlabtlm-openai-sp-identity --resource-group <resource_group_name> --query principalId -o tsv)
128-
openai_sp_identity_tenant_id=$(az identity show --name cleanlabtlm-openai-sp-identity --resource-group <resource_group_name> --query tenantId -o tsv)
129128
```
130129

131130
2. Assign the `Cognitive Services OpenAI User` role to the identity
@@ -141,10 +140,21 @@ az role assignment create \
141140
az aks update -n <aks_cluster_name> -g <resource_group_name> --assign-identity $openai_sp_identity_id --enable-managed-identity
142141
```
143142

144-
4. Export the identity ID as an environment variable for later use
143+
4. Create a federated identity credential for the identity
144+
```bash
145+
federated_credential_issuer=$(az aks show --name <aks_cluster_name> --resource-group <resource_group_name> --query oidcIssuerProfile.issuerUrl -o tsv)
146+
az identity federated-credential create \
147+
--name cleanlabtlm-openai-sp-identity-federated-credential \
148+
--identity-name cleanlabtlm-openai-sp-identity \
149+
--resource-group <resource_group_name> \
150+
--issuer $federated_credential_issuer \
151+
--subject system:serviceaccount:cleanlabtlm:tlm-chat-backend \
152+
--audience api://AzureADTokenExchange
153+
```
154+
155+
5. Export the identity ID as an environment variable for later use
145156
```bash
146157
export OPENAI_SP_IDENTITY_CLIENT_ID=$openai_sp_identity_client_id
147-
export OPENAI_SP_IDENTITY_TENANT_ID=$openai_sp_identity_tenant_id
148158
```
149159

150160
### 3d. Log in to the `cleanlabtlm` Helm registry
@@ -174,8 +184,8 @@ chat_backend:
174184
TLM_DEFAULT_EMBEDDING_MODEL: azure/text-embedding-3-small
175185
176186
azure_service_principal:
187+
enabled: true
177188
client_id: $OPENAI_SP_IDENTITY_CLIENT_ID
178-
tenant_id: $OPENAI_SP_IDENTITY_TENANT_ID
179189
180190
imagePullSecret:
181191
enabled: true

0 commit comments

Comments
 (0)