Skip to content

Fix direct controller for NotebookInstance to resolve references - #9810

Merged
justinsb merged 3 commits into
GoogleCloudPlatform:masterfrom
codebot-robot:issue_9804
Jun 13, 2026
Merged

justinsb merged 3 commits into
GoogleCloudPlatform:masterfrom
codebot-robot:issue_9804

Conversation

@codebot-robot

Copy link
Copy Markdown
Collaborator

Update direct controller for NotebookInstance to use the correct patterns:

  1. Call common.NormalizeReferences in AdapterForObject to resolve references like NetworkRef and SubnetRef.
  2. Convert the KRM Spec to its Proto representation once in AdapterForObject and store it as desired in the adapter.
  3. Update E2E golden files for notebooksinstance-full to include the correctly resolved network and subnet references.

Fixes #9804

Update direct controller for NotebookInstance to use the correct patterns:
1. Call common.NormalizeReferences in AdapterForObject to resolve references like NetworkRef and SubnetRef.
2. Convert the KRM Spec to its Proto representation once in AdapterForObject and store it as desired in the adapter.
3. Update E2E golden files for notebooksinstance-full to include the correctly resolved network and subnet references.

Fixes GoogleCloudPlatform#9804
}

paths, err := common.CompareProtoMessage(desiredPb, a.actual, common.BasicDiff)
paths, err := common.CompareProtoMessage(a.desired, a.actual, common.BasicDiff)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a method compareNotebooks, as specified in the skill, just to follow the patterns

Comment on lines 160 to 167

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a shared method updateStatus and call from Create and Update, as is specified in the skill

@codebot-robot codebot-robot removed their assignment Jun 12, 2026
Comment on lines +243 to +245
return a.updateStatus(ctx, updateOp, updated)
}
return a.updateStatus(ctx, updateOp, a.actual)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine these two calls to updateStatus?

clonedDesired := proto.Clone(desired).(*notebookspb.Instance)

populateDefaults := func(obj *notebookspb.Instance) {
// Even if empty, it's a good pattern to define and populate GCP/server defaults here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this comment here, the populateDefaults function is not empty. The pattern is to have a function to populate GCP defaults, even if that function is empty.

@codebot-robot codebot-robot removed their assignment Jun 13, 2026
@justinsb
justinsb added this pull request to the merge queue Jun 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 13, 2026
@justinsb

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@justinsb
justinsb added this pull request to the merge queue Jun 13, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 13, 2026
@justinsb
justinsb added this pull request to the merge queue Jun 13, 2026
Merged via the queue into GoogleCloudPlatform:master with commit ab4e608 Jun 13, 2026
178 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement direct controller and E2E fixtures for NotebookInstance

2 participants