Closed hyun98 closed 1 month ago
The recent updates enhance the Yorkie CLI by introducing a GetServerVersion
feature, enabling users to retrieve and display the server version alongside client version details. This functionality improves usability and transparency, facilitating better debugging and maintenance. The changes span multiple files, including client code, API specifications, and testing frameworks, ensuring seamless integration and robustness.
Files | Change Summary |
---|---|
admin/client.go , cmd/yorkie/version.go , server/rpc/testcases/testcases.go |
Added GetServerVersion method to retrieve server version and improved CLI command functionality. |
api/docs/yorkie/v1/admin.openapi.yaml |
Introduced a new API endpoint and schemas for server version retrieval. |
sequenceDiagram
participant User
participant YorkieCLI
participant AdminService
participant Server
User->>YorkieCLI: Request server version
YorkieCLI->>AdminService: Call GetServerVersion()
AdminService->>Server: Retrieve version info
Server-->>AdminService: Return version details
AdminService-->>YorkieCLI: Send version info
YorkieCLI-->>User: Display version info
Objective | Addressed | Explanation |
---|---|---|
Show server version in Yorkie CLI (870) | β |
π° In the meadow, bright and free,
A server's version calls to me.
With each command, a joyful dance,
Yorkie's version takes a chance!
The CLI now sings, a version bright,
For users' ease, it's pure delight! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
First of all, thank you very much for your review. @hackerwins
D. Questions and suggestions for improvement:
Q) Should we allow users to view the server version without authentication? This could be beneficial for troubleshooting and version compatibility checks.
A) I agree that checking the server version without authentication has several advantages. So, I would like to add a flag that can check the version of a specific addr without authentication. For example, options like --no-auth
. Would this be a good option name? I always worry about naming.
Additionally, I'm asking just in case, but I understand that you don't mean to remove the authentication itself for version checking, right?
Q) How should we handle different scenarios?
- When the server endpoint is incorrect or the server is not running: We should provide a clear error message indicating connection issues.
A) Thank you. If the server version is not loaded properly, I need to modify it to display a more appropriate error message.
- When the server is running an older version without the version API: We should gracefully handle this case, perhaps by showing the client version and indicating that the server version is unavailable or outdated.
A) Likewise, we need to show an appropriate message regarding the case you mentioned. For example, Phrases like: 'server version checking is only supported if the server version is 0.4.27 or higher.'
Lastly, there was an error in my code. I tried to use auth, but there was a problem with only loading auth that does not fit the current context because config.Preload
was not performed, so I will fix it together.
Thank you :)
A) I agree that checking the server version without authentication has several advantages. So, I would like to add a flag that can check the version of a specific addr without authentication. For example, options like --no-auth. Would this be a good option name? I always worry about naming. Additionally, I'm asking just in case, but I understand that you don't mean to remove the authentication itself for version checking, right?
It would be better to remove authentication entirely for checking the server version. Version is often considered public information and it improves the experience for developers who need to quickly check version. I am also curious about whether kubectl's version command checks authentication. π€
It would be better to remove authentication entirely for checking the server version. Version is often considered public information and it improves the experience for developers who need to quickly check version. I am also curious about whether kubectl's version command checks authentication. π€
That's a relief, I asked just in case. Now I understood your intentions correctly. I will try to remove authentication with the version check command. I think removing authentication would be a better experience during the development process.
However, there is one thing that concerns me. I don't know much about security, but I wonder if there will be any security issues due to server version exposure. π€
Additionally, kubectl
always goes through an authentication process to obtain the server's version information (only when there is no --client
option). To obtain version information, the context and auth existing in $HOME/.kube/config
are used. This is because the k8s api-server is accessed through information.
When thinking about who will be using this feature, I think the internal developers who combined Yorkie with their system will use this feature to check or troubleshoot something. So I'm not sure about the necessity of exposing this feature to public.
However, there is one thing that concerns me. I don't know much about security, but I wonder if there will be any security issues due to server version exposure. π€
@hyun98 I think there can be a malicious attack by penetrating the weakness of the certain server version exposed by this feature.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 51.34%. Comparing base (
52d2732
) to head (781d639
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for your comment. I agree that the current code lacks the advantage of goroutines. I'll remove it as it increases complexity such as error handling... without any significant advantage. Thanks to this, it gave me an opportunity to think more about using goroutines.
What this PR does / why we need it:
Add the functionality to display the version of connected Yorkie server in the
version
commandWhich issue(s) this PR fixes:
Fixes #870
Special notes for your reviewer:
yaml
orjson
format using the--output
,-o
flag. This flag acceptsjson
andyaml
strings and converts them to the appropriate format for display.kubectl
code.Does this PR introduce a user-facing change?:
Additional documentation:
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Tests