-
Notifications
You must be signed in to change notification settings - Fork 313
fix(kagent cli): kagent version will show version when controller is down #879
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the kagent CLI version command to display version information even when the controller/backend is unavailable. Previously, the version command would fail if it couldn't connect to the server, but now it shows available version information with "unknown" for backend_version when the controller is down.
- Removes server connection checks from the version command
- Allows version display regardless of backend availability
- Maintains version command functionality in both CLI and interactive shell modes
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
… available Closes kagent-dev#868 Signed-off-by: Siva Naik <[email protected]>
20c1bd0 to
8ed8dbc
Compare
|
I don't think this is quite right. This removes the ability to port-forward for the version command altogether. I think rather we want to try and port-forward if the api-url is set to localhost. Does that make sense? |
|
@sivanaikk @EItanya just a ping to make sure we're going in the direction of having this fix compatible with fundamental homebrew test |
…hrough contexts (#980) This PR prints out the `kagent` version even if a port-forwarding to the `kagent` server fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as `<unknown>`: Fixes: #868 Related to: #879 ```sh > go run cli/cmd/kagent/main.go version Error starting port-forward: failed to establish connection to kagent-controller. error connecting to server. Please run 'install' command first {"backend_version":"unknown","build_date":"unknown","git_commit":"none","kagent_version":"dev"} ``` ~~**Note:** We might can consider removing the error message as it breaks the `json` output ...~~ Furthermore: - This PR uses `cmd.Context()` consistently throughout all `kagent` subcommands. - It adds a `help` Makefile target for a neat list of available Makefile targets ```sh > make controller-gen Download controller-gen locally if necessary. envtest Download setup-envtest locally if necessary. fmt Run go fmt against code. generate Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. golangci-lint Download golangci-lint locally if necessary. help list makefile targets lint-config Verify golangci-lint linter configuration lint-fix Run golangci-lint linter and perform fixes lint Run golangci-lint linter manifests Generate ClusterRole and CustomResourceDefinition objects. run Run a controller from your host. setup-envtest Download the binaries required for ENVTEST in the local bin directory. vet Run go vet against code. ``` Signed-off-by: Tom Morelly <[email protected]>
…hrough contexts (kagent-dev#980) This PR prints out the `kagent` version even if a port-forwarding to the `kagent` server fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as `<unknown>`: Fixes: kagent-dev#868 Related to: kagent-dev#879 ```sh > go run cli/cmd/kagent/main.go version Error starting port-forward: failed to establish connection to kagent-controller. error connecting to server. Please run 'install' command first {"backend_version":"unknown","build_date":"unknown","git_commit":"none","kagent_version":"dev"} ``` ~~**Note:** We might can consider removing the error message as it breaks the `json` output ...~~ Furthermore: - This PR uses `cmd.Context()` consistently throughout all `kagent` subcommands. - It adds a `help` Makefile target for a neat list of available Makefile targets ```sh > make controller-gen Download controller-gen locally if necessary. envtest Download setup-envtest locally if necessary. fmt Run go fmt against code. generate Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. golangci-lint Download golangci-lint locally if necessary. help list makefile targets lint-config Verify golangci-lint linter configuration lint-fix Run golangci-lint linter and perform fixes lint Run golangci-lint linter manifests Generate ClusterRole and CustomResourceDefinition objects. run Run a controller from your host. setup-envtest Download the binaries required for ENVTEST in the local bin directory. vet Run go vet against code. ``` Signed-off-by: Tom Morelly <[email protected]>
…hrough contexts (kagent-dev#980) This PR prints out the `kagent` version even if a port-forwarding to the `kagent` server fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as `<unknown>`: Fixes: kagent-dev#868 Related to: kagent-dev#879 ```sh > go run cli/cmd/kagent/main.go version Error starting port-forward: failed to establish connection to kagent-controller. error connecting to server. Please run 'install' command first {"backend_version":"unknown","build_date":"unknown","git_commit":"none","kagent_version":"dev"} ``` ~~**Note:** We might can consider removing the error message as it breaks the `json` output ...~~ Furthermore: - This PR uses `cmd.Context()` consistently throughout all `kagent` subcommands. - It adds a `help` Makefile target for a neat list of available Makefile targets ```sh > make controller-gen Download controller-gen locally if necessary. envtest Download setup-envtest locally if necessary. fmt Run go fmt against code. generate Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. golangci-lint Download golangci-lint locally if necessary. help list makefile targets lint-config Verify golangci-lint linter configuration lint-fix Run golangci-lint linter and perform fixes lint Run golangci-lint linter manifests Generate ClusterRole and CustomResourceDefinition objects. run Run a controller from your host. setup-envtest Download the binaries required for ENVTEST in the local bin directory. vet Run go vet against code. ``` Signed-off-by: Tom Morelly <[email protected]>
… available
./bin/kagent-local version {"backend_version":"0.6.10","build_date":"2025-09-10","git_commit":"37d6b63","kagent_version":"v0.0.0-37d6b63"} ➜ go git:(fix/kagent-cli-version) ✗ kagent uninstall kagent uninstalled successfully ➜ go git:(fix/kagent-cli-version) ✗ ➜ go git:(fix/kagent-cli-version) ✗ ./bin/kagent-local version {"backend_version":"unknown","build_date":"2025-09-10","git_commit":"37d6b63","kagent_version":"v0.0.0-37d6b63"}Closes #868