Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Workstation controller and mockgcp #3276

Merged

Conversation

jasonvigil
Copy link
Collaborator

No description provided.

@jasonvigil
Copy link
Collaborator Author

/hold will probably want to rebase this after #3265 and #3266 land

Copy link
Collaborator

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve


// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TODO(user): make sure the pluralizaiton below is correct
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: cleanup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@jasonvigil
Copy link
Collaborator Author

/hold cancel

@jasonvigil jasonvigil requested a review from yuwenma December 5, 2024 19:01
@jasonvigil jasonvigil removed this from the 1.126 milestone Dec 5, 2024
@jasonvigil jasonvigil force-pushed the workstations-workstation branch from cb02af3 to d78b49e Compare December 5, 2024 20:50
@jasonvigil jasonvigil changed the title feat: Generate Workstations types feat: Add Workstation controller and mockgcp Dec 5, 2024
@jasonvigil jasonvigil added this to the 1.127 milestone Dec 6, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest dropping the autogenerated code changes under ./pkg/clients/generated. We no longer update this lib since 1.125.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as #3341 (comment), is it ok to update these (for consistency, for these older resources)? For any future resources, I will skip updating the pkg/clients/generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Based on discussion in other PR, I reverted these changes also.


// Find retrieves the GCP resource.
// Return true means the object is found. This triggers Adapter `Update` call.
// Return true means the object is not found. This triggers Adapter `Create` call.
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo: "Return false".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, also updated the template.

if mapCtx.Err() != nil {
return mapCtx.Err()
}
return updateOp.UpdateStatus(ctx, status, nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

awesome. Thank you. Could you update the scifi template as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in #3377


req := &workstationspb.DeleteWorkstationRequest{Name: a.id.String()}
op, err := a.gcpClient.DeleteWorkstation(ctx, req)
if err != nil {
Copy link
Collaborator

@yuwenma yuwenma Dec 11, 2024

Choose a reason for hiding this comment

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

Does the GCP service returns any code if the resource does not exist (like 404)? If so, we may want to exclude NotFound from the error. If this case is already considered and covered in this PR, would you mind adding a comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice catch. Fixed. Also noticed that WorkstationConfig and WorkstationCluster have this same issue, so I fixed those as well.

spec:
parentRef:
name: workstationconfig-${uniqueId}
displayName: workstation-${uniqueId}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: make displayName a different value between create.yaml and update.yaml

Copy link
Collaborator

Choose a reason for hiding this comment

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

wait, is this an immutable field?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. The displayName field is not immutable.

spec:
parentRef:
name: workstationconfig-${uniqueId}
displayName: workstation-${uniqueId}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is displayName required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, displayName is not required. Removed from minimal test.

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 11, 2024

/approve

A few nits. non blocker

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yuwenma

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

The pull request process is described here

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

@jasonvigil jasonvigil force-pushed the workstations-workstation branch from d78b49e to b5041fd Compare December 12, 2024 19:49
@jasonvigil jasonvigil requested a review from yuwenma December 12, 2024 19:50
Return true if object is found, false if object is not found.
Also, it is not a required field. So, remove from minimal suite.
@jasonvigil jasonvigil force-pushed the workstations-workstation branch from b5041fd to b61af08 Compare December 13, 2024 19:17
Copy link
Collaborator

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

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

/lgtm

Thank you! Great job!

@google-oss-prow google-oss-prow bot added the lgtm label Dec 13, 2024
@google-oss-prow google-oss-prow bot merged commit 546d074 into GoogleCloudPlatform:master Dec 13, 2024
17 checks passed
@jasonvigil jasonvigil deleted the workstations-workstation branch December 13, 2024 21:26
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.

2 participants