Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: recreate-vs-endpoint-name-$UNIQUE_NAME

sync:
paths: []

resources:
vector_search_endpoints:
my_endpoint:
name: vs-endpoint-$UNIQUE_NAME
endpoint_type: STANDARD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"method": "POST",
"path": "/api/2.0/vector-search/endpoints",
"body": {
"endpoint_type": "STANDARD",
"name": "vs-endpoint-[UNIQUE_NAME]"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"method": "DELETE",
"path": "/api/2.0/vector-search/endpoints/vs-endpoint-[UNIQUE_NAME]"
}
{
"method": "POST",
"path": "/api/2.0/vector-search/endpoints",
"body": {
"endpoint_type": "STANDARD",
"name": "vs-endpoint-renamed-[UNIQUE_NAME]"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

=== Initial deployment
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-vs-endpoint-name-[UNIQUE_NAME]/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> print_requests.py --keep //vector-search/endpoints

=== Rename endpoint (should trigger recreation)
>>> update_file.py databricks.yml name: vs-endpoint-[UNIQUE_NAME] name: vs-endpoint-renamed-[UNIQUE_NAME]

>>> [CLI] bundle plan
recreate vector_search_endpoints.my_endpoint

Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged

>>> [CLI] bundle deploy --auto-approve
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-vs-endpoint-name-[UNIQUE_NAME]/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> print_requests.py --keep //vector-search/endpoints

>>> [CLI] vector-search-endpoints get-endpoint vs-endpoint-renamed-[UNIQUE_NAME]
{
"name": "vs-endpoint-renamed-[UNIQUE_NAME]",
"endpoint_type": "STANDARD"
}

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.vector_search_endpoints.my_endpoint

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/recreate-vs-endpoint-name-[UNIQUE_NAME]/default

Deleting files...
Destroy complete!
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

print_requests() {
local label=$1
trace print_requests.py --keep '//vector-search/endpoints' > out.requests.${label}.$DATABRICKS_BUNDLE_ENGINE.json
rm -f out.requests.txt
}

title "Initial deployment"
rm -f out.requests.txt
trace $CLI bundle deploy

print_requests create

title "Rename endpoint (should trigger recreation)"
trace update_file.py databricks.yml "name: vs-endpoint-$UNIQUE_NAME" "name: vs-endpoint-renamed-$UNIQUE_NAME"

trace $CLI bundle plan
rm -f out.requests.txt
trace $CLI bundle deploy --auto-approve

print_requests recreate

trace $CLI vector-search-endpoints get-endpoint "vs-endpoint-renamed-${UNIQUE_NAME}" | jq '{name, endpoint_type}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged
],
"schema_json": "{\"id\":\"int\",\"vector\":\"array\u003cfloat\u003e\"}"
},
"endpoint_id": "[UUID]",
"endpoint_name": "vs-endpoint-[UNIQUE_NAME]",
"endpoint_uuid": "[UUID]",
"index_subtype": "HYBRID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ func TestApplyBundlePermissions(t *testing.T) {
require.Contains(t, b.Config.Resources.Apps["app_1"].Permissions, resources.AppPermission{Level: "CAN_USE", GroupName: "TestGroup"})

require.Len(t, b.Config.Resources.VectorSearchEndpoints["vs_1"].Permissions, 2)
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_1"].Permissions, resources.Permission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_1"].Permissions, resources.Permission{Level: "CAN_USE", GroupName: "TestGroup"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_1"].Permissions, resources.VectorSearchEndpointPermission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_1"].Permissions, resources.VectorSearchEndpointPermission{Level: "CAN_USE", GroupName: "TestGroup"})

require.Len(t, b.Config.Resources.VectorSearchEndpoints["vs_2"].Permissions, 2)
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_2"].Permissions, resources.Permission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_2"].Permissions, resources.Permission{Level: "CAN_USE", GroupName: "TestGroup"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_2"].Permissions, resources.VectorSearchEndpointPermission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.VectorSearchEndpoints["vs_2"].Permissions, resources.VectorSearchEndpointPermission{Level: "CAN_USE", GroupName: "TestGroup"})
}

