Skip to content

Commit 886a76d

Browse files
Implement direct KRM types, identity, and generate.sh for NotebookRuntime
This commit implements the direct KRM types, custom template references, and identity configuration for NotebookRuntime (as VertexAINotebookRuntime), fully conforming to the Greenfield resource guidelines. It includes: - Updating generate.sh to include VertexAINotebookRuntime. - Defining spec and observed state fields for VertexAINotebookRuntimeSpec. - Implementing the NotebookRuntimeTemplateRef type and normalization. - Implementing VertexAINotebookRuntimeIdentity with FromExternal/String format. - Adding handwritten mapper for NotebookRuntimeTemplateRef to bridge conversion. - Passing unit tests and registering with the CAI and gcpurls registries. Fix: 11122
1 parent c5d31b9 commit 886a76d

13 files changed

Lines changed: 2154 additions & 1 deletion
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# VertexAINotebookRuntime Greenfield Types Implementation Journal
2+
3+
## Observations & Design Choices
4+
5+
1. **Mapping to GCP Resource**:
6+
- `NotebookRuntime` is a resource of `aiplatform.googleapis.com` (Vertex AI API). Following the established naming pattern under `apis/aiplatform/v1alpha1`, we mapped this to the KCC Kind `VertexAINotebookRuntime:NotebookRuntime`.
7+
8+
2. **Handwritten Mapper Support for References**:
9+
- Because `NotebookRuntime` requires a template reference during assignment, we defined `NotebookRuntimeTemplateRef` in its own file `vertexainotebookruntime_reference.go`.
10+
- The code generator maps `notebook_runtime_template_ref` in proto to our custom Go type but expects handwritten mappers `NotebookRuntimeTemplateRef_FromProto` and `NotebookRuntimeTemplateRef_ToProto` to avoid generation errors.
11+
- We created `notebookruntime_mapper.go` under `pkg/controller/direct/aiplatform/` to bridge this conversion.
12+
13+
3. **Verification**:
14+
- Built the packages and ran unit tests to ensure `VertexAINotebookRuntimeIdentity` parses and formats the GCP resource URL (`projects/{project}/locations/{location}/notebookRuntimes/{notebookRuntime}`) successfully.
15+
- Verified that the `gcpurls` registration tests successfully validate our newly added identity template.

apis/aiplatform/v1alpha1/generate.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ go run . generate-types \
3131
--resource AIPlatformModel:Model \
3232
--resource VertexAIFeatureOnlineStore:FeatureOnlineStore \
3333
--resource VertexAIPipelineJob:PipelineJob \
34-
--resource VertexAITuningJob:TuningJob
34+
--resource VertexAITuningJob:TuningJob \
35+
--resource VertexAINotebookRuntime:NotebookRuntime
3536

3637
# Handled recursive self-referential fields by defining ListValue, Value, and ExplanationParameters manually in recursive_types.go
3738

apis/aiplatform/v1alpha1/types.generated.go

Lines changed: 223 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)