-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Heba Elayoty <[email protected]>
- Loading branch information
Showing
13 changed files
with
432 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,8 @@ jobs: | |
environment: e2e-test | ||
env: | ||
GO_VERSION: "1.22" | ||
|
||
KARPENTER_NAMESPACE: "karpenter" | ||
GPU_PROVISIONER_NAMESPACE: "gpu-provisioner" | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
|
@@ -110,21 +111,6 @@ jobs: | |
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | ||
AZURE_ACR_NAME: ${{ env.CLUSTER_NAME }} | ||
|
||
- name: Create Azure Identity | ||
uses: azure/[email protected] | ||
with: | ||
inlineScript: | | ||
az identity create --name ${{ inputs.suite }}Identity --resource-group ${{ env.CLUSTER_NAME }} | ||
- name: build KAITO image | ||
if: ${{ !inputs.isRelease }} | ||
shell: bash | ||
run: | | ||
make docker-build-kaito | ||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
VERSION: ${{ env.VERSION }} | ||
|
||
- name: create cluster | ||
shell: bash | ||
run: | | ||
|
@@ -136,12 +122,20 @@ jobs: | |
AZURE_LOCATION: ${{ inputs.region }} | ||
AKS_K8S_VERSION: ${{ inputs.k8s_version }} | ||
|
||
- name: Create Identities and Permissions for ${{ inputs.suite }} | ||
shell: bash | ||
run: | | ||
make generate-identities | ||
env: | ||
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | ||
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | ||
TEST_SUITE: ${{ inputs.suite }} | ||
|
||
- name: Install gpu-provisioner helm chart | ||
if: ${{ inputs.suite == 'gpuprov' }} | ||
if: ${{ inputs.suite == 'gpuprovisioner' }} | ||
shell: bash | ||
run: | | ||
make gpu-provisioner-helm | ||
kubectl wait --for=condition=available deploy "gpu-provisioner" -n gpu-provisioner --timeout=300s | ||
env: | ||
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | ||
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | ||
|
@@ -154,45 +148,22 @@ jobs: | |
shell: bash | ||
run: | | ||
make azure-karpenter-helm | ||
# taint nodes as karpenter-system | ||
kubectl taint nodes CriticalAddonsOnly=true:NoSchedule --all | ||
kubectl wait --for=condition=available deploy "karpenter" -n karpenter --timeout=300s | ||
env: | ||
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | ||
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | ||
AZURE_TENANT_ID: ${{ secrets.E2E_TENANT_ID }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.E2E_SUBSCRIPTION_ID }} | ||
KARPENTER_VERSION: ${{ vars.KARPENTER_VERSION }} | ||
KARPENTER_NAMESPACE: ${{ env.KARPENTER_NAMESPACE }} | ||
|
||
- uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a # v2.0.0 | ||
with: | ||
client-id: ${{ secrets.E2E_CLIENT_ID }} | ||
tenant-id: ${{ secrets.E2E_TENANT_ID }} | ||
subscription-id: ${{ secrets.E2E_SUBSCRIPTION_ID }} | ||
|
||
- name: Create Role Assignment | ||
uses: azure/[email protected] | ||
with: | ||
inlineScript: | | ||
IDENTITY_PRINCIPAL_ID="$(az identity show --name ${{ inputs.suite }}Identity --resource-group ${{ env.CLUSTER_NAME }} --query 'principalId' -otsv)" | ||
az role assignment create --assignee ${IDENTITY_PRINCIPAL_ID} --scope "/subscriptions/${{ secrets.E2E_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CLUSTER_NAME }}" --role "Contributor" | ||
if [ "${{ inputs.suite }}" == "azkarpenter" ]; then | ||
fi | ||
- name: Create Azure Federated Identity | ||
uses: azure/[email protected] | ||
with: | ||
inlineScript: | | ||
AKS_OIDC_ISSUER="$(az aks show -n "${{ env.CLUSTER_NAME }}" -g "${{ env.CLUSTER_NAME }}" --query 'oidcIssuerProfile.issuerUrl' -otsv)" | ||
if [ "${{ inputs.suite }}" == "gpuprov" ]; then | ||
az identity federated-credential create --name ${{ inputs.suite }}-fed --identity-name ${{ inputs.suite }}Identity --resource-group "${{ env.CLUSTER_NAME }}" \ | ||
--issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:"gpu-provisioner:gpu-provisioner" --audience api://AzureADTokenExchange | ||
fi | ||
if [ "${{ inputs.suite }}" == "azkarpenter" ]; then | ||
az identity federated-credential create --name ${{ inputs.suite }}-fed --identity-name ${{ inputs.suite }}Identity --resource-group "${{ env.CLUSTER_NAME }}" \ | ||
--issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:"karpenter:karpenter-sa" --audience api://AzureADTokenExchange | ||
fi | ||
- name: build KAITO image | ||
if: ${{ !inputs.isRelease }} | ||
shell: bash | ||
run: | | ||
make docker-build-kaito | ||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
VERSION: ${{ env.VERSION }} | ||
|
||
- name: Install KAITO Workspace helm chart | ||
shell: bash | ||
|
@@ -211,7 +182,15 @@ jobs: | |
--docker-server=${{ secrets.E2E_ACR_AMRT_USERNAME }}.azurecr.io \ | ||
--docker-username=${{ secrets.E2E_ACR_AMRT_USERNAME }} \ | ||
--docker-password=${{ secrets.E2E_ACR_AMRT_PASSWORD }} | ||
- name: Log ${{ inputs.suite }} | ||
run: | | ||
if [ "${{ inputs.suite }}" == "gpuprovisioner" ]; then | ||
kubectl logs -f -n "${{ env.GPU_PROVISIONER_NAMESPACE }}" -l app.kubernetes.io/name=gpu-provisioner -c controller | ||
else | ||
kubectl logs -f -n "${{ env.KARPENTER_NAMESPACE }}" -l app.kubernetes.io/name=karpenter -c controller | ||
fi | ||
- name: Log kaito-workspace | ||
run: | | ||
kubectl get pods -n kaito-workspace -o name | grep "^pod/kaito-workspace" | sed 's/^pod\///' | xargs -I {} kubectl logs -n kaito-workspace {} | ||
|
@@ -224,6 +203,7 @@ jobs: | |
RUN_LLAMA_13B: ${{ env.RUN_LLAMA_13B }} | ||
AI_MODELS_REGISTRY: ${{ secrets.E2E_ACR_AMRT_USERNAME }}.azurecr.io | ||
AI_MODELS_REGISTRY_SECRET: ${{ secrets.E2E_AMRT_SECRET_NAME }} | ||
TEST_SUITE: ${{ inputs.suite }} | ||
|
||
- name: Cleanup e2e resources | ||
if: ${{ always() }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# https://github.com/Azure/karpenter-provider-azure/blob/2beb773cbd3134eeabb8c96b72a130b86b1a91e1/hack/deploy/configure-values.sh | ||
|
||
# This script interrogates the AKS cluster and Azure resources to generate | ||
# the gpu-provisioner-values.yaml file using the gpu-provisioner-values-template.yaml file as a template. | ||
|
||
if [ "$#" -ne 3 ]; then | ||
echo "Usage: $0 <cluster-name> <resource-group> <gpu-provisioner-user-assigned-identity-name>" | ||
exit 1 | ||
fi | ||
|
||
echo "Configuring gpu-provisioner-values.yaml for cluster $1 in resource group $2 ..." | ||
|
||
CLUSTER_NAME=$1 | ||
AZURE_RESOURCE_GROUP=$2 | ||
AZURE_GPU_PROVISIONER_USER_ASSIGNED_IDENTITY_NAME=$3 | ||
|
||
AKS_JSON=$(az aks show --name "$CLUSTER_NAME" --resource-group "$AZURE_RESOURCE_GROUP") | ||
AZURE_LOCATION=$(jq -r ".location" <<< "$AKS_JSON") | ||
AZURE_RESOURCE_GROUP_MC=$(jq -r ".nodeResourceGroup" <<< "$AKS_JSON") | ||
AZURE_TENANT_ID=$(az account show |jq -r ".tenantId") | ||
|
||
|
||
GPU_PROVISIONER_USER_ASSIGNED_CLIENT_ID=$(az identity show --resource-group "${AZURE_RESOURCE_GROUP}" --name "${AZURE_GPU_PROVISIONER_USER_ASSIGNED_IDENTITY_NAME}" --query 'clientId' -otsv) | ||
|
||
export CLUSTER_NAME AZURE_LOCATION AZURE_RESOURCE_GROUP_MC GPU_PROVISIONER_USER_ASSIGNED_CLIENT_ID AZURE_TENANT_ID | ||
|
||
# get gpu-provisioner-values-template.yaml, if not already present (e.g. outside of repo context) | ||
if [ ! -f gpu-provisioner-values-template.yaml ]; then | ||
curl -sO https://raw.githubusercontent.com/Azure/gpu-provisioner/main/gpu-provisioner-values-template.yaml | ||
fi | ||
yq '(.. | select(tag == "!!str")) |= envsubst(nu)' gpu-provisioner-values-template.yaml > gpu-provisioner-values.yaml |
Oops, something went wrong.