func TestWarningOnOverlapPermission(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions bundle/config/resources/permission_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/databricks/databricks-sdk-go/service/pipelines"
"github.com/databricks/databricks-sdk-go/service/serving"
"github.com/databricks/databricks-sdk-go/service/sql"
"github.com/databricks/databricks-sdk-go/service/vectorsearch"
)

// Each resource defines its own permission type so that the JSON schema names them distinctly.
Expand All @@ -32,4 +33,5 @@ type (
ModelServingEndpointPermission PermissionT[serving.ServingEndpointPermissionLevel]
PipelinePermission PermissionT[pipelines.PipelinePermissionLevel]
SqlWarehousePermission PermissionT[sql.WarehousePermissionLevel]
VectorSearchEndpointPermission PermissionT[vectorsearch.VectorSearchEndpointPermissionLevel]
)
2 changes: 1 addition & 1 deletion bundle/config/resources/vector_search_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type VectorSearchEndpoint struct {
BaseResource
vectorsearch.CreateEndpoint

Permissions []Permission `json:"permissions,omitempty"`
Permissions []VectorSearchEndpointPermission `json:"permissions,omitempty"`
}

func (e *VectorSearchEndpoint) UnmarshalJSON(b []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion bundle/direct/dresources/vector_search_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const deleteIndexTimeout = 15 * time.Minute
// createIndexTimeout caps the wait for an index to become ready after creation.
// Delta sync indexes do an initial sync from the source table, which can stretch
// out for large tables. Matches the terraform provider's defaultIndexProvisionTimeout.
// https://github.com/databricks/terraform-provider-databricks/blob/c61a32300445f84efb2bb6827dee35e6e523f4ff/vectorsearch/resource_vector_search_index.go#L19
// https://github.com/databricks/terraform-provider-databricks/blob/c79d82d9582ab6670468bbff303199906d47905f/vectorsearch/resource_vector_search_index.go#L19
const createIndexTimeout = 75 * time.Minute

// VectorSearchIndexState tracks the UUID of the endpoint the index is attached
Expand Down
13 changes: 13 additions & 0 deletions bundle/internal/schema/annotations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,19 @@ resources:
"permissions":
"description": |-
PLACEHOLDER
"$fields":
"group_name":
"description": |-
PLACEHOLDER
"level":
"description": |-
PLACEHOLDER
"service_principal_name":
"description": |-
PLACEHOLDER
"user_name":
"description": |-
PLACEHOLDER
"vector_search_indexes":
"description": |-
PLACEHOLDER
Expand Down
2 changes: 1 addition & 1 deletion bundle/internal/validation/generated/enum_fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 61 additions & 1 deletion bundle/schema/jsonschema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 37 additions & 1 deletion bundle/schema/jsonschema_for_docs.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libs/testserver/fake_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ type FakeWorkspace struct {
RegisteredModels map[string]catalog.RegisteredModelInfo
ServingEndpoints map[string]serving.ServingEndpointDetailed
VectorSearchEndpoints map[string]vectorsearch.EndpointInfo
VectorSearchIndexes map[string]fakeVectorSearchIndex
VectorSearchIndexes map[string]vectorsearch.VectorIndex

SecretScopes map[string]workspace.SecretScope
Secrets map[string]map[string]string // scope -> key -> value
Expand Down Expand Up @@ -301,7 +301,7 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace {
},
ServingEndpoints: map[string]serving.ServingEndpointDetailed{},
VectorSearchEndpoints: map[string]vectorsearch.EndpointInfo{},
VectorSearchIndexes: map[string]fakeVectorSearchIndex{},
VectorSearchIndexes: map[string]vectorsearch.VectorIndex{},
Repos: map[string]workspace.RepoInfo{},
SecretScopes: map[string]workspace.SecretScope{},
Secrets: map[string]map[string]string{},
Expand Down
Loading
Loading