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(server): implement syncer service APIs #336

Merged
merged 2 commits into from
Jan 17, 2025
Merged

feat(server): implement syncer service APIs #336

merged 2 commits into from
Jan 17, 2025

Conversation

Ladicle
Copy link
Contributor

@Ladicle Ladicle commented Jan 17, 2025

No description provided.

@Ladicle Ladicle requested a review from kkaneda January 17, 2025 06:39
@github-actions github-actions bot added the enhancement New feature or request label Jan 17, 2025
Copy link
Contributor

@kkaneda kkaneda left a comment

Choose a reason for hiding this comment

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

LG!


// DeleteKubernetesObject deletes a kubernetes object.
func (ss *SS) DeleteKubernetesObject(ctx context.Context, req *v1.DeleteKubernetesObjectRequest) (*v1.DeleteKubernetesObjectResponse, error) {
apikey, err := auth.ExtractTokenFromContext(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

how about adding the request validation (e.g., return an error if req.ClusterId is empty)?


// PatchKubernetesObject applies a kubernetes object.
func (ss *SS) PatchKubernetesObject(ctx context.Context, req *v1.PatchKubernetesObjectRequest) (*v1.PatchKubernetesObjectResponse, error) {
userInfo, ok := auth.ExtractUserInfoFromContext(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

how about adding the request validation?

return nil, err
}

sresult, err := ss.scheduler.Schedule(userInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is this correct that PatchKubernetesObject is currently called when a new resource is created? My understanding is that we need to find out which cluster a resource is located when the resource is being updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have only tested the creation path currently. Eventually, to support creation and updating in this same function, I plan to store cluster info as a resource annotation in the tenant cluster and use it for updating. I'll leave a TODO comment here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

@Ladicle Ladicle merged commit db0e489 into main Jan 17, 2025
2 checks passed
@Ladicle Ladicle deleted the syncer-apis branch January 17, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants