Skip to content

Commit

Permalink
feat: Add Image Pull Secret (#258)
Browse files Browse the repository at this point in the history
Add image secret for test repo
  • Loading branch information
ishaansehgal99 authored Feb 27, 2024
1 parent cc53389 commit de2b45c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/kaito-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ jobs:
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }}
REGISTRY: ${{ env.CLUSTER_NAME }}.azurecr.io
VERSION: ${{ env.VERSION }}

- name: Attach Private Presets ACR
uses: azure/[email protected]
with:
inlineScript: |
az aks update -n ${{ env.CLUSTER_NAME }} -g ${{ env.CLUSTER_NAME }} \
--attach-acr ${{ secrets.ACR_AMRT_USERNAME }}
- name: Add Secret Credentials
run: |
kubectl create secret docker-registry ${{secrets.AMRT_SECRET_NAME}} \
--docker-server=${{secrets.ACR_AMRT_USERNAME}}.azurecr.io \
--docker-username=${{secrets.ACR_AMRT_USERNAME}} \
--docker-password=${{secrets.ACR_AMRT_PASSWORD}}
- name: Log kaito-workspace
run: |
Expand All @@ -154,6 +154,7 @@ jobs:
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }}
RUN_LLAMA_13B: ${{ env.RUN_LLAMA_13B }}
AI_MODELS_REGISTRY: ${{secrets.ACR_AMRT_USERNAME}}.azurecr.io
AI_MODELS_REGISTRY_SECRET: ${{secrets.AMRT_SECRET_NAME}}

- name: Cleanup e2e resources
if: ${{ always() }}
Expand Down
14 changes: 8 additions & 6 deletions test/e2e/preset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ func createFalconWorkspaceWithPresetPublicMode(numOfNode int) *kaitov1alpha1.Wor
return workspaceObj
}

func createLlama7BWorkspaceWithPresetPrivateMode(registry, imageVersion string, numOfNode int) *kaitov1alpha1.Workspace {
func createLlama7BWorkspaceWithPresetPrivateMode(registry, registrySecret, imageVersion string, numOfNode int) *kaitov1alpha1.Workspace {
workspaceObj := &kaitov1alpha1.Workspace{}
By("Creating a workspace CR with Llama 7B Chat preset private mode", func() {
uniqueID := fmt.Sprint("preset-", rand.Intn(1000))
workspaceObj = utils.GenerateWorkspaceManifest(uniqueID, namespaceName, fmt.Sprintf("%s/%s:%s", registry, PresetLlama2AChat, imageVersion),
numOfNode, "Standard_NC12s_v3", &metav1.LabelSelector{
MatchLabels: map[string]string{"kaito-workspace": "private-preset-e2e-test"},
}, nil, PresetLlama2AChat, kaitov1alpha1.ModelImageAccessModePrivate, []string{}, nil)
}, nil, PresetLlama2AChat, kaitov1alpha1.ModelImageAccessModePrivate, []string{registrySecret}, nil)

createAndValidateWorkspace(workspaceObj)
})
return workspaceObj
}

func createLlama13BWorkspaceWithPresetPrivateMode(registry, imageVersion string, numOfNode int) *kaitov1alpha1.Workspace {
func createLlama13BWorkspaceWithPresetPrivateMode(registry, registrySecret, imageVersion string, numOfNode int) *kaitov1alpha1.Workspace {
workspaceObj := &kaitov1alpha1.Workspace{}
By("Creating a workspace CR with Llama 13B Chat preset private mode", func() {
uniqueID := fmt.Sprint("preset-", rand.Intn(1000))
workspaceObj = utils.GenerateWorkspaceManifest(uniqueID, namespaceName, fmt.Sprintf("%s/%s:%s", registry, PresetLlama2BChat, imageVersion),
numOfNode, "Standard_NC12s_v3", &metav1.LabelSelector{
MatchLabels: map[string]string{"kaito-workspace": "private-preset-e2e-test"},
}, nil, PresetLlama2BChat, kaitov1alpha1.ModelImageAccessModePrivate, []string{}, nil)
}, nil, PresetLlama2BChat, kaitov1alpha1.ModelImageAccessModePrivate, []string{registrySecret}, nil)

createAndValidateWorkspace(workspaceObj)
})
Expand Down Expand Up @@ -305,6 +305,7 @@ func deleteWorkspace(workspaceObj *kaitov1alpha1.Workspace) error {

var runLlama13B bool
var aiModelsRegistry string
var aiModelsRegistrySecret string
var modelInfo map[string]string

var _ = Describe("Workspace Preset", func() {
Expand All @@ -318,6 +319,7 @@ var _ = Describe("Workspace Preset", func() {
}

aiModelsRegistry = utils.GetEnv("AI_MODELS_REGISTRY")
aiModelsRegistrySecret = utils.GetEnv("AI_MODELS_REGISTRY_SECRET")

// Load stable model versions
configs, err := utils.GetModelConfigInfo("/home/runner/work/kaito/kaito/presets/models/supported_models.yaml")
Expand Down Expand Up @@ -358,7 +360,7 @@ var _ = Describe("Workspace Preset", func() {
if !ok {
Fail(fmt.Sprintf("Model version for %s not found", PresetLlama2AChat))
}
workspaceObj := createLlama7BWorkspaceWithPresetPrivateMode(aiModelsRegistry, modelVersion, numOfNode)
workspaceObj := createLlama7BWorkspaceWithPresetPrivateMode(aiModelsRegistry, aiModelsRegistrySecret, modelVersion, numOfNode)

defer cleanupResources(workspaceObj)
time.Sleep(30 * time.Second)
Expand All @@ -384,7 +386,7 @@ var _ = Describe("Workspace Preset", func() {
if !ok {
Fail(fmt.Sprintf("Model version for %s not found", PresetLlama2AChat))
}
workspaceObj := createLlama13BWorkspaceWithPresetPrivateMode(aiModelsRegistry, modelVersion, numOfNode)
workspaceObj := createLlama13BWorkspaceWithPresetPrivateMode(aiModelsRegistry, aiModelsRegistrySecret, modelVersion, numOfNode)

defer cleanupResources(workspaceObj)

Expand Down

0 comments on commit de2b45c

Please sign in to comment.