Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for passing a Kubernetes cluster identifier through the Authenticate method to both deploy exec and logs commands.
- Extended
Authenticatesignature to include aclusterparameter. - Updated the default implementation to set the
clusterfield in the request body. - Modified commands and tests to retrieve
KOOL_CLOUD_CLUSTERfrom the environment and pass it intoAuthenticate.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/cloud/k8s/kubectl.go | Extended Authenticate interface and implementation |
| services/cloud/k8s/kubectl_test.go | Updated tests to call new Authenticate signature |
| commands/cloud_deploy_logs.go | Fetch KOOL_CLOUD_CLUSTER env var and pass to Authenticate |
| commands/cloud_deploy_logs_test.go | Updated fakeK8S to record new cluster argument |
| commands/cloud_deploy_exec.go | Same env var handling for exec command |
Comments suppressed due to low confidence (2)
services/cloud/k8s/kubectl_test.go:19
- Consider adding a test case that supplies a non-empty
clustervalue and asserts that the underlyingdeployExec.Bodyreceives the correctclusterfield, ensuring the new parameter is forwarded properly.
if _, err := k.Authenticate("foo", "bar", ""); !errors.Is(err, expectedErr) {
services/cloud/k8s/kubectl.go:33
- [nitpick] The
Authenticatemethod signature has changed; please update any relevant doc comments or interface documentation to explain the newclusterparameter.
func (k *DefaultK8S) Authenticate(domain, service, cluster string) (cloudService string, err error) {
Comment on lines
+76
to
+78
| cluster := e.env.Get("KOOL_CLOUD_CLUSTER") | ||
|
|
||
| if cloudService, err = e.cloud.Authenticate(domain, service, cluster); err != nil { |
There was a problem hiding this comment.
[nitpick] The cluster fetch and authenticate call are duplicated in both logs and exec commands; consider extracting this logic into a shared helper method to reduce duplication.
Suggested change
| cluster := e.env.Get("KOOL_CLOUD_CLUSTER") | |
| if cloudService, err = e.cloud.Authenticate(domain, service, cluster); err != nil { | |
| if cloudService, err = e.fetchAndAuthenticateCluster(domain, service); err != nil { |
fabriciojs
approved these changes
May 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